Need Small help Rep +
#1

Hello I need help with Anti Weapon hack
I'm using this Anti cheat , it working fine but it give problem some time

Link of Anti cheat
https://sampforum.blast.hk/showthread.php?tid=534376

when i try to give all weapons or spawnall players or disarmall
some times it ban players

how i can fix that
here is anti cheat code
Code:
stock ResetWeapons(playerid)
{

	SetPVarInt(playerid, "Brass Knuckles", 0);
	SetPVarInt(playerid, "Golf Club", 0);
	SetPVarInt(playerid, "Nite Stick", 0);
	SetPVarInt(playerid, "Knife", 0);
	SetPVarInt(playerid, "Baseball Bat", 0);
	SetPVarInt(playerid, "Shovel", 0);
	SetPVarInt(playerid, "Pool Cue", 0);
	SetPVarInt(playerid, "Katana", 0);
	SetPVarInt(playerid, "Chainsaw", 0);
	SetPVarInt(playerid, "Heat Seaker", 0);
	SetPVarInt(playerid, "Dildo", 0);
	SetPVarInt(playerid, "Vibrator", 0);
	SetPVarInt(playerid, "Flowers", 0);
	SetPVarInt(playerid, "Cane", 0);
	SetPVarInt(playerid, "Teargas", 0);
	SetPVarInt(playerid, "Bomb", 0);
	SetPVarInt(playerid, "HS Rocket", 0);
	SetPVarInt(playerid, "Flamethrower", 0);
	SetPVarInt(playerid, "Satchel Explosives", 0);
	SetPVarInt(playerid, "Spray Can", 0);
	SetPVarInt(playerid, "Fire Extinguisher", 0);
	SetPVarInt(playerid, "Camera", 0);
	SetPVarInt(playerid, "Night Vis Goggles", 0);
	SetPVarInt(playerid, "Thermal Goggles", 0);
 	SetPVarInt(playerid, "Grenade", 0);
	SetPVarInt(playerid, "Molotov Cocktail", 0);
	SetPVarInt(playerid, "Colt 45", 0);
	SetPVarInt(playerid, "Silenced Pistol", 0);
	SetPVarInt(playerid, "Desert Eagle", 0);
	SetPVarInt(playerid, "Shotgun", 0);
	SetPVarInt(playerid, "Sawn-off Shotgun", 0);
	SetPVarInt(playerid, "Combat Shotgun", 0);
	SetPVarInt(playerid, "UZI", 0);
	SetPVarInt(playerid, "MP5", 0);
	SetPVarInt(playerid, "AK47", 0);
	SetPVarInt(playerid, "M4", 0);
	SetPVarInt(playerid, "Tec9", 0);
	SetPVarInt(playerid, "Rifle", 0);
	SetPVarInt(playerid, "Sniper Rifle", 0);
 	SetPVarInt(playerid, "Rocket Launcher", 0);
  	SetPVarInt(playerid, "Minigun", 0);
	ResetPlayerWeapons(playerid);
}

public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    new weapname[32];
    GetWeaponName(weaponid, weapname, sizeof(weapname));
    if(GetPVarInt(playerid, weapname) < 1) return SCM(playerid, -1, "Hack detected");
    SetPVarInt(playerid, weapname, GetPVarInt(playerid, weapname) -1);
    return 1;
}
stock GivePlayerServerWeapon(playerid, weapid, ammo)
{
	new gunname[32];
	GivePlayerWeapon(playerid, weapid, ammo);
	GetWeaponName(weapid, gunname, sizeof(gunname));
	SetPVarInt(playerid, gunname, GetPVarInt(playerid, gunname) +ammo);
}
here is my code
Code:
CMD:giveallweapon(playerid,params[])
{
    if(pInfo[playerid][pLevel] >= 3)
	{
        new weap[32], ammo, wname[50],weapid;
	    if(sscanf(params, "s[32]i", weap,ammo)) return SendClientMessage(playerid, yellow, "Usage: /Giveallweapon <Weapon ID> <Ammo>");
	    if(IsNumeric(weap)) weapid = strval(weap);
	    else weapid = GetWeaponID(weap);
	    if(weapid < 1 || weapid > 46) return SendClientMessage(playerid, red, "Invalid weapon ID/Name!");
		GetWeaponName(weapid, wname, sizeof(wname));
		if(IllegalWeaps(weapid) == 1)
		{
			format(Jstring, sizeof(Jstring), "Error: %s(%d) is in Illegal weapon list",wname,weapid);
		    return SendClientMessage(playerid, red, Jstring);
	    }
	    CommandToAdmins(playerid,"giveallweapon");
		foreach(Player, i)
		{
           GivePlayerServerWeapon(i, weapid, ammo);
	    }
		format(Jstring, sizeof(Jstring), "%s has given you a '%s with '%d' ammo'",GetName(playerid),wname,ammo);
		SendClientMessageToAll(lighterblue,Jstring);
		return 1;
	}
	else return ShowMessage(playerid, red, 1);
}

CMD:disarm(playerid,params[])
{
	  if(pInfo[playerid][pLevel] >= 1)
      {
           new id;
           if(sscanf(params, "u", id)) return SendClientMessage(playerid, yellow, "Usage: /disarm <Player ID>");
           if(!IsPlayerConnected(id)) return ShowMessage(playerid, red, 2);
           CommandToAdmins(playerid,"disarm");
           format(Jstring,sizeof(Jstring),"You have disarmed '%s'",GetName(id));
		   SendClientMessage(playerid,yellow,Jstring);
		   format(Jstring,sizeof(Jstring),"Admin '%s' has disarmed you'",GetName(playerid));
		   SendClientMessage(id,yellow,Jstring);
		   ResetWeapons(id);
		   return 1;
      }
      else return ShowMessage(playerid, red, 1);
}
CMD:disarmall(playerid,params[])
{
	  if(pInfo[playerid][pLevel] >= 4)
      {
           CommandToAdmins(playerid,"disarmall");
           format(Jstring,sizeof(Jstring),"Admin '%s' has disarmed all players",GetName(playerid));
		   SendClientMessageToAll(yellow,Jstring);
		   foreach(Player, i)
		   {
   		         ResetWeapons(i);
		   }
		   return 1;
      }
      else return ShowMessage(playerid, red, 1);
}
what is the Problem ?Plz Help thanks !
Reply


Messages In This Thread
Need Small help Rep + - by MBilal - 18.02.2015, 18:21
Re: Need Small help Rep + - by Vince - 18.02.2015, 19:55

Forum Jump:


Users browsing this thread: 1 Guest(s)