SA-MP Forums Archive
Gun ammo - 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: Gun ammo (/showthread.php?tid=458874)



Gun ammo - RALL0 - 18.08.2013

Hey,this supposed to give a player 50 extra bullets but it isn't working somehow, not sure what I did wrong but any help is appreciated.
pawn Код:
new gunid = GetPlayerWeapon(playerid);
new ammo;
GetPlayerWeaponData(playerid, gunid, ammo);
SetPlayerAmmo(playerid, gunid, ammo+50);



Re: Gun ammo - Vanter - 18.08.2013

remove
Код:
 = GetPlayerWeapon(playerid);
and try, not sure if that's correct, but try

Because you're using gunid in two funtions.


Re: Gun ammo - RALL0 - 18.08.2013

I tried it but I'm getting the same results, also I want to add the 50 bullets to the weapon he is currently holding.


Re: Gun ammo - JimmyCh - 18.08.2013

pawn Код:
new ammo = GetPlayerAmmo(playerid);



Re: Gun ammo - Emmet_ - 19.08.2013

Lol, you're all wrong.

Just use:

pawn Код:
GivePlayerWeapon(playerid, GetPlayerWeapon(playerid), 50);



Re: Gun ammo - RALL0 - 19.08.2013

Quote:
Originally Posted by Emmet_
Посмотреть сообщение
Lol, you're all wrong.

Just use:

pawn Код:
GivePlayerWeapon(playerid, GetPlayerWeapon(playerid), 50);
Jimmy solved my problem, thank you for that. Emmet, you're the one thats wrong you just replace the players weapon with 50 bullets but what if the person had already a 100 bullets in his gun? Thats what I needed help for, thanks anyway.