Determine player's armour? - 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: Determine player's armour? (
/showthread.php?tid=322460)
Determine player's armour? -
Supercop - 02.03.2012
I am trying to expand the anti-cheat of a script I use, and I don't have a clue how to solve this:
I want that the script checks if a player has 100 armour or more, if so, something should happen.
How I do this?
Re: Determine player's armour? -
Walsh - 02.03.2012
You could set a timer on GameModeInit every 5 seconds to check armour.
pawn Код:
public OnGameModeInit()
{
SetTimer("ArmourCheck",5000,true);
return 1;
}
forward ArmourCheck(playerid);
public ArmourCheck(playerid)
{
for(new i=0; i <MAX_PLAYERS; i++) // loops through all the players
{
new Float:armour;
GetPlayerArmour(i,armour); // Gets everyone's armour
if(armour > 100) // if anyone's armour is bigger than 100, then
{
Ban(i); // It bans them
}
}
return 1;
}
Re: Determine player's armour? -
Rob_Maate - 02.03.2012
Just ensure your script only ever sets a player's armor to a maximum of 99.
For instance:
#define MAX_ARMOR 99
and when setting the player's armor...
pawn Код:
SetPlayerArmour(playerid, MAX_ARMOR);
in place of 100.0
If your script can ONLY SET a player's armor to 99 or less, your free to ban anyone that acquires 100 armor.
Don't detect for ONLY more than 100, considering most health/armor hacks are aware this is monitored and don't do it.
You could use the above timer, or simply in OnPlayerUpdate:
pawn Код:
public OnPlayerUpdate(playerid)
{
new Float:Armor;
GetPlayerArmour(playerid, Armor);
if(Armor >= 100) BanEx(playerid, "Armor-Hacks");
return 1;
}
Re: Determine player's armour? -
Supercop - 07.03.2012
I did but it doesn't work.
Instead of banning the player I set that the admins should receive a warning message, but this fails.
In the script I made sure that all posible of ways of gaining armour (set by admin, LSPD on duty, etc.) have a maximum of 99. I made a quick command to give myself 100 armour to test the system but it doesn't seem to work.