Anti Armour help - 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: Anti Armour help (
/showthread.php?tid=232246)
Anti Armour help -
aqu - 27.02.2011
Hello,I putted in my script this :
Код:
forward ArmourCheck( );
public ArmourCheck( )
{
new Float:pArmour;
for(new i=0; i<MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i)) continue;
GetPlayerArmour(i, pArmour);
if(pArmour > 0.0) Ban(i);
}
}
To test I downloaded cheats,I putted on armour,but I don't get ban.Can some one help me ?
Re: Anti Armour help -
Leon_Rahil! - 27.02.2011
pawn Код:
forward ArmourCheck();
public ArmourCheck()
{
for (new i = 0; i < MAX_PLAYERS; i++) // Begins for loop.
{
if (IsPlayerConnected(i)) // Checks if the player is connected.
{
if (GetPlayerArmour(i) > 0.0) // Checks if they have armour on at all.
{
Ban(i); // Bans the player.
}
}
}
}
Re: Anti Armour help -
Calgon - 27.02.2011
Did you set a timer for the function to be called regularly? Also, you do realize that with that function, anyone connected who has armour will immediately be banned.
Re: Anti Armour help -
mprofitt - 27.02.2011
Quote:
Originally Posted by aqu
Hello,I putted in my script this :
Код:
forward ArmourCheck( );
public ArmourCheck( )
{
new Float:pArmour;
for(new i=0; i<MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i)) continue;
GetPlayerArmour(i, pArmour);
if(pArmour > 0.0) Ban(i);
}
}
To test I downloaded cheats,I putted on armour,but I don't get ban.Can some one help me ?
|
Untested, but this is the idea...
pawn Код:
// Whereever armour is added
PlayerInfo[playerid][Armour] = // armour amount
public OnPlayerUpdate(playerid)
{
new Float:armour
GetPlayerArmour(playerid, armour);
if(PlayerInfo[playerid][Armour] > armour)
{
// Armour Hack Detected
// Call a function
}
else
PlayerInfo[playerid][Armour] = armour;
}
Re: Anti Armour help -
Leon_Rahil! - 27.02.2011
I disagree with you, mprofitt. I believe there should be a timer called instead.
Such as:
pawn Код:
SetTimer("ArmourCheck", 1000, 1);
Re: Anti Armour help -
mprofitt - 27.02.2011
Quote:
Originally Posted by aqu
Hello,I putted in my script this :
Код:
forward ArmourCheck( );
public ArmourCheck( )
{
new Float:pArmour;
for(new i=0; i<MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i)) continue;
GetPlayerArmour(i, pArmour);
if(pArmour > 0.0) Ban(i);
}
}
To test I downloaded cheats,I putted on armour,but I don't get ban.Can some one help me ?
|
Quote:
Originally Posted by Leon_Rahil!
I disagree with you, mprofitt. I believe there should be a timer called instead.
Such as:
pawn Код:
SetTimer("ArmourCheck", 1000, 1);
|
Feel free to call a timer then, don't matter how you do it. It is still the same idea.
Re: Anti Armour help -
BMUK - 27.02.2011
Quote:
Originally Posted by Leon_Rahil!
pawn Код:
if (GetPlayerArmour(i) > 0.0) // Checks if they have armour on at all. { // }
|
You can't check a players armour level like that.
https://sampwiki.blast.hk/wiki/GetPlayerArmour
Re: Anti Armour help -
aqu - 27.02.2011
Hey I setted timer ,and when I joining to my server I getting banned without no reason.
Re: Anti Armour help -
BMUK - 27.02.2011
Use this:
pawn Код:
public ArmourCheck( )
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
new Float:pArmour;
GetPlayerArmour(i,pArmour);
if(pArmour > 0)
{
Ban(i);
}
}
}
}
Re: Anti Armour help -
mprofitt - 27.02.2011
Quote:
Originally Posted by Leon_Rahil!
I disagree with you, mprofitt. I believe there should be a timer called instead.
Such as:
pawn Код:
SetTimer("ArmourCheck", 1000, 1);
|
Maybe you should read this...
https://sampforum.blast.hk/showthread.php?tid=184118
Player updates
When any of these things changes for the client, the client will send information to the server and the server will call OnPlayerUpdate:
* Health/armour
* Vehicle health, body damage, color, mods
* Death
* Velocity
* Position/rotation
* Animation
* Pressed keys
* Weapon/ammo
* Camera position (only when aiming/shooting; if not, it's sent about twice a second)
You can, with scripting, detect almost exactly what has changes in OnPlayerUpdate.