View Single Post
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 07-30-2018 , 13:37   Re: get_user_msgid() fails to work on server startup?
Reply With Quote #5

Quote:
Originally Posted by PRoSToTeM@ View Post
plugin_precache is useful for hooking WeaponList via register_message which requires get_user_msgid call.
Nope:

PHP Code:
#include <amxmodx>

public plugin_precache()
{
    
log_amx("%i"register_message(get_user_msgid("WeaponList"), "TestFunc"))
}

public 
TestFunc()
{
    static 
ii++
    
log_amx("test success %i"i)

Prints 0 on server start.
Prints 1 and "test success" 29 times after server restart or mapchange.

I already submitted a pull request to add a warning for this function in the documentation - https://github.com/alliedmodders/amxmodx/pull/506
Correct me if there's indeed a bug that needs to be fixed.
__________________

Last edited by OciXCrom; 07-30-2018 at 13:39.
OciXCrom is offline
Send a message via Skype™ to OciXCrom