SA-MP Forums Archive
Im making a Anti Weapon Hack System.... Quick Question - 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: Im making a Anti Weapon Hack System.... Quick Question (/showthread.php?tid=330904)



Im making a Anti Weapon Hack System.... Quick Question - Scripter12345 - 02.04.2012

Im making a Anti Weapon Hack System


And im just wondering i have made one and it kind of works but, when i do /giveweapon ( Which is a admin command ) and pick a weapon as soon as i pick it i get banned..... How can i stop that so only people that spawn weapons with hacks get banned


Please Help


Thank You So Much


Re: Im making a Anti Weapon Hack System.... Quick Question - Scripter12345 - 03.04.2012

Please Help Me If You Need Any Part Of The Script Just Reply


Re: Im making a Anti Weapon Hack System.... Quick Question - Catalyst- - 03.04.2012

First, create a variable...
Code:
new aWeap[MAX_PLAYERS];
Then, in the /giveweapon command...
Code:
aWeap[playerid] = 1;
Then, in the Anti Cheat...
Code:
if(aWeap[playerid] == 0)
    Ban(playerid)
And under OnPlayerConnect, reset it...
Code:
aWeap[playerid] = 0;



Re: Im making a Anti Weapon Hack System.... Quick Question - Scripter12345 - 03.04.2012

Quote:
Originally Posted by Catalyst-
View Post
First, create a variable...
Then, in the Anti Cheat...
Code:
if(aWeap[playerid] == 0)
    Ban(playerid)
[/code]
Where about does that bit go


Sorry im new to scripting


Re: Im making a Anti Weapon Hack System.... Quick Question - Catalyst- - 03.04.2012

Put it wherever you created your anti weapon hack code... or paste it here and I'll add it


Re: Im making a Anti Weapon Hack System.... Quick Question - Scripter12345 - 03.04.2012

Is this what you mean


Code:
public OnPlayerUpdate(playerid)
{
            new weaponid = GetPlayerWeapon(playerid);//This will cause the "weaponid not defined" Error
                new Nam[MAX_PLAYER_NAME];
                new str[128];
            if(weaponid == 24) // The weapon ID
            {
            GetPlayerName(playerid,Nam,sizeof(Nam));
            format(str,sizeof(str),"ANTI WEAPON HACK: %s has been banned from server for spawning a bad weapon!",Nam);
            SendClientMessageToAll(0xFF0000FF,str);
            Kick(playerid,"ANTI WEAPON HACK: Weapon Hack!");
            }
                        return 1;
}



Re: Im making a Anti Weapon Hack System.... Quick Question - Catalyst- - 03.04.2012

Code:
public OnPlayerUpdate(playerid)
{
            new weaponid = GetPlayerWeapon(playerid);//This will cause the "weaponid not defined" Error
            new Nam[MAX_PLAYER_NAME];
            new str[128];
            if(weaponid == 24 && aWeap[playerid] == 0) // The weapon ID
            {
            GetPlayerName(playerid,Nam,sizeof(Nam));
            format(str,sizeof(str),"ANTI WEAPON HACK: %s has been banned from server for spawning a bad weapon!",Nam);
            SendClientMessageToAll(0xFF0000FF,str);
            Kick(playerid,"ANTI WEAPON HACK: Weapon Hack!");
            }
            return 1;
}



Respuesta: Im making a Anti Weapon Hack System.... Quick Question - Marricio - 03.04.2012

You should work with server sided weapons, you can make yourself one, it's pretty easy. The script that catalyst provided wont work as it should.


Re: Respuesta: Im making a Anti Weapon Hack System.... Quick Question - Scripter12345 - 03.04.2012

Quote:
Originally Posted by Marricio
View Post
You should work with server sided weapons, you can make yourself one, it's pretty easy. The script that catalyst provided wont work as it should.
It is working well though


Respuesta: Im making a Anti Weapon Hack System.... Quick Question - Marricio - 03.04.2012

You need to replace every GivePlayerWeapon with GivePlayerWeaponEx

If you're using that recent Server Sided Weapons tutorial.