fn_makecop.sqf
Code
#include "..\..\script_macros.hpp"
private["_target"];
_target = cursorObject;
if((isNull _target) OR !(_target isKindOf "Man") OR !(alive _target)) exitWith{};
private _action = [
localize "STR_Gang_maketo",
localize "STR_Gang_maketo",
localize "STR_Global_Yes",
localize "STR_Global_No"
] call BIS_fnc_guiMessage;
if (_action) then {
hint "successful";
[_target,getPlayerUID _target,side _target] remoteExecCall ["TON_fnc_changeFraction",RSERV];
} else {
hint "cancel";
};
Alles anzeigen
fn_changeFractionDone.sqf
Code
#include "..\..\script_macros.hpp"
private _side = param [0,sideUnknown,[civilian]];
if (_side == sideUnknown OR _side != playerSide) exitWith {life_fractionInUse = false;};
switch(_side) do {
case civilian: {
hint "successful john in";
};
case independent: {
hint "successful john in";
};
};
life_fractionInUse = false;
[] spawn life_fnc_logout;
Alles anzeigen
fn_setupaction.sqf
player addAction["<t color='#002aff'>give cop licenses</t>",fn_makecop,"",0,false,false,"",' !isNull cursorObject && {player distance cursorObject < 3.5} && {isPlayer cursorObject} && {alive cursorObject} && {cursorObject isKindOf "Man"} && life_coplevel > 27 && !life_fractionInUse'];
then in functions.hpp
and server
fn_changeFraction.sqf
Code
params [
["_unit",objNull,[objNull]],
["_uid","",[""]],
["_side",sideUnknown,[civilian]]
];
if (isNull _unit || _uid isEqualTo "" || _side isEqualTo sideUnknown) exitWith {
life_fractionInUse = false;
owner _unit publicVariableClient "life_action_inUse";
};
_query = switch(_side) do {
case civilian: {format ["UPDATE players SET civlevel='0', coplevel='1', reblevel='0', mediclevel='0' WHERE playerid='%1'",_uid]};
case independent: {format ["UPDATE players SET civlevel='0', coplevel='1', reblevel='0', mediclevel='0' WHERE playerid='%1'",_uid]};
};
switch(_side) do {
case civilian: {
_arr = missionNamespace getVariable [format ["%1_KEYS_%2",_uid,_side],[]];
missionNamespace setVariable [format ["%1_KEYS_%2",_uid,"GUER"],_arr];
};
case independent: {
_arr = missionNamespace getVariable [format ["%1_KEYS_%2",_uid,_side],[]];
missionNamespace setVariable [format ["%1_KEYS_%2",_uid,"CIV"],_arr];
};
};
[_query,1] call DB_fnc_asyncCall;
[_side] remoteExecCall ["life_fnc_changeFractionDone",(owner _unit)];
Alles anzeigen
and then in config.cpp
The principle is that after issuing the certificate through the police chief, the player released by the wheel will immediately exit the game and get a level 1 police officer.
But I don't know where the problem is, did not execute to the server and execute the mysql function.
Any help, thanks!