SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Tutorials

Reply
 
Thread Tools Display Modes
Old 03/12/2011, 01:45 AM   #1
Tanush123
High-roller
 
Tanush123's Avatar
 
Join Date: Aug 2011
Posts: 1,022
Reputation: 65
Default How to make a simple anti weapon detector

How to make a simple anti weapon detector

Hello everyone, i will teach you in this tutorial how to make a simple anti weapon hack. You don't need any timers or anything, in this tutorial i will only use
pawn Code:
public OnPlayerUpdate(playerid)
and 3 defined items
pawn Code:
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
pawn 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 == 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;
}
This code above will ban people that spawns a gernade and i will tell why. On the line
pawn Code:
if(weaponid == 16) // The weapon ID
The number i add "16" is the weapon id of Gernade, check http://weedarr.wikidot.com/gunlist.
So if you wondering how to add another weapon just do this

pawn 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 == 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
pawn Code:
if(weaponid == WEAPONID) // The weapon ID
just replace the "WEAPON ID" to the weapon id you want to keep that is bad. The links are below for weapon list if you need help

Weapon ID'S: http://weedarr.wikidot.com/gunlist

Thank you for reading, if you have any other question just ask below.

Last edited by Tanush123; 26/06/2013 at 03:29 PM.
Tanush123 is offline   Reply With Quote
Old 03/12/2011, 01:46 AM   #2
PjFord
Big Clucker
 
PjFord's Avatar
 
Join Date: Nov 2011
Location: On Earth
Posts: 60
Reputation: 7
Default Re: How to make a simple anti weapon hack

Nice job Tan
PjFord is offline   Reply With Quote
Old 03/12/2011, 01:51 AM   #3
Tanush123
High-roller
 
Tanush123's Avatar
 
Join Date: Aug 2011
Posts: 1,022
Reputation: 65
Default Re: How to make a simple anti weapon hack

Ty pj ford
Tanush123 is offline   Reply With Quote
Old 03/12/2011, 07:08 AM   #4
Bosnian
Big Clucker
 
Join Date: Nov 2011
Posts: 84
Reputation: 3
Default AW: How to make a simple anti weapon hack

o.o
I dont get it... You just add from the one cod e to the other 10 fucking new things
Bosnian is offline   Reply With Quote
Old 03/12/2011, 02:03 PM   #5
ZzzzZ
Little Clucker
 
Join Date: Oct 2011
Location: Hungary
Posts: 15
Reputation: 0
Default Re: How to make a simple anti weapon hack

Very good tutorial
ZzzzZ is offline   Reply With Quote
Old 03/12/2011, 02:06 PM   #6
Tanush123
High-roller
 
Tanush123's Avatar
 
Join Date: Aug 2011
Posts: 1,022
Reputation: 65
Default Re: AW: How to make a simple anti weapon hack

Quote:
Originally Posted by Bosnian View Post
o.o
I dont get it... You just add from the one cod e to the other 10 fucking new things
Lol what do you exactly mean?


Quote:
Originally Posted by ZzzzZ View Post
Very good tutorial
Thank you
Tanush123 is offline   Reply With Quote
Old 03/12/2011, 03:06 PM   #7
Wesley221
High-roller
 
Wesley221's Avatar
 
Join Date: Apr 2011
Posts: 2,729
Reputation: 714
Default Re: How to make a simple anti weapon hack

There is an easier way of checking for different weapons instead of copy pasting it like 5 times
Ex:
pawn 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 == 16 || weaponid == WEAPONID || weaponid == WEAPONID2 /* etc etc */)  // 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;
}
__________________
yes
Wesley221 is offline   Reply With Quote
Old 03/12/2011, 03:32 PM   #8
SmiT
Huge Clucker
 
Join Date: Oct 2011
Posts: 352
Reputation: 63
Default Re: How to make a simple anti weapon hack

http://forum.sa-mp.com/showthread.php?t=65567
SmiT is offline   Reply With Quote
Old 03/12/2011, 06:55 PM   #9
Tanush123
High-roller
 
Tanush123's Avatar
 
Join Date: Aug 2011
Posts: 1,022
Reputation: 65
Default Re: How to make a simple anti weapon hack

Quote:
Originally Posted by Wesley221 View Post
There is an easier way of checking for different weapons instead of copy pasting it like 5 times
Ex:
pawn 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 == 16 || weaponid == WEAPONID || weaponid == WEAPONID2 /* etc etc */)  // 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;
}
Oh my bad wesley, i forgot about that.
Tanush123 is offline   Reply With Quote
Old 04/12/2011, 02:21 AM   #10
Rob_Maate
Huge Clucker
 
Rob_Maate's Avatar
 
Join Date: Aug 2011
Posts: 457
Reputation: 46
Default Re: How to make a simple anti weapon hack

This isn't an anti-weaponhack...
This just bans a player if he has a certain weapon.
What if I decide to hack a desert eagle? hows your script gonna detect that?
Rob_Maate is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Anti weapon hack. moadi Scripting Help 3 04/11/2011 12:14 AM
[Include] [INC] Anti-Weapon Hack V1ceC1ty Includes 15 23/08/2011 08:31 AM
Anti Weapon hack aqu Help Archive 2 06/03/2011 08:48 AM
Anti weapon hack Perker12345 Help Archive 0 14/02/2010 03:36 PM
Anti weapon hack help Perker12345 Help Archive 2 02/02/2010 08:30 AM


All times are GMT. The time now is 09:37 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.