AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Block "* PlayerName has changed to team 'red'" message (https://forums.alliedmods.net/showthread.php?t=126018)

Flipper_SPb 05-04-2010 14:36

Block "* PlayerName has changed to team 'red'" message
 
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?

ConnorMcLeod 05-04-2010 16:50

Re: Block "* PlayerName has changed to team 'red'" message
 
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




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

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