SA-MP Forums Archive
Server-Sided Non-Gun Weapon 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: Server-Sided Non-Gun Weapon Ammo (/showthread.php?tid=629394)



Server-Sided Non-Gun Weapon Ammo - Aerotactics - 25.02.2017

Are there any functions like OnPlayerWeaponShot, but for the rest of the weapons that don't shoot? Grenades, teargas, extinguisher, etc.

I have a player timer, but it doesn't loop fast enough. So if a player uses their last grenade, sometimes it's not recognized that they have 0 ammo.

I've also considered using OnPlayerKeyStateChange and seeing if they are pressing KEY_FIRE, but that seems like it wouldn't be 100% accurate.


Re: Server-Sided Non-Gun Weapon Ammo - Unte99 - 25.02.2017

Try OnPlayerKeyStateChange+GetPlayerAnimationIndex. Maybe it will work. But probably the animation won't start soon enough for OnPlayerKeyStateChange to read it.


Re: Server-Sided Non-Gun Weapon Ammo - Aerotactics - 25.02.2017

Quote:
Originally Posted by Unte99
Посмотреть сообщение
Try OnPlayerKeyStateChange+GetPlayerAnimationIndex. Maybe it will work. But probably the animation won't start soon enough for OnPlayerKeyStateChange to read it.
Yeah, Using OnPlayerKeyStateChange is actually more reliable than I thought it would be.


Re: Server-Sided Non-Gun Weapon Ammo - Unte99 - 25.02.2017

Quote:
Originally Posted by Aerotactics
Посмотреть сообщение
Yeah, Using OnPlayerKeyStateChange is actually more reliable than I thought it would be.
So how are you doing it?