02.04.2012, 19:38
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.
And this is my anti weapon hack system
Please Help Me
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);
}
}
}
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;
}


