I'm back after some testing. There's definitely some kind of glitch with message/event handling in AMXX. It only happens on specific cases though, only with engine-generated messages and
emessages.
A. Engine-generated messages
Sent by the game as a result of executing some code, e.g.:
Code:
give_item(id, "weapon_awp")
In this case the engine will automatically send a "WeaponPickup" message.
Code:
engclient_cmd(id, "weapon_knife")
Here, an SVC_WEAPONANIM message is sent when the user has cl_lw set to 0.
B. Emessages
Emessages are pretty much like normal messages, but they are also sent to all other plugins and Metamod plugins.
Code:
emessage_begin(MSG_ONE, get_user_msgid("NVGToggle"), _, id)
ewrite_byte(1)
emessage_end()
Bug #1
These messages can't be sent during the callback (forward) of a message hooked with
register_message. They will cause either:
- A server crash ("Msg XX has not been sent yet", "Msg: X bytes written, expected Y")
- A corrupted message ("SVC_BAD", "Illegible Server Message", etc.)
Bug #2
When one of these messages is sent during the callback (forward) of a message hooked with
register_event, the message that's sent must have been previously hooked with
register_event() too. Failure to do so will cause the callback of the hooked message to either:
- Get called more than once
- Get called infinite times, before a "Run time error 3: stack error" shows up
I hope this post helps shed some light on the topic. Sounds like some kind of recursion problem to me.
Here's the detailed test logs for those interested
[IMG]http://img8.**************/img8/4708/testsso9.th.jpg[/IMG]
__________________