30.07.2011, 15:20
How to make it in my code?
pawn Код:
/* HHCheck - iPLEOMAX */
#include <a_samp>
new HHTimer[MAX_PLAYERS];
public OnFilterScriptInit()
{
printf(" Alex Obando Castellanos ");
printf(" Anti Weapon Hack System ");
printf(" -LOADED- ");
return 1;
}
public OnPlayerSpawn( playerid ) { SetTimerEx("HealthCheck", 1000, false, "df", playerid , 100.0 ); }
public OnPlayerDeath( playerid ) { StopHealthCheck( playerid ); }
public OnPlayerDisconnect( playerid, reason ) { StopHealthCheck( playerid ); }
stock StopHealthCheck( playerid ) { return HealthCheck( playerid, -1337.1337 ); }
forward HealthCheck( playerid, Float:iHealth );
public HealthCheck( playerid, Float:iHealth )
{
if( iHealth == -1337.1337 )
{
return KillTimer(HHTimer[playerid]);
}
new Float:cHealth; GetPlayerHealth( playerid, cHealth );
if(cHealth > iHealth || cHealth > 101.0 || cHealth < -1.0) { Hacking( playerid ); HHTimer[playerid] = SetTimerEx("HealthCheck", 1000, false, "df", playerid, 100.0); }
else { HHTimer[playerid] = SetTimerEx("HealthCheck", 100, false, "df", playerid, cHealth); }
return true;
}
forward Hacking( playerid );
public Hacking( playerid )
{
new hackername[MAX_PLAYER_NAME], hackmessage[80];
new plrIP[16];
GetPlayerName(playerid, hackername, sizeof(hackername));
GetPlayerIp(playerid, plrIP, sizeof(plrIP));
format(hackmessage, sizeof(hackmessage), "%s [ID: %d] [IP: %s] is suspected of having Health Hacks %.0f to %.0f", hackername,playerid, plrIP);
for( new i=0; i<MAX_PLAYERS; i++)
{
CallRemoteFunction("SendClientMessageToAdmins","isi",0xFF0000,hackmessage,1);
}
return true;
}