Posts: 1,534
Threads: 179
Joined: Apr 2009
pawn Код:
forward ArmourTimer();
public ArmourTimer()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
new Float:armour[MAX_PLAYERS];
GetPlayerArmour(i, armour[i]);
if( armour[i] > 99.1 )
{
BanEx( i, "Armour Hack" );
}
}
}
}
It doesn't ban the player, i use a anti-cheat program for testing, and it doesn't ban me if i do 'Restore Armour', which sets the armour to 100%
Posts: 1,534
Threads: 179
Joined: Apr 2009
Quote:
Originally Posted by Twisted_Insane
Just try it with "ban" first:
Also, won't you ever kill the timer?
|
Whats the difference? I also tried with kick, still not working, but it works if i put it under OnPlayerUpdate, but then it spamms the ban log
Posts: 975
Threads: 78
Joined: Feb 2012
Reputation:
0
I don't know if this is the problem, but your callback hasn't got "playerid" included, does it? All the others, such as "OnPlayerUpdate", do have...Maybe you should try it in this way.
Posts: 1,534
Threads: 179
Joined: Apr 2009
I don't think it's because of that, because i got the same timer with money, and it works
Posts: 1,534
Threads: 179
Joined: Apr 2009
Quote:
Originally Posted by [HLF]Southclaw
What you are doing wrong here is declaring an array for all the players inside a loop for all the players.
You don't need to use an array because as soon as you loop passes one ID the armour variable can be re-used:
pawn Код:
forward ArmourTimer(); public ArmourTimer() { new Float:fPlayerArmour; for(new i; i<MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { GetPlayerArmour(i, fPlayerArmour); if( fPlayerArmour > 99.1 ) { printf("Player:%d Armour Hack", i); // ban(...) } } } }
Also for debugging you should print the 'fPlayerArmour' value just to see what it's doing.
If you don't want to spam the console make a quick textdraw and update it with the value using a format.
|
It still doesn't kick me, also doesn't show the print message in the console
Show your timer declaration function.
Posts: 1,534
Threads: 179
Joined: Apr 2009
Quote:
Originally Posted by T0pAz
Show your timer declaration function.
|
I only got this, and SetTimer under OnGamemodeInit
SetTimer("ArmourTimer", 1000, 0);