This is public
[pawn]public healthkick(playerid)
{
if (HP >= 99)
Kick( playerid );
return 1;
}
[/pawn]
OnPlayerConnect i SetPlayerHealth(playerid,98); OnPlayerSpawn i SetPlayerHealth(playerid,98); OnGameModeInit i SetTimer("healthkick",100,1);
After I compile without error
Is this useful?
It may be useful, but u have admitted a mistake. Remove the parameter (I mean playerid) in your public(healthkick I mean), because any variable is set to 0 by definition (for example, "
new zero" 's value is 0 after "zero" declared. So this will only check if player with ID 0 is hacker (read note about SetTimer).
Well, if you want to check every player on availability of hacks, you should make a cycle.
Clean the code in ur public and type this:
[pawn]new p; //we declared a new variable called "p"
[/pawn]
Now let's start a cycle. Type this below:
[pawn]for(p = 0; p < MAX_PLAYERS; p++)//the cycle declared, p = 0, p < MAX_PLAYERS, and p + 1
{
new Float:ph; // declaring a new Float called "ph".
GetPlayerHealth(p, ph); // getting p's health (p is now player, bcuz we wanted this, and ph is float to store player's health we got.
if(ph >= 99)//the condition checks if the float "ph"'s value is 99 more
{
SendClientMessage(p, 0xFF0000AA, "Go use ur shitty healhack on another server, you, little dickhead"); // we ask the "p" to remove hacks
Kick(p); // we kick Pe
}
}
return 1;
}[/pawn]
lemme check if it works, I will tell u.
Oh, ye. set the interval of SetTimer to 1000, cuz 100 will eat ur memory