ANTICHEAT | spawnhp 100??
#1

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);
    }
...
Reply
#2

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

OnPlayerUpdate call every second right?
Reply
#4

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
Reply
#5

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)
Reply
#6

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


Forum Jump:


Users browsing this thread: 2 Guest(s)