Help with anticheat.. - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help with anticheat.. (
/showthread.php?tid=181226)
Help with anticheat.. -
The_Moddler - 04.10.2010
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
Re: Help with anticheat.. -
Mauzen - 04.10.2010
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)
Re: Help with anticheat.. -
samgreen - 04.10.2010
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?
Re: Help with anticheat.. -
The_Moddler - 04.10.2010
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.
Re: Help with anticheat.. -
The_Moddler - 04.10.2010
Someone?
Thanks
Re: Help with anticheat.. -
Fedee! - 04.10.2010
Maybe is becouse
GetPlayerHealth and
SetPlayerHealth uses variables to save the info..