So I'm using this Français - Blacklist de joueurs
I have made some changes so a player who is flagged by SpyGlass is added and kicked to the lobby. Was wondering if there was a better way to do this?
I'm still learning and am not great with DB stuff.
I have made some changes so a player who is flagged by SpyGlass is added and kicked to the lobby. Was wondering if there was a better way to do this?
I'm still learning and am not great with DB stuff.
Code:
#include ".. \script_macros.hpp"
/*
File: fn_cookieJar.sqf
Author: Bryan "Tonic" Boardwine
Description:
Reports to the RPT of a confirmed cheater for external programs
to parse,log or ban automatically.
*/
private ["_pName", "_pUID", "_pReason"];
_pName = [_this, 0, "", [""]] call BIS_fnc_param;
_pUID = [_this, 1, "", [""]] call BIS_fnc_param;
_pReason = [_this, 2, "", [""]] call BIS_fnc_param;
if (_pName isEqualTo "" || _pUID isEqualTo "" || _pReason isEqualTo "") exitWith {}; Bad params passed..
diag_log "-----------------------CHEATER-FLAGGED!! --------------------------";
diag_log format [localize "STR_SpyDetect_cookieJar", _pName, _pUID, _pReason]; Outputs to RPT for external programs to parse, log, and react to.
diag_log "-----------------------CHEATER-FLAGGED!! --------------------------";
[_pUID] remoteExecCall ["DB_fnc_AddBan",RSERV];//Add player to ban list.
Code:
#include "\life_server\script_macros.hpp"
/*
File: fn_AddBan.sqf
Author: Altis Life Dev
Description: Adds player to ban list
*/
private ["_uid","_time","_query"];
params [
["_uid",""],
["_time","2030-01-01 12:00:00"]
];
Check if player is already banned
_queryBanned = format ["SELECT ID FROM ban_list WHERE player_id='%1' AND CURRENT_TIMESTAMP < banned_until",_uid];
_isBanned = [_queryBanned,2] call DB_fnc_asyncCall;
if (EXTDB_SETTING(getNumber,"DebugMode") isEqualTo 1) then {
diag_log format ["Ban List Check: %1",_queryBanned];
};
if ((count _isBanned) > 0) then {
hint format ["%1 is on ban list until %2",_uid,_time];
failMission "SpyGlass";
} else {
Add player to ban list
_query = format ["INSERT INTO ban_list (player_id, banned_until) VALUES('%1','%2')",_uid,_time];
[_query,2] call DB_fnc_asyncCall;
if (EXTDB_SETTING(getNumber,"DebugMode") isEqualTo 1) then {
diag_log format ["Ban List Update: %1",_query];
};
hint format ["%1 has been banned until %2",_uid,_time];
failMission "SpyGlass";
};