Little problem.
#1

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 ?


Код:
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;
}
Reply
#2

Bug, because server puts his HP on 100, and than on 99.....
Reply
#3

what? it sets to 159
Reply
#4

Well... PWNED Look here:
pawn Код:
public Cheat( playerid )
{
    new Float:health;
    ForEachPlayer( playerid )
    {
        GetPlayerHealth( playerid, health );
        if( health > 99 )
        {
            if( PlayerInfo[ playerid ][ spawnp ] == 0 )
            {
                if( PlayerInfo[ playerid ][ AdminLevel ] < 1 )
                {
                    BanPlayerEx( playerid, "Anticheat", "Health Cheats [MAX HP]" );
                }
            }
        }
    }
    return ( 1 );
}
And you have:
pawn Код:
SetTimer( "Cheat", 1000, true );
Change with:
pawn Код:
SetTimerEx( "Cheat", 1000, true, "i", playerid );
Or if the timer is at OnGameModeInit, Look Here..:
pawn Код:
for( new i = 0; i < MAX_PLAYERS; i ++ ) SetTimerEx( "Cheat", 1000, true, "i", i );
Reply
#5

Still bans after the spawnp is over.
Reply
#6

Check anywhere in your gm is there a code that set your health higher than 99
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)