Hello.
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_message( get_user_msgid("SendAudio"), "Message_SendAudio" )
and do something like this:
PHP Code:
public Message_SendAudio()
{
static arg2[16]
get_msg_arg_string( 2, arg2, charsmax(arg2) )
if( equali(arg2, "%!MRAD_terwin") )
return 1;
return 0;
}
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_pre( get_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?
__________________