Remove Player Weapon
#1

I have trouble to make :

pawn Код:
stock RemovePlayerWeponAmmo(playerid,amount)
{
          new weaponslot = GetWeponSlot(GetPlayerWeapon(playerid));
          SetPlayerAmmo(playerid,weaponslot,GetPlayerAmmo(playerid) - amount);
}
When i try to use it all ammo gone.

For exemple :

pawn Код:
//before player ammo is 500
RemovePlayerWeponAmmo(playerid,15);
//after player ammo is 0
All ammo of player gone
Reply
#2

Just a tiny typo:

You wrote wepon instead of "Weapon"
Reply
#3

I don't know if this will work but
try storing the current ammo in a variable.
Then if the player is remove.
If you want to give it back again. Use the variable that you use to store the ammo.
Reply
#4

Thank you ,
@mailu : Yes is typo but not mistake is my 10 version of this command

@Romel:

pawn Код:
stock RPWAmmo(playerid,amount)
{        
          new weaponid = GetPlayerWeapon(playerid);
          new weaponslot = GetWeponSlot(weaponid);
          new ammo = GetPlayerAmmo(playerid);
          new ammoToBE = ammo - amount;
          SetPlayerAmmo(playerid,weaponslot, 0);
          SetPlayerAmmo(playerid,weaponslot, ammoToBE);
}
SAME


Is any other way to set ammo ?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)