[Ajuda] Health Bugada??
#1

Fiz este code para prevenir uns cheaters simples:

pawn Код:
//AntiCheaters

new Float:AntiCheater_Vida[MAX_PLAYERS];

forward CheaterHealth();
public CheaterHealth()
{
    for(new Var = 0; Var < sizeof(AntiCheater_Vida); Var++)
        AntiCheater_Vida[Var] = 0.0;

    //foreach(new i: Player)   
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(!IsPlayerConnected(i)) continue;
        GetPlayerHealth(i, AntiCheater_Vida[i]);
        SetPlayerHealth(i, AntiCheater_Vida[i] + 5);
    }
    SetTimer("CheaterHealthCheck", 5000, false);
    return 1;
}

forward CheaterHealthCheck();
public CheaterHealthCheck()
{
    new Float:AntiCheaterCheck;
    //foreach(new i: Player)
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(!IsPlayerConnected(i)) continue;
        GetPlayerHealth(i, AntiCheaterCheck);
        printf("ID %d: %f = %f?", i, AntiCheaterCheck, AntiCheater_Vida[i]);
        if(AntiCheaterCheck == AntiCheater_Vida[i])
        {
            SendClientMessage(i, -1, "Cheater");
        }
        SetPlayerHealth(i, AntiCheater_Vida[i]);
    }
    return 1;
}
So que ou o SetPlayerHealth ou o GetPlayerHealth ta bugado.
De vez em quando funciona.

Debug:

Код:
ID 0: 115.000000 = 115.000000?
ID 0: 120.000000 = 115.000000?
ID 0: 110.000000 = 110.000000?
ID 0: 110.000000 = 110.000000?
ID 0: 110.000000 = 110.000000?
ID 0: 110.000000 = 110.000000?
Ajuda??
Reply


Messages In This Thread
Health Bugada?? - by Dr_Pawno - 18.12.2012, 15:26
Re: Health Bugada?? - by VenoN - 18.12.2012, 15:31
Re: Health Bugada?? - by .FuneraL. - 18.12.2012, 15:33
Re: Health Bugada?? - by Sky™ - 18.12.2012, 15:34
Re: Health Bugada?? - by Dr_Pawno - 18.12.2012, 15:34
Re: Health Bugada?? - by tonisantolia - 18.12.2012, 15:39
Re: Health Bugada?? - by VenoN - 18.12.2012, 19:22
Re: Health Bugada?? - by Dr_Pawno - 18.12.2012, 21:05

Forum Jump:


Users browsing this thread: 2 Guest(s)