SA-MP Forums Archive
ANTICHEAT | spawnhp 100?? - 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: ANTICHEAT | spawnhp 100?? (/showthread.php?tid=378649)



ANTICHEAT | spawnhp 100?? - s3rserii - 18.09.2012

Hello,
i code my onw little anticheat for halth. I set all players hp to 99 and if a player have over 99hp (like cheating) will banned. But if anyone dies he get banned. Is code must work but it not ^^
If i connect on the server it work and i have 99hp but if i die and respawn automatic it will bann me..

hope for help


Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerHealth(playerid, 50);
...
Код:
public OnPlayerUpdate(playerid)
{ 	
new Float:health;
    GetPlayerHealth(playerid,health);
    if (health > 99)
    {
        SpielerInfo[playerid][pBan] = 1;
        SendClientMessage(playerid, red, "[ANTICHEAT] {FFFFFF}Du wurdest wegen Health-Hack gebannt");
        format(string,sizeof(string),"{FF0000}[ANTICHEAT] {00FF00}%s {FFFFFF}wurde wegen Health-Hack gebannt",SpielerNameAnzeige(playerid));
        SendClientMessageToAll(red,string);
        Kick(playerid);
    }
...



Re: ANTICHEAT | spawnhp 100?? - 2KY - 18.09.2012

Try putting your OPU check into a timer. OnPlayerUpdate is too quick for your players health to update in time.


AW: ANTICHEAT | spawnhp 100?? - s3rserii - 18.09.2012

OnPlayerUpdate call every second right?


AW: ANTICHEAT | spawnhp 100?? - Littl3j0hNy - 18.09.2012

Did you read the wiki page for OnPlayerUpdate?

Important Note: This callback is called very frequently per second per player, only use it when you know what it's meant for.

- Lj


Re: AW: ANTICHEAT | spawnhp 100?? - 2KY - 18.09.2012

Quote:
Originally Posted by s3rserii
Посмотреть сообщение
OnPlayerUpdate call every second right?
SetTimer( "Timer", 1000, true );

would be called every second, OnPlayerUpdate is called thousands of times per second. (Every time they press a key, move their mouse, ect)


Re: ANTICHEAT | spawnhp 100?? - next-studio|TheKiller - 18.09.2012

Use a settimer, and do not overload it with useless scripts.