Here is my script
The issue I have
C++:
#include "\life_server\script_macros.hpp"
/*
File: fn_banAndLog.sqf
Description:
Bans a player and logs the event to the database.
Parameters:
0: OBJECT (Player to be banned)
1: STRING (Reason for the ban)
if ((_cheater getVariable ["life_adminlevel", 0]) > 0) exitWith {
diag_log format ["Server Tried To Ban Admin: %1", _cheater];
};
*/
params ["_cheater", "_banReason"];
if (isNull _cheater) exitWith {diag_log format ["isNull: %1", _cheater];};
if (!isPlayer _cheater) exitWith {};
if (isNil "_banReason") then { _banReason = "No reason provided"; };
_cheaterID = getPlayerUID _cheater;
_cheaterName = name _cheater;
// Create the ban command
_banCommand = format ['#exec ban %1', _cheaterID];
diag_log format ["Executing ban command: %1", _banCommand];
// Execute the ban command on the server
if (isServer) then {
private _result = serverCommand _banCommand;
diag_log format ["Ban command result: %1", _result];
if (!_result) then {
hint "Ban command failed.";
} else {
hint "Player banned successfully.";
diag_log format ["Player: %1 (UID: %2) has been banned for: %3", _cheaterName, _cheaterID, _banReason];
private _query = format [ // Prepare SQL query
"INSERT INTO ban_log (cheater_name, cheater_uid, ban_reason) VALUES ('%1', '%2', '%3')",
_cheaterName, _cheaterID, _banReason
];
[_query, 1, false] call DB_fnc_asyncCall;
// Optional: Notify admins or log to an additional logging service
[profileName,format ["Player Banned: %1",_banReason]] remoteExec ["SPY_fnc_notifyAdmins",RCLIENT];
};
};
C++:
2024/07/12, 8:30:52 "Executing ban command: #exec ban 76561198166293192"
2024/07/12, 8:30:52 "Ban command result: false"
2024/07/12, 8:30:52 "SPYGLASS-FLAG: MRWick : 76561198166293192 : speed_hack"