SA-MP Forums Archive
[Tutorial] Howto make anti weapon finder/detector - 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: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] Howto make anti weapon finder/detector (/showthread.php?tid=548487)



Howto make anti weapon finder/detector - Trollerz - 30.11.2014

Hello guyz today im here to teach you how to make an simple weapon detecter
Код:
public OnPlayerUpdate(playerid)
and 3 defined items
Код:
new weaponid = GetPlayerWeapon(playerid);
                        new Nam[MAX_PLAYER_NAME];
                        new str[128];
Ok everyone under OnPlayerUpdate if you want to add a bad list weapon just add this
Код:
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 == 16) // 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;
}
so the code above will just ban the player, cause you may have some specified weapons in your server like ur server has sawnoff only,,,so people may dont like sawn off they may like gernade so they will get ban if they spawn something like that
Код:
if(weaponid == 16) // The weapon ID
//The number i add 16 is for gernade :p you can make plenty of lines and you can change the number if you want to so that people cant get the weapon reach them,,,if it reached them the player is banned >:D


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 == 16) // 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);// Sends message to everyone
            BanEx(playerid,"ANTI WEAPON HACK: Weapon Hack!");
            }
//make another line
            if(weaponid == WEAPONID) // 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);// Sends message to everyone
            BanEx(playerid,"ANTI WEAPON HACK: Weapon Hack!");
            }
                        return 1;
}
on
Код:
if(weaponid == WEAPONID)
Dont get confused when you watched the weapon id just replace it with weapon id...!


Re: Howto make anti weapon finder/detector - Glossy42O - 30.11.2014

Well you didn't explain nothing..

Edit it.


Re: Howto make anti weapon finder/detector - n0minal - 30.11.2014

Quote:
Originally Posted by Trollerz
Посмотреть сообщение
Hello guyz today im here to teach you how to make an simple weapon detecter
Код:
public OnPlayerUpdate(playerid)
and 3 defined items
Код:
new weaponid = GetPlayerWeapon(playerid);
                        new Nam[MAX_PLAYER_NAME];
                        new str[128];
Ok everyone under OnPlayerUpdate if you want to add a bad list weapon just add this
Код:
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 == 16) // 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;
}
so the code above will just ban the player, cause you may have some specified weapons in your server like ur server has sawnoff only,,,so people may dont like sawn off they may like gernade so they will get ban if they spawn something like that
Код:
if(weaponid == 16) // The weapon ID
//The number i add 16 is for gernade :p you can make plenty of lines and you can change the number if you want to so that people cant get the weapon reach them,,,if it reached them the player is banned >:D


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 == 16) // 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);// Sends message to everyone
            BanEx(playerid,"ANTI WEAPON HACK: Weapon Hack!");
            }
//make another line
            if(weaponid == WEAPONID) // 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);// Sends message to everyone
            BanEx(playerid,"ANTI WEAPON HACK: Weapon Hack!");
            }
                        return 1;
}
on
Код:
if(weaponid == WEAPONID)
Dont get confused when you watched the weapon id just replace it with weapon id...!
Its not really an anti-cheat, an really anti-cheater needs to be based on a lot of different situations, needs hooks and a lot of more verifications, for example, if server gives weapon 16, he will be banned unfairly... If server uses shopname system for buying weapons will happen the same... You need to think in some more situations that can occurs on server before doing/releasing/teaching this...


Re: Howto make anti weapon finder/detector - sammp - 30.11.2014

Shouldn't be using OnPlayerUpdate for hack detection!!!

This forum requires that you wait 120 seconds between posts. Please try again in 63 seconds.
This forum requires that you wait 120 seconds between posts. Please try again in 63 seconds.
This forum requires that you wait 120 seconds between posts. Please try again in 63 seconds.
This forum requires that you wait 120 seconds between posts. Please try again in 63 seconds.
This forum requires that you wait 120 seconds between posts. Please try again in 63 seconds.
This forum requires that you wait 120 seconds between posts. Please try again in 63 seconds.
This forum requires that you wait 120 seconds between posts. Please try again in 63 seconds.
This forum requires that you wait 120 seconds between posts. Please try again in 63 seconds.