AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved Message ID return 0 (https://forums.alliedmods.net/showthread.php?t=329644)

ConorCC 01-02-2021 04:35

Message ID return 0
 
The main question is "How can we get a message's ID in plugin_precache?"

After the first initialization
Code:

get_user_msgid("WeaponList")
returns 0 in plugin_precache.

This message should be caught in plugin_precache because it will be send before the plugin_init. So if you want to log the arguments of this one you should do it in the here.

It's all right but whenever I start or restart the server this message ID will be returned as 0, after the first changelevel everything is fine, I got the expected message ID (78).

After I coding for myself I will store this ID staticly in my pugins but if someone has any useful idea we can check this out.

OciXCrom 01-02-2021 07:35

Re: Message ID return 0
 
https://forums.alliedmods.net/showthread.php?p=2607132

https://www.amxmodx.org/api/amxmodx/get_user_msgid

Quote:

Note

On first server start, this function will return 0 if used inside
plugin_precache(). Consider hooking RegUserMsg in order to retrieve
the correct message id.

ConorCC 01-02-2021 09:31

Re: Message ID return 0
 
Thank you for the info.
I feel so stupid because of I ignored this point in the documentation.


All times are GMT -4. The time now is 14:12.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.