PHP код:
forward OnCheatDetected(playerid, ip_address[], type, code);
public OnCheatDetected(playerid, ip_address[], type, code)
{
if(type) BlockIpAddress(ip_address, 0); //Responded to IP (for example for rcon brute) - block him
else //Responded to the player ID
{
switch(code) //What cheat code?
{
case 5: return 1; //Teleport unoccupied cars (ac in any case will return it to its original pos, the punishment shouldn't do)
case 11: //Repair car, it is better to return the old hp (if cheater will not set old hp - anti-nop will detect him)
{
new vehid = GetPlayerVehicleID(playerid), Float:vhealth;
AntiCheatGetVehicleHealth(vehid, vhealth);
SetVehicleHealth(vehid, vhealth);
return 1;
}
case 14: //Money
{
//Here is your code
/*
//Return the old money
new a = AntiCheatGetMoney(playerid);
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, a);
return 1; //We don't need another punishment
*/
}
case 32: return ClearAnimations(playerid, 1); //CarJack, remove player from vehicle
case 40: SendClientMessage(playerid, -1, MAX_CONNECTS_MSG); //Sandbox (connect 2 or more people from the same IP), say goodbye
case 41: SendClientMessage(playerid, -1, UNKNOWN_CLIENT_MSG); //Unknown client version, say goodbye to him
case 43..47: //Crashers
{
Kick(playerid); //It is HIGHLY recommended to kick without delay, otherwise IT will have time to crash players
return 1;
}
default: //All others cheats
{
static strtmp[sizeof KICK_MSG];
format(strtmp, sizeof strtmp, KICK_MSG, code); //Another way to say goodbye
SendClientMessage(playerid, -1, strtmp);
}
}
new pPing = GetPlayerPing(playerid) + 150;
SetTimerEx("ac_KickTimer", (pPing > 500 ? 500 : pPing), false, "i", playerid); //ac_KickTimer is already in anticheat and successfully will be called
}
return 1;
}