Raised This Month: $ Target: $400
 0% 

Block "* PlayerName has changed to team 'red'" message


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Flipper_SPb
Senior Member
Join Date: Jun 2009
Location: Worldspawn
Old 05-04-2010 , 14:36   Block "* PlayerName has changed to team 'red'" message
Reply With Quote #1

I need an advice.
I want to block message " * PlayerName has changed to team 'red' "
when player changes team (Half-Life).
Now I have:

PHP Code:
public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
g_Msg get_user_msgid("SayText")
    
register_message(g_Msg,"BlockMessage")
}

public 
BlockMessage(MsgID,MsgDest,id) {
    new 
msg_string[64]
    
get_msg_arg_string(2msg_string63)
    if(
contain(msg_string" has changed to team ^'") > -1)
        return 
PLUGIN_HANDLED
    
return PLUGIN_CONTINUE

Is that good? Or it can be done better way?

Last edited by Flipper_SPb; 05-04-2010 at 14:40.
Flipper_SPb is offline
Send a message via ICQ to Flipper_SPb
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-04-2010 , 16:50   Re: Block "* PlayerName has changed to team 'red'" message
Reply With Quote #2

Try this :

PHP Code:
#include <amxmodx>
#include <fakemeta>

#define VERSION "0.0.1"

new gmsgSayText
new g_iMhSayText

public plugin_init()
{
    
register_plugin("name"VERSION"ConnorMcLeod")

    
register_forward(FM_ClientUserInfoChanged"ClientUserInfoChanged")

    
gmsgSayText get_user_msgid("SayText")
}

public 
ClientUserInfoChanged()
{
    
g_iMhSayText register_message(gmsgSayText"Message_SayText")
}

public 
client_infochanged()
{
    
unregister_message(gmsgSayTextg_iMhSayText)
}

public 
Message_SayText(iMsgIdiMsgDestid)
{
    if( 
iMsgDest == MSG_ALL )
    {
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
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 03:45.


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