How to remove only the gun that a player is holding?
#1

Hello, How i can easy remove the weapon that a player is holding?
Reply
#2

All of their weapons?

pawn Код:
ResetPlayerWeapons( playerid );
Reply
#3

If you just want to remove a weapon that a player is currently holding use this:

pawn Код:
stock RemovePlayerWeapon(playerid, weaponid)
{
  new plyWeapons[12];
  new plyAmmo[12];
  for(new slot = 0; slot != 12; slot++)
  {
    new wep, ammo;
    GetPlayerWeaponData(playerid, slot, wep, ammo);
    if(wep != weaponid)
    {
      GetPlayerWeaponData(playerid, slot, plyWeapons[slot], plyAmmo[slot]);
    }
  }
  ResetPlayerWeapons(playerid);
  for(new slot = 0; slot != 12; slot++)
  {
    GivePlayerWeapon(playerid, plyWeapons[slot], plyAmmo[slot]);
  }
}
Hope it helped.
Reply
#4

Thanks Zero, It helped
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)