[FilterScript] Anti-Weapon Cheat
#1

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!
Reply
#2

KkkK Not bad
Reply
#3

Nice! Keep it up!
Reply
#4

Nice
Reply
#5

Nice gg Man
Reply
#6

Nice job, thank you for releasing it!
Reply
#7

how long is the ban ?
Reply
#8

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);
        }
    }
}
Reply
#9

Nice Work!
Reply
#10

Nice i like it!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)