The-Programmer Forum

Maxence a écrit le dernier message :
#2
Hello, there is no function in Interpol that allows you to do this. So I'll help you to create it.

In your mission -> CfgRemoteExec.hpp, add the following line :
Code:
F(TON_fnc_deletePlayerCrimes,SERVER)

In your life_server -> config.cpp, below :
Code:
file = "\life_server\Functions\Systems";
add this class :
Code:
class deletePlayerCrimes {};

Then in your life_server -> Functions -> Systems, create a file fn_deletePlayerCrimes.sqf with :
Code:
/*
    Maxence
*/
_namePlayer = param [0,"",[""]];

_split = _namePlayer splitString " ";
_prenom = _split select 0;
_nom = "";
for "_i" from 1 to count(_split)-1 do {
    _nom = _nom + (_split select _i);
};

_query = format ["SELECT id FROM interpol WHERE (prenom='%1' OR prenom='%2') AND (nom='%2' OR nom='%1')",_prenom,_nom];
_queryResult = [_query,2] call DB_fnc_asyncCall;

if ((count _queryResult) isEqualTo 0) exitWith {diag_log format ["ERROR Interpol : Cannot find player : %1",(_namePlayer)];};
_interpolID = _queryResult select 0;

_query = format ["UPDATE interpol_crimes SET payed='1' WHERE interpol_id='%1'",_interpolID];
[_query,1] call DB_fnc_asyncCall;

You'll now be able to use this function to delete the crimes of the player in the (mission) script file you want using this function :
Code:
[(name player)] remoteExec ["TON_fnc_deletePlayerCrimes",2];