Anti Weapon Hack System Problem..... Please Help Me
#1

I recently put in a anti weapon hacking system in my script and its not working aswell has it should be it is still banning me when it should not be.....

I followed this tutorial


http://forum.sa-mp.com/showthread.ph...on+hack+system


When ever i choose a gun from my dialog it gives me it and when i mess around with it for a short amount of time it bans me this is my dialog code.


Code:
 if(dialogid == DIALOG_WEAPON)
    {
        if(response)
        {
            new message[256+1];
            if(listitem == 0)
            {
            format(message, 256, "You selected Dildo, And got a Dildo!", listitem);
            SendClientMessage(playerid, 0xFFFFFFFF, message);
            ServerWeapon(playerid, 12, 0);
            }
            if(listitem == 1)
            {
            format(message, 256, "You selected Baseball Bat, And got a Baseball Bat!", listitem);
            SendClientMessage(playerid, 0xFFFFFFFF, message);
            ServerWeapon(playerid, 5, 1);
            }
            if(listitem == 2)
            {
            format(message, 256, "You selected Deagle, And got a Deagle!", listitem);
            SendClientMessage(playerid, 0xFFFFFFFF, message);
            ServerWeapon(playerid, 24, 99999);
            }
		}
	}
And this is my anti weapon hack system


Code:
enum weapons
{
    Melee,
    Thrown,
    Pistols,
    Shotguns,
    SubMachine,
    Assault,
    Rifles,
    Heavy,
    Handheld,

}


new Weapons[MAX_PLAYERS][weapons];


public OnPlayerUpdate(playerid)
{
    CheckWeapons(playerid);
	return 1;
    }


CheckWeapons(playerid)
{
    new weaponid = GetPlayerWeapon(playerid);//This will cause the "weaponid not defined" Error

    if(weaponid >= 1 && weaponid <= 15)
    {
        if(weaponid == Weapons[playerid][Melee])
        {
        return 1;
        }
            else
            {
            SendClientMessage(playerid, 0xFF0000FF, "No Hacking!");
            Ban(playerid);
            }
    }

        if( weaponid >= 16 && weaponid <= 18 || weaponid == 39 ) // Checking Thrown
    {
        if(weaponid == Weapons[playerid][Thrown])
        {
        return 1;
        }
            else
            {
            SendClientMessage(playerid, 0xFF0000FF, "No Hacking!");
            Ban(playerid);
            }
    }
    if( weaponid >= 22 && weaponid <= 24 ) // Checking Pistols
    {
        if(weaponid == Weapons[playerid][Pistols])
        {
        return 1;
        }
            else
            {
            SendClientMessage(playerid, 0xFF0000FF, "No Hacking!");
            Ban(playerid);
            }
    }

    if( weaponid >= 25 && weaponid <= 27 ) // Checking Shotguns
    {
        if(weaponid == Weapons[playerid][Shotguns])
        {
        return 1;
        }
            else
            {
            SendClientMessage(playerid, 0xFF0000FF, "No Hacking!");
            Ban(playerid);
            }
    }
    if( weaponid == 28 || weaponid == 29 || weaponid == 32 ) // Checking Sub Machine Guns
    {
        if(weaponid == Weapons[playerid][SubMachine])
        {
        return 1;
        }
            else
            {
            SendClientMessage(playerid, 0xFF0000FF, "No Hacking!");
            Ban(playerid);
            }
    }

    if( weaponid == 30 || weaponid == 31 ) // Checking Assault
    {
        if(weaponid == Weapons[playerid][Assault])
        {
        return 1;
        }
            else
            {
            SendClientMessage(playerid, 0xFF0000FF, "No Hacking!");
            Ban(playerid);
            }
    }

    if( weaponid == 33 || weaponid == 34 ) // Checking Rifles
    {
        if(weaponid == Weapons[playerid][Rifles])
        {
        return 1;
        }
            else
            {
            SendClientMessage(playerid, 0xFF0000FF, "No Hacking!");
            Ban(playerid);
            }
    }
    if( weaponid >= 35 && weaponid <= 38 ) // Checking Heavy
    {
        if(weaponid == Weapons[playerid][Heavy])
        {
        return 1;
        }
            else
            {
            SendClientMessage(playerid, 0xFF0000FF, "No Hacking!");
            Ban(playerid);
            }
    }
    else { return 1; }

return 1;
}


ServerWeapon(playerid, weaponid, ammo)
{
if(weaponid >= 1 && weaponid <= 15)
    {
    Weapons[playerid][Melee] = weaponid;
    GivePlayerWeapon(playerid, weaponid, ammo);
    return 1;
    }

        if( weaponid >= 16 && weaponid <= 18 || weaponid == 39 ) // Checking Thrown
    {
    Weapons[playerid][Thrown] = weaponid;
    GivePlayerWeapon(playerid, weaponid, ammo);
    return 1;
    }
    if( weaponid >= 22 && weaponid <= 24 ) // Checking Pistols
    {
    Weapons[playerid][Pistols] = weaponid;
    GivePlayerWeapon(playerid, weaponid, ammo);
    return 1;
    }

    if( weaponid >= 25 && weaponid <= 27 ) // Checking Shotguns
    {
    Weapons[playerid][Shotguns] = weaponid;
    GivePlayerWeapon(playerid, weaponid, ammo);
    return 1;
    }
    if( weaponid == 28 || weaponid == 29 || weaponid == 32 ) // Checking Sub Machine Guns
    {
    Weapons[playerid][SubMachine] = weaponid;
    GivePlayerWeapon(playerid, weaponid, ammo);
    return 1;
    }

    if( weaponid == 30 || weaponid == 31 ) // Checking Assault
    {
    Weapons[playerid][Assault] = weaponid;
    GivePlayerWeapon(playerid, weaponid, ammo);
    return 1;
    }

    if( weaponid == 33 || weaponid == 34 ) // Checking Rifles
    {
    Weapons[playerid][Rifles] = weaponid;
    GivePlayerWeapon(playerid, weaponid, ammo);
    return 1;
    }
    if( weaponid >= 35 && weaponid <= 38 ) // Checking Heavy
    {
    Weapons[playerid][Heavy] = weaponid;
    GivePlayerWeapon(playerid, weaponid, ammo);
    return 1;
    }
return 1;
}
Please Help Me
Reply
#2

Does it compile fine?
Reply
#3

Quote:
Originally Posted by Jack.7331
View Post
Does it compile fine?
Compiles fine but with quite a few warnings..... But it all still works




Please Help Me
Reply
#4

Please help is there any other good anti weapon hack tutorials ?
Reply
#5

Try this one maybe will work fine. It's pretty much the same as your current one but with less code.
Reply
#6

Quote:
Originally Posted by SpiritEvil
View Post
Try this one maybe will work fine. It's pretty much the same as your current one but with less code.

Thank you i have just asked will i still get banned if i use a admin command to spawn a gun


Do you think i will ?


Please Help
Reply
#7

Well, if you use the function given in the tutorial (GivePlayerWeaponEx) instead of the original GivePlayerWeapon it shouldn't ban you, but since I've never tried this I can't promise you anything. But anyway it's worth giving it a try, you have nothing to lose :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)