Little problem. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Little problem. (
/showthread.php?tid=284858)
Little problem. -
Saurik - 21.09.2011
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;
}
Re: Little problem. -
Dragony92 - 21.09.2011
Bug, because server puts his HP on 100, and than on 99.....
Re: Little problem. -
Saurik - 21.09.2011
what? it sets to 159
Re: Little problem. -
aRoach - 21.09.2011
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 );
Re: Little problem. -
Saurik - 21.09.2011
Still bans after the spawnp is over.
Re: Little problem. -
Elmin - 21.09.2011
Check anywhere in your gm is there a code that set your health higher than 99