Raised This Month: $ Target: $400
 0% 

Help with Blocking Joining Spectator Team Message


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Zor
Veteran Member
Join Date: Mar 2004
Location: Toronto, ON
Old 04-28-2005 , 07:06   Help with Blocking Joining Spectator Team Message
Reply With Quote #1

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!
__________________
Zor is offline
Send a message via AIM to Zor Send a message via MSN to Zor Send a message via Yahoo to Zor
FeuerSturm
AlliedModders Donor
Join Date: Apr 2004
Old 04-28-2005 , 07:21  
Reply With Quote #2

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);
FeuerSturm is offline
Zor
Veteran Member
Join Date: Mar 2004
Location: Toronto, ON
Old 04-28-2005 , 09:11  
Reply With Quote #3

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!
__________________
Zor is offline
Send a message via AIM to Zor Send a message via MSN to Zor Send a message via Yahoo to Zor
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 04-28-2005 , 12:23  
Reply With Quote #4

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.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Zor
Veteran Member
Join Date: Mar 2004
Location: Toronto, ON
Old 04-28-2005 , 13:18  
Reply With Quote #5

@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!
__________________
Zor is offline
Send a message via AIM to Zor Send a message via MSN to Zor Send a message via Yahoo to Zor
Reply



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 16:46.


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