forward CheckHealth(playerid);
public CheckHealth(playerid)
{
new Float:fHealth;
GetPlayerHealth(playerid, Float:fHealth);
if(fHealth != GetPVarFloat(playerid, "faPlayerHealth"))
{
if(GetPlayerAnimationIndex(playerid) != 1666 && GetTickCount() < (lastupdate[playerid]+2000) && fHealth > GetPVarFloat(playerid, "faPlayerHealth"))
{
SendClientMessageToAll(-1, "HACKS");
}
else
{
//player lost health && GetPlayerInterior(playerid) == 0
}
SetPVarFloat(playerid, "faPlayerHealth", fHealth);
}
return 1;
}
forward CheckHealth(playerid);
public CheckHealth(playerid)
{
new Float:fHealth;
GetPlayerHealth(playerid, fHealth);
if(fHealth != GetPVarFloat(playerid, "faPlayerHealth"))
{
if(GetPlayerAnimationIndex(playerid) != 1666 && GetTickCount() < (lastupdate[playerid]+2000) && fHealth > GetPVarFloat(playerid, "faPlayerHealth")) return SendClientMessageToAll(-1, "HACKS");
else
{
//player lost health && GetPlayerInterior(playerid) == 0
}
SetPVarFloat(playerid, "faPlayerHealth", fHealth);
}
return 1;
}
Hmm, try this:
Also search for ' SetTimerEx("CheckHealth" ' and tell me how fast the timer executes..? |
CMD:getvar(playerid, params[]) { new string[256]; format(string, sizeof(string), "var is %f", GetPVarFloat(playerid, "faPlayerHealth")); SendClientMessage(playerid, -1, string); return 1; }
CMD:setvar(playerid, params[]) { new Float:crap; crap = 100.0; SetPVarFloat(playerid, "faPlayerHealth", crap); SendClientMessage(playerid, -1, "var set to 100.0"); return 1; }
if(GetPlayerAnimationIndex(playerid)) { new animlib[32]; new animname[32]; new msg[128]; GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,32,animname,32); if(!strcmp(animname, "VEND_USE", true)) {SetPVarFloat(playerid, "faPlayerHealth", 100.0);} }