Raised This Month: $ Target: $400
 0% 

Problem with message


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Enomine
Junior Member
Join Date: Apr 2012
Old 04-28-2012 , 19:06   Problem with message
Reply With Quote #1

I made a All Chat & Dead Name Changer, but I have a problem with all chat.
When admins uses the chat doesn't change the color and have an extra space in nick and chat...

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

/* Pragma */
#pragma semicolon    1

/* Message */
new SayText;

public 
plugin_init()
{
    
/* Plugin Registration */
    
register_plugin("AllChat & Dead Name Changer","0.0.1","Enomine");
    
    
/* Forward */
    
register_forward(FM_ClientUserInfoChanged,"fwdClientInfoChanged");
    
    
/* Messages */
    
SayText get_user_msgid("SayText");
    
register_message(SayText,"MsgSayText");
}

public 
MsgSayText(MsgID,MsgDEST,id)
{
    if(!
id)
        return 
PLUGIN_CONTINUE;
        
    new 
said[192];
    
get_msg_arg_string(4,said,charsmax(said));
    
    new 
name[32];
    
get_user_name(id,name,charsmax(name));
    
    new 
msg[193];
    new 
namex[33];
    
    if(
id == get_msg_arg_int(1))
    {
        if(
is_user_admin(id))
        {
            
formatex(msg,charsmax(msg),"^x01%s",said);
            
formatex(namex,charsmax(namex),"^x04%s",name);
            
MessageSaytext(id,namex,msg);
        }
        else
            
MessageSaytext(id,name,said);
    }
    
    return 
PLUGIN_HANDLED;
}

public 
fwdClientInfoChanged(idbuffer)
{
    if(!
is_user_connected(id))
        return 
FMRES_IGNORED;
    
    new 
name[32];
    new 
newname[32];
    
    
get_user_name(id,name,charsmax(name));
    
engfunc(EngFunc_InfoKeyValue,buffer,"name",newname,charsmax(newname));
    
    if(
equal(name,newname))
        return 
FMRES_IGNORED;
        
    new 
Message[33];
        
    if(
is_user_admin(id))
    {
        
formatex(Message,charsmax(Message),"^x04%s",newname);
        
MsgNameChange(id,name,Message);
    }
    else
        
MsgNameChange(id,name,newname);
    
    return 
FMRES_SUPERCEDE;
}
    
    
public 
MsgNameChange(id,name[],newname[])
{
    
message_begin(MSG_BROADCASTSayText);
    
write_byte(id);
    
write_string("#Cstrike_Name_Change");
    
write_string(name);
    
write_string(newname);
    
message_end();
}


public 
MessageSaytext(id,name[],said[])
{
    
message_begin(MSG_BROADCAST,SayText);
    
write_byte(id);
    
write_string("#Cstrike_Chat_All");
    
write_string(name);
    
write_string(said);
    
message_end();

Enomine is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 04-28-2012 , 19:27   Re: Problem with message
Reply With Quote #2

Try this:
PHP Code:
            formatex(msg,charsmax(msg),"%c%s",0x01,said);
            
formatex(namex,charsmax(namex),"%c%s",0x04,name); 
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-28-2012 , 19:28   Re: Problem with message
Reply With Quote #3

Because #Cstrike_Name_Change starts with 0x02, which had to consequence to only change name into team color, so 0x04 (^4) has no effect.

Try "^4#Cstrike_Name_Change"
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Enomine
Junior Member
Join Date: Apr 2012
Old 04-28-2012 , 19:37   Re: Problem with message
Reply With Quote #4

Quote:
Originally Posted by Exolent[jNr] View Post
Try this:
PHP Code:
            formatex(msg,charsmax(msg),"%c%s",0x01,said);
            
formatex(namex,charsmax(namex),"%c%s",0x04,name); 
Doesn't work.

Quote:
Originally Posted by ConnorMcLeod View Post
Because #Cstrike_Name_Change starts with 0x02, which had to consequence to only change name into team color, so 0x04 (^4) has no effect.

Try "^4#Cstrike_Name_Change"
Name Changer is working very well, allchat is who doesn't change the color.
Enomine 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 07:46.


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