21.08.2017, 07:15
Hi. Trying to do health, armour anti-cheat, but sometimes it kick player when he is spawning, sometimes is good.. Why?
Code:
Then I put line AntiCheat(playerid); in onplayerupdate.
Also in onplayerspawn:
And onplayerconnect
Code:
Код:
stock AntiCheat(playerid) { if(!PlayerInfo[playerid][spawned]) return 0; if(GetPlayerState(playerid) != PLAYER_STATE_SPECTATING) { new Float:amount; GetPlayerHealth(playerid, amount); if(amount > 99) return Kick(playerid,"Health cheat"); GetPlayerArmour(playerid, amount); if(amount > 99) return Kick(playerid,"Armour cheat"); } return 1; }
Also in onplayerspawn:
Код:
SetPlayerHealth(playerid, 98); SetPlayerArmour(playerid, 0); PlayerInfo[playerid][spawned] = true;
Код:
SetPlayerHealth(playerid, 98); SetPlayerArmour(playerid, 0);