21.09.2011, 04:00
Well i have this problem where my anti-cheat bans me after the spawn protection is over.
Anti-cheat ignores the spawn protected players until the variable is set to 0 and health is set to 99.
For some reason it bans the players after spawn protection is over.
Also, After the timer is over and i set the health back to 99.. i print it and the health is 159.000 instead of 99 which is why i am getting banned.. but why is it 159 and not 99 ?
Anti-cheat ignores the spawn protected players until the variable is set to 0 and health is set to 99.
For some reason it bans the players after spawn protection is over.
Also, After the timer is over and i set the health back to 99.. i print it and the health is 159.000 instead of 99 which is why i am getting banned.. but why is it 159 and not 99 ?
Код:
THE ANTI CHEAT IS CALLED EVERY 1 SECOND.
public Cheat()
{
new Float:health,playerid;
ForEachPlayer(playerid)
{
GetPlayerHealth(playerid,health);
if(health > 99)
{
if (PlayerInfo[playerid][spawnp] == 0)
{
if (PlayerInfo[playerid][AdminLevel] < 1)
{
BanPlayerEx(playerid, "Anticheat", "Health Cheats [max health]");
}
}
}
}
return 1;
}
Код:
This is called when spawn prot is over...
public SpawnProtection(playerid)
{
new Float:health;
SetPlayerHealth(playerid, 99.0); <------ I SET THE HEALTH TO 99.0
SendClientMessage(playerid,COLOR_RED, "You are no longer protected.");
GetPlayerHealth(playerid,health);
printf(" YOUR HEALTH IS %f ",health); <------ WHEN I CHECK IT HERE ITS 159.0
PlayerInfo[playerid][spawnp] = 0;
return 1;
}

