[CS] Forward to detect whenever BP Ammo changes?
Hi all,
I'm looking for a forward that could be used to efficiently detect whenever a player's backpack ammo amount changes. I want to avoid using register_event/message for the "AmmoX" message, because an engine-generated message has to be sent during such forward's execution (doing that can currently crash the server or result in some awful recursion bugs). I know I can always get around those by using a 0.1 sec task, but I'm looking for a more "clean" and efficient method... Thanks in advance, |
Re: [CS] Forward to detect whenever BP Ammo changes?
Quote:
PHP Code:
|
Re: [CS] Forward to detect whenever BP Ammo changes?
UpdateClientData (pre hooked) and check for each bpammo slot if m_rgAmmo[SLOT] != m_rgAmmoLast[SLOT]
376 -> 407 - m_rgAmmo[MAX_AMMO_SLOTS] 408 -> 439 - m_rgAmmoLast[MAX_AMMO_SLOTS] PHP Code:
You could filter with active item to be more efficient. You can still use the registered event instead of message AmmoX that will no crash and be less consuming ;), this way you won't be able to block the actual message from being sent but that better than a 0.1 task IMO. |
| All times are GMT -4. The time now is 08:53. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.