[FilterScript] Anti-Weapon Cheat - 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: Filterscripts (
https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] Anti-Weapon Cheat (
/showthread.php?tid=474470)
Anti-Weapon Cheat -
Meow22 - 08.11.2013
Hello
Well I made a Anti-Weapon Cheat
Ok Well this 1 Dosen't allow to hack any weapon
Code:
//Made By Meow22
#include <a_samp>
#define FILTERSCRIPT
#if defined FILTERSCRIPT
#define COLOR_GREEN 0x00FF00
new banning[MAX_PLAYERS];
forward banningtimer();//timer for when getting banned
forward weaponanti();//checks if a player has an illegal weapon
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Anti-Weapon Cheat By Meow22");
print("--------------------------------------\n");
SetTimer("weaponanti",5000,1);
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#endif
public banningtimer()
{
for (new i = 0; i < MAX_PLAYERS; i++)
{
if(banning[i] == 1)
{
Ban(i);
}
}
}
public weaponanti()
{
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (GetPlayerWeapon(i) == 1 || GetPlayerWeapon(i) == 2 || GetPlayerWeapon(i) == 3)
if (GetPlayerWeapon(i) == 4 || GetPlayerWeapon(i) == 5 || GetPlayerWeapon(i) == 6)
if (GetPlayerWeapon(i) == 7 || GetPlayerWeapon(i) == 8 || GetPlayerWeapon(i) == 9)
if (GetPlayerWeapon(i) == 10 || GetPlayerWeapon(i) == 11 || GetPlayerWeapon(i) == 12)
if (GetPlayerWeapon(i) == 13 || GetPlayerWeapon(i) == 14 || GetPlayerWeapon(i) == 15)
if (GetPlayerWeapon(i) == 16 || GetPlayerWeapon(i) == 17 || GetPlayerWeapon(i) == 18)
if (GetPlayerWeapon(i) == 22 || GetPlayerWeapon(i) == 23 || GetPlayerWeapon(i) == 24)
if (GetPlayerWeapon(i) == 25 || GetPlayerWeapon(i) == 26 || GetPlayerWeapon(i) == 27)
if (GetPlayerWeapon(i) == 28 || GetPlayerWeapon(i) == 29 || GetPlayerWeapon(i) == 30)
if (GetPlayerWeapon(i) == 31 || GetPlayerWeapon(i) == 32 || GetPlayerWeapon(i) == 33)
if (GetPlayerWeapon(i) == 34 || GetPlayerWeapon(i) == 35 || GetPlayerWeapon(i) == 36)
if (GetPlayerWeapon(i) == 37 || GetPlayerWeapon(i) == 38 || GetPlayerWeapon(i) == 39)
if (GetPlayerWeapon(i) == 40 || GetPlayerWeapon(i) == 41 || GetPlayerWeapon(i) == 42)
if (GetPlayerWeapon(i) == 43 || GetPlayerWeapon(i) == 44 || GetPlayerWeapon(i) == 45)
if (GetPlayerWeapon(i) == 46)
{
new pname[200];
new string[200];
GetPlayerName(i, pname, sizeof(pname));
format(string, sizeof(string), "[ANTI-CHEAT] %s Banned for Weapon Hack", pname);
SendClientMessageToAll(COLOR_GREEN,string);
SetTimer("banningtimer",2000,0);
banning[i] =1;
}
}
}
In this 1
Banned Weapons are:
*Chainsaw id 9
*Grenade id 16
*Tear Gas id 17
*Molotov Cocktail id 18
*RPG id 35
*HS Rocket id 36
*Flame Thrower id 37
*Minigun id 38
*Satchel Charge id 39
*Detonator id 40
*Fire Extinguisher id 42
*Spray Can id 41
Code:
//Made By Meow22
#include <a_samp>
#define FILTERSCRIPT
#if defined FILTERSCRIPT
#define COLOR_GREEN 0x00FF00
new banning[MAX_PLAYERS];
forward banningtimer();//timer for when getting banned
forward weaponanti();//checks if a player has an illegal weapon
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Anti-Weapon Cheat By Meow22");
print("--------------------------------------\n");
SetTimer("weaponanti",5000,1);
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#endif
public banningtimer()
{
for (new i = 0; i < MAX_PLAYERS; i++)
{
if(banning[i] == 1)
{
Ban(i);
}
}
}
public weaponanti()
{
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (GetPlayerWeapon(i) == 16 || GetPlayerWeapon(i) == 17 || GetPlayerWeapon(i) == 18)
if (GetPlayerWeapon(i) == 35 || GetPlayerWeapon(i) == 36) || GetPlayerWeapon(i) == 9)
if (GetPlayerWeapon(i) == 37 || GetPlayerWeapon(i) == 38 || GetPlayerWeapon(i) == 39)
if (GetPlayerWeapon(i) == 40 || GetPlayerWeapon(i) == 41 || GetPlayerWeapon(i) == 42)
{
new pname[200];
new string[200];
GetPlayerName(i, pname, sizeof(pname));
format(string, sizeof(string), "[ANTI-CHEAT] %s Banned for Weapon Hack", pname);
SendClientMessageToAll(COLOR_GREEN,string);
SetTimer("banningtimer",2000,0);
banning[i] =1;
}
}
}
Pastebin Download!
and add Weapon to make player ban when he spawn it
Example:
pawn Code:
|| GetPlayerWeapon(i) == 42)
pawn Code:
|| GetPlayerWeapon(i) == 43) < === Just change the id and weapon will be changed
If u want to Remove Weapon:
pawn Code:
|| GetPlayerWeapon(i) == 42) < ===== Remove this whole thing
Hope You Enjoy it!
Re: Anti-Weapon Cheat -
MohanedZzZ - 08.11.2013
KkkK Not bad
Re: Anti-Weapon Cheat -
SRB - 15.11.2013
Nice! Keep it up!
Re: Anti-Weapon Cheat -
Evocator - 16.11.2013
Nice
Re : Anti-Weapon Cheat -
samp_boy - 16.11.2013
Nice gg Man
Re: Anti-Weapon Cheat -
Cuhz - 16.11.2013
Nice job, thank you for releasing it!
Re: Anti-Weapon Cheat -
d0nTtoucH - 18.11.2013
how long is the ban ?
Re: Anti-Weapon Cheat -
Loot - 18.11.2013
There are A LOT of improvements to do... You could achieve the same result with just ONE check.
https://sampwiki.blast.hk/wiki/GetPlayerWeapon.
You have a lot more to learn; but you are in the right track.
Consider the following issues:
1) Why do you need
two timers if you can do the same with one?
2) Why is the
banning variable needed in this case? (referring to #1)
3) So many
unnecessary CHECKS... What a waste of resources... GetPlayerWeapon(playerid) returns true if the player posses ANY weapon.. and returns false if not.
4) Why do you need pname to have
200 chars when the MAXIMUM for player name is only
24 chars? (MAX_PLAYER_NAME)
5) Let's agree that you don't really need
200 chars for that string, do you? You need exactly
50 chars to show the full message..
pawn Code:
//Made By Meow22
#include <a_samp>
#define FILTERSCRIPT
#if defined FILTERSCRIPT
#define COLOR_GREEN 0x00FF00
forward weaponanti();//checks if a player has an illegal weapon
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Anti-Weapon Cheat By Meow22");
print("--------------------------------------\n");
SetTimer("weaponanti", 5000, true);
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#endif
public weaponanti()
{
new pname[MAX_PLAYER_NAME], string[200];
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (GetPlayerWeapon(i)) // is player posses a ANY weapon? - the loop ignores the following code if does not (returns false)
{
GetPlayerName(i, pname, sizeof(pname));
format(string, sizeof(string), "[ANTI-CHEAT] %s Banned for Weapon Hack", pname);
SendClientMessageToAll(COLOR_GREEN, string);
}
}
}
Re: Anti-Weapon Cheat -
KingServerIRAN - 19.11.2013
Nice Work!
Re: Anti-Weapon Cheat -
Voxel - 19.11.2013
Nice i like it!