SA-MP Forums Archive
Small problem with SetTimerEx - 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: Small problem with SetTimerEx (/showthread.php?tid=519038)



Small problem with SetTimerEx - Anuris - 12.06.2014

Hello.
I'm trying to make invincible anti cheat, looks like that:
pawn Код:
#include <a_samp>
 
public OnFilterScriptInit()
{
    SetTimer("AntiCheat", 60000, true);
    return true;
}
forward AntiCheat();
public AntiCheat()
{
    for(new i; i < 1000; i++)
    {
        //if(!IsPlayerConnected(i) || CallRemoteFunction("NoGm", "i", "i")) continue;
        new Float:FirstHp;
        GetPlayerHealth(i, FirstHp);
        SetPlayerHealth(i, FirstHp-1);
        SetTimerEx("CheakGM", 2000, false, "if", "i", "FirstHp");
    }
}
forward CheakGM(playerid, Float:FirstHp);
public CheakGM(playerid, Float:FirstHp)
{
    new Float:SecondHp;
    GetPlayerHealth(playerid, SecondHp);
    if(floatcmp(FirstHp, SecondHp) == 0) Kick(playerid);
    else SetPlayerHealth(playerid, FirstHp);
}
I'm trying to call CheakGM by SetTimerEx, but it's not calling.
What is my problem?

Sorry for my Elnglish. ;(


Re: Small problem with SetTimerEx - Jefff - 12.06.2014

SetTimerEx("CheakGM", 2000, false, "if", i, FirstHp-1);


Re: Small problem with SetTimerEx - TakeiT - 12.06.2014

pawn Код:
SetTimerEx("CheakGM", 2000, false, "f", "FirstHp");
has to be defined as a float


Re: Small problem with SetTimerEx - Anuris - 12.06.2014

Thanks. =)