SA-MP Forums Archive
Anti Weapon help pls plsssssssssssss - 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: Anti Weapon help pls plsssssssssssss (/showthread.php?tid=478072)



Anti Weapon help pls plsssssssssssss - br155 - 27.11.2013




PHP код:
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 == 29// 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);
            
BanEx(playerid,"ANTI WEAPON HACK: Weapon Hack!");
            }
                        return 
1;

i Installation ant cheat
There is a problem
When I boy gun the store kick player !!!!!!
What is the solution?


Re: Anti Weapon help pls plsssssssssssss - br155 - 27.11.2013

help


Re: Anti Weapon help pls plsssssssssssss - ikbenremco - 27.11.2013

Add a new variable.

PHP код:
new JustPurchasedWeapon[MAX_PLAYERS]; 
// on top of your script.

OnPlayerConnect:
PHP код:
JustPurchasedWeapon[playerid] = 0
When they bought a gun then :

PHP код:
JustPurchasedWeapon[playerid] = 1
then:

PHP код:
if(weaponid == 29 && JustPurchasedWeapon[playerid] == 0// If he didn't bought the gun then ban
            

            
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); 
            
BanEx(playerid,"ANTI WEAPON HACK: Weapon Hack!"); 
            } 
Rep++ please.


Re: Anti Weapon help pls plsssssssssssss - br155 - 27.11.2013

not work but rep


Re: Anti Weapon help pls plsssssssssssss - br155 - 27.11.2013

(((((


Re: Anti Weapon help pls plsssssssssssss - VenomXNL - 27.11.2013

I don't use the Ammunation because only law enforcers and home owners can own/get weapons,
and the players can buy them off the shelfs in the 24-7 by standing next to them and then pressing the N button.

I don't know if there is a function to detect if a player bought them in the Ammunation (I didn't thought so)
but to take more control over the weapon management on your server, I would recommend to make your
own Weaponstore/Menu where you can register the weapons and ammo.

I Don't register the most weapons and ammo because most are freely available from the home owners
houses, what I DID do though was to ban the Overkill weapons like the Minigun, RPG, Heatseaker, vehicles with
weapons on them (Hydra, Tank, Rustler etc). And just when a player starts to use those he gets kicked and
banned, and at the same time the vehicle gets destroyed

hope this helped you a little bit further again


Re: Anti Weapon help pls plsssssssssssss - cessil - 28.11.2013

your script will ban anyone that ever gets weaponid 29 which is the mp5
you can detect any weapon spawning with the link in my signature, go down to weapon checking