SA-MP Forums Archive
When weapon have 0 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: When weapon have 0 ammo (/showthread.php?tid=618081)



When weapon have 0 ammo - MerryDeer - 30.09.2016

Hi,

How always know when weapon reach 0 ammo? i need to write into variable that weapon have 0 ammo.


Re: When weapon have 0 ammo - Quinncell - 30.09.2016

I don't understand you quite well.But still, why do you wan't to know if a weapon reached 0 ammo?Whats the purpose?


Re: When weapon have 0 ammo - MerryDeer - 30.09.2016

To set variable to 0...


Re: When weapon have 0 ammo - SickAttack - 30.09.2016

Use the callback OnPlayerWeaponShot.


Re: When weapon have 0 ammo - MerryDeer - 01.10.2016

Yes, but not all weapons like spraycan, grenade call that.


Re: When weapon have 0 ammo - SickAttack - 01.10.2016

Then detect when a player presses LEFT CLICK. Set a timer and when they release it, get the ammo and kill the timer a while after.


Re: When weapon have 0 ammo - MerryDeer - 01.10.2016

But i just need when reach 0, i update when ammo is smaller, in onplayerupdate, but weapon where ammo fast changes, now always onplayerupdate, can write to variable 0


Re: When weapon have 0 ammo - SickAttack - 01.10.2016

You can still achive that, with that method.


Re: When weapon have 0 ammo - MerryDeer - 01.10.2016

But if weapon change, and player not release key?


Re: When weapon have 0 ammo - Rdx - 01.10.2016

GetPlayerWeaponData or GetPlayerAmmo.