AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help with Blocking Joining Spectator Team Message (https://forums.alliedmods.net/showthread.php?t=12893)

Zor 04-28-2005 07:06

Help with Blocking Joining Spectator Team Message
 
Hi all, Im trying to figure out how to block the Player joined Spectator text message. I know to use the following:

Code:

register_event("TextMsg", "my_func", "a", "1=3", 2=#game_jointeam", "4=Spectators")
But the problem is in the my_func, I know that it gets there as I put out a chat msg. But when I do the following nothing happens:

Code:

set_user_msg(get_usr_msgid("TextMsg"), BLOCK_ONCE)

if(is_user_alive(id))
    set_user_msg(get_usr_msgid("DeathMsg"), BLOCK_ONCE)

Anyway, any help is appreciated, good help is valued, and a concrete answer is GODDLY!

Cheers!

FeuerSturm 04-28-2005 07:21

erm, what strange native are you using there?

Code:

/* Sets/Gets what engine messages are blocked. */
native set_msg_block(iMessage, iMessageFlags);
native get_msg_block(iMessage);


Zor 04-28-2005 09:11

Hehehe...yeah I was doing it at work and forgot to look. Happens...but the situation is still the same as you well know.

Cheers!

XxAvalanchexX 04-28-2005 12:23

By the time my_func gets called, the TextMsg will have already been sent, you won't be able to block it. Take a look throug engine.inc at the register_message functions. You can use these to actually intercept the message and stop it from being sent.

Zor 04-28-2005 13:18

@XxAvalanchexX
Yeah I was looking at that one.

register_message(get_user_msgid("TextMsg"), "my_func")

public my_func(msgid, msgdest, msgentity)
{
new msg[2][32]
get_msg_arg_string(2, msg[0], 31)
get_msg_arg_string(3, msg[1], 31)

if(equal(msg[0], "joined team")
&& equal(msg[1], "Spectators")
&& get_user_flags(msgentity)&ADMIN_LEVEL_A)
{
set_msg_block(get_user_msgid("TextMsg"), BLOCK_ONCE)
set_msg_block(get_user_msgid("DeathMsg"), BLOCK_ONCE)
}
}

Now what I was having problems with in that one was that when I used it, it was blocking all join teams for admins and all the deaths...so I'll have to test it a bit further latter.

Cheers!


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

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