19.02.2009, 10:38
Ok, look. I was making my anticheat(money) system and here what I have:
When player type /login pass i start timer for him
When he disconnects from server i kill it
Here is how i check player's money
if player is suspecting in cehating i start 2 timer for him
And here is my giveplayermoney function
So. think that everything is ok. And it's really working. BUT! Sometimes people is kicked from server because of cheats(they are not cheaters). Help me pls.
When player type /login pass i start timer for him
Код:
moneytimer[playerid] = SetTimerEx("MoneyCheck",3000,1,"i",playerid);
Код:
KillTimer(moneytimer[playerid]);
Код:
forward MoneyCheck(playerid); public MoneyCheck(playerid) { new clientcash; clientcash = GetPlayerMoney(playerid); if(clientcash > servercash[playerid]) { SetTimerEx("MoneyCheck2",2000,false,"i",playerid); } else { servercash[playerid] = clientcash; } return 1; }
Код:
forward MoneyCheck2(playerid); public MoneyCheck2(playerid) { new clientcash; clientcash = GetPlayerMoney(playerid); if(clientcash > servercash[playerid]) { new string[256],nick[24]; GetPlayerName(playerid, nick, sizeof(nick)); format(string, sizeof(string), "[LSPD] Игрок %s был кикнут за читы на деньги.",nick); SendClientMessageToAll(COLOR_RED, string); ResetPlayerMoney(playerid); Kick(playerid); } return 1; }
Код:
forward xGivePlayerMoney(playerid, amount); public xGivePlayerMoney(playerid, amount) { new tmp; tmp = GetPlayerMoney(playerid); GivePlayerMoney(playerid,amount); servercash[playerid] = tmp + amount; return 1; }