Raised This Month: $90 Target: $400

Suggestion about register_message

Post New Thread Reply   
Thread Tools Display Modes
Author Message
Senior Member
Join Date: Dec 2017
Old 08-08-2018 , 18:58   Suggestion about register_message
Reply With Quote #1


I have a new idea about register_message.

But first, the explanation.
If we want to block (for example) only "Terrorist win" sound, we have to hook SendAudio message using register_message:
PHP Code:
register_messageget_user_msgid("SendAudio"), "Message_SendAudio" 
and do something like this:
PHP Code:
public Message_SendAudio()
get_msg_arg_string2arg2charsmax(arg2) )

equali(arg2"%!MRAD_terwin") )


All fine but, if we have 32 players online the server will execute this function 32 times, doing the same job again and again.

Now, my suggestion.
We should have new native: register_message_pre or another good name
Usage remains the same:
PHP Code:
register_message_preget_user_msgid("SendAudio"), "Message_SendAudio_Pre" 
But now, the server before looping over online players executes our function.
If it find "return 1" in the our func, it won't looping over players, and (in our example) it does not send "Terrorist win" sound to anyone.

What do you think, guys?
My English is A0
E1_531G is offline
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 08-08-2018 , 19:43   Re: Suggestion about register_message
Reply With Quote #2

It doesn't matter that it's called 32 times, it's trivial.
KliPPy is offline

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -4. The time now is 03:46.

Powered by vBulletin®
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Theme made by Freecode