Remove Player Weapon - 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)
+--- Thread: Remove Player Weapon (
/showthread.php?tid=405220)
Remove Player Weapon -
Azazelo - 05.01.2013
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
Re: Remove Player Weapon -
mailu - 05.01.2013
Just a tiny typo:
You wrote wepon instead of "Weapon"
Re: Remove Player Weapon -
JaKe Elite - 05.01.2013
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.
Re: Remove Player Weapon -
Azazelo - 05.01.2013
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 ?