SA-MP Forums Archive
How to remove only the gun that a player is holding? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to remove only the gun that a player is holding? (/showthread.php?tid=128346)



How to remove only the gun that a player is holding? - RSC_Quicker - 17.02.2010

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


Re: How to remove only the gun that a player is holding? - Phyc0_ - 17.02.2010

All of their weapons?

pawn Код:
ResetPlayerWeapons( playerid );



Re: How to remove only the gun that a player is holding? - Zeromanster - 17.02.2010

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.


Re: How to remove only the gun that a player is holding? - RSC_Quicker - 17.02.2010

Thanks Zero, It helped