diff --git a/dlls/user_messages.cpp b/dlls/user_messages.cpp index 0a08cdd..bf4df99 100644 --- a/dlls/user_messages.cpp +++ b/dlls/user_messages.cpp @@ -77,6 +77,20 @@ int GetUserMsgInfo(const char* msgname, int* size) { return 0; } +int GetUserMsgInfo(int id, int* size) { + for (int i = 0; i < (int)g_userMessages.size(); i++) { + UserMessage& msg = g_userMessages[i]; + + if (msg.id == id) { + if (size) + *size = msg.size; + return msg.id; + } + } + + return 0; +} + void LinkUserMessages(void) { // Already taken care of? diff --git a/dlls/user_messages.h b/dlls/user_messages.h index 1577b15..a5c7058 100644 --- a/dlls/user_messages.h +++ b/dlls/user_messages.h @@ -61,5 +61,6 @@ EXPORT int REG_USER_MSG(const char* name, int size); // Find a usermsg, registered by the gamedll, with the corresponding // msgname, and return remaining info about it (msgid, size). -metamod EXPORT int GetUserMsgInfo(const char* msgname, int* size); +EXPORT int GetUserMsgInfo(int id, int* size); void LinkUserMessages(void); \ No newline at end of file