Remove Player Weapon
#1

What's the function to remove the weapon they're holding.
Reply
#2

You can't remove a single weapon. What you'll need to do is find out all of the player's current weapons using GetPlayerWeaponData add the weapons he has into an array.

Then use GetPlayerWeapon to compare the list of weapons in the array you just created.. Remove that specific weapon, then loop through the array and GivePlayerWeapon all of the weapons in the array..
Reply
#3

You can remove all the weapons from a player with:
pawn Код:
ResetPlayerWeapons(playerid);
Reply
#4

Why are you guys complicating stuff so much...

Put this code somewhere on top
Код:
stock RemovePlayerWeapon(playerid, weaponid)
{
    SetPlayerArmedWeapon(playerid, weaponid);
    if (GetPlayerWeapon(playerid) != 0) GivePlayerWeapon(playerid, -(GetPlayerAmmo(playerid)));

    return 1;
}
Use
RemovePlayerWeapon(playerid, weaponid);

Rep if it helped ^^
Reply
#5

Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)