English Solved Marking crimes as paid when a player pays bail in jail

  • Auteur de la discussion Auteur de la discussion LogicLion
  • Date de début Date de début

LogicLion

User
5/1/21
14
5
250
When a player pays bail in default Altis Life it removes all his crimes.

After a chat with Maxance about Interpol, and being able to remove a crime if he pays bail or, mark as paid.

I would like it if once a player pays bail in jail, his crimes are marked as paid.
 
Solution
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')...
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];
 
  • Like
  • Heart
Les réactions: BastienWolf et LogicLion
Solution