Help with anticheat..
#1

Well, i'm trying to make an anticheat based from here: https://sampforum.blast.hk/showthread.php?tid=178543
But i'm trying to make it for health..

Here is what I done
pawn Код:
#define SetPlayerHealthEx(%0,%1) SetPVarInt(%0, "Health", GetPlayerHealthEx(%0)+%1), SetPlayerHealth(%0,%1)
#define GetPlayerHealthEx(%0,%1) GetPVarInt(%0, "Health")

public OnPlayerUpdate(playerid)
{
    if(GetPlayerHealthEx(playerid, HealthA) != GetPlayerHealth(playerid, HealthA))
    {
        new const old_health = GetPlayerHealthEx(playerid, HealthA);
        SetPlayerHealthEx(playerid, old_health);
    }
    return 1;
}
But GetPlayerHealthEx gives me this error:

Код:
error 017: undefined symbol "GetPlayerHealthEx"
Anything?

I know that maybe it won't work.. but I'm just trying out

Thanks
Reply
#2

I never used defines with more than one line, but i saw some in other topics, correct me if i am wrong.

try replacing the
SetPVarInt(%0, "Health", GetPlayerHealthEx(%0)+%1), SetPlayerHealth(%0,%1)

with

pawn Код:
#define SetPlayerHealthEx(%0,%1)SetPVarInt(%0, "Health", GetPlayerHealthEx(%0)+%1) \
    SetPlayerHealth(%0,%1)


//or

#define SetPlayerHealthEx(%0,%1) SetPVarInt(%0, "Health", GetPlayerHealthEx(%0)+%1); SetPlayerHealth(%0,%1)
Reply
#3

Quote:
Originally Posted by Mauzen
Посмотреть сообщение
I never used defines with more than one line, but i saw some in other topics, correct me if i am wrong.

try replacing the
SetPVarInt(%0, "Health", GetPlayerHealthEx(%0)+%1), SetPlayerHealth(%0,%1)

with

pawn Код:
#define SetPlayerHealthEx(%0,%1)SetPVarInt(%0, "Health", GetPlayerHealthEx(%0)+%1) \
    SetPlayerHealth(%0,%1)


//or

#define SetPlayerHealthEx(%0,%1) SetPVarInt(%0, "Health", GetPlayerHealthEx(%0)+%1); SetPlayerHealth(%0,%1)
The second version is the correct macro. But you should realize that your SetPlayerHealthEx macro adds to the player health instead of setting it. Are you sure this is the intended behavior?
Reply
#4

Mhh... it's strange, it gives me now this:
Код:
error 017: undefined symbol "SetPlayerHealthEx"
I was thinking, GetPlayerHealth & SetPlayerHealth works with floats.. maybe there is the problem.

Quote:
Originally Posted by samgreen
Посмотреть сообщение
The second version is the correct macro. But you should realize that your SetPlayerHealthEx macro adds to the player health instead of setting it. Are you sure this is the intended behavior?
Yes, you're right, I just deleted GetPlayerHealthEx from the first macro, thanks.
Reply
#5

Someone?
Thanks
Reply
#6

Maybe is becouse GetPlayerHealth and SetPlayerHealth uses variables to save the info..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)