SA-MP Forums Archive
Help Anti-health hacks & Anti-armour hacks - 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: Help Anti-health hacks & Anti-armour hacks (/showthread.php?tid=471371)



Help Anti-health hacks & Anti-armour hacks - Cristy09 - 22.10.2013

Код:
public OnPlayerSpawn(playerid)
{
       SetPlayerHealth(playerid, 99);
	return 1;
}
Код:
public OnPlayerUpdate(playerid)
{
    new Float:pHealth;
    GetPlayerHealth(playerid, pHealth);
    if(pHealth > 99)
    {
    SendClientMessage(playerid, -1, "{FF0000}**You got banned for health hacks, therefore you can say good bye to the server.");
    Ban(playerid);
    }
    new Float:pArmour;
    GetPlayerArmour(playerid, pArmour);
    if(pArmour > 99)
    {
    SendClientMessage(playerid, -1, "{FF0000}**You got banned for armour hacks, therefore you can say good bye to the server");
    Ban(playerid);
    }
    return 1;
}
I don't know what the fuck. The script looks cool & easy, but it bans me when I spawn everytime.


Re: Help Anti-health hacks & Anti-armour hacks - Jani - 22.10.2013

maybe try changing pHealth and pArmour to 100?


Re: Help Anti-health hacks & Anti-armour hacks - Cristy09 - 22.10.2013

Quote:
Originally Posted by Jani
Посмотреть сообщение
maybe try changing pHealth and pArmour to 100?
Same thing happened when I spawned, it banned me.


Re: Help Anti-health hacks & Anti-armour hacks - TomatoRage - 22.10.2013

pawn Код:
public OnPlayerUpdate(playerid)
{
    new Float:pHealth;
    GetPlayerHealth(playerid, pHealth);
    if(pHealth >= 101)
    {
    SendClientMessage(playerid, -1, "{FF0000}**You got banned for health hacks, therefore you can say good bye to the server.");
    Ban(playerid);
    }
    new Float:pArmour;
    GetPlayerArmour(playerid, pArmour);
    if(pArmour >= 101)
    {
    SendClientMessage(playerid, -1, "{FF0000}**You got banned for armour hacks, therefore you can say good bye to the server");
    Ban(playerid);
    }
    return 1;
}
Try this


Re: Help Anti-health hacks & Anti-armour hacks - [WoF]Sonny - 22.10.2013

I think OnPlayerUpdate is called before players health is set to 99, you need small protection, somehting like this:

pawn Код:
new Spawned[MAX_PLAYERS];
new ProtectionTmr[MAX_PLAYERS];

OnPlayerConnect(playerid)
{
Spawned[playerid] = 0;
return 1;
}

OnPlayerSpawn(playerid)
{
SetPlayerHealth(playerid, 99);
ProtectionTmr[playerid] = SetTimerEx("Protection",5000,0,"d",playerid);
return 1;
}

forward Protection(playerid);
public Protection(playerid)
{
Spawned[playerid] = 1;
KillTimer(ProtectionTmr[playerid]);
return 1;
}

public OnPlayerUpdate(playerid)
{
    new Float:pHealth;
    GetPlayerHealth(playerid, pHealth);
    if(pHealth > 100 && Spawned[playerid] == 1)
    {
    SendClientMessage(playerid, -1, "{FF0000}**You got banned for health hacks, therefore you can say good bye to the server.");
    Ban(playerid);
    }
    new Float:pArmour;
    GetPlayerArmour(playerid, pArmour);
    if(pArmour > 100 && Spawned[playerid] == 1)
    {
    SendClientMessage(playerid, -1, "{FF0000}**You got banned for armour hacks, therefore you can say good bye to the server");
    Ban(playerid);
    }
    return 1;
}