AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [SOLVED] use ColorChat (https://forums.alliedmods.net/showthread.php?t=273047)

arvEL. 10-11-2015 11:56

[SOLVED] use ColorChat
 
hi guys how to use ColorChat here

PHP Code:

public cmdSayAdmin(id)
{
    
    new 
said[2]
    
read_argv(1said1)
    if (
said[0] != '@')
        return 
PLUGIN_CONTINUE
    
new message[192], name[32], authid[32]
    new 
players[32], inum
    read_args
(message191)
    
remove_quotes(message)
    
get_user_authid(idauthid31)
    
get_user_name(idname31)
    if(
get_user_flags(id) & ADMIN_CHAT)
        
format(message191"[* ADMINS *] %s:  %s"namemessage[1])
    else
        
format(message191"[* PLAYER *] %s:  %s"namemessage[1])
    
get_players(playersinum)
    for (new 
0inum; ++i)
    {
        
// dont print the message to the client that used the cmd if he has ADMIN_CHAT to avoid double printing
        
if (players[i] != id && get_user_flags(players[i]) & g_AdminChatFlag)
            
client_print(players[i], print_chat"%s"message)
    }
    
client_print(idprint_chat"%s"message)
    return 
PLUGIN_HANDLED
    


here
PHP Code:

 if(get_user_flags(id) & ADMIN_CHAT)
        
format(message191"[* ADMINS *] %s:  %s"namemessage[1])
    else
        
format(message191"[* PLAYER *] %s:  %s"namemessage[1]) 

i wrote
PHP Code:

    if(get_user_flags(id) & ADMIN_CHAT)
        
ColorChat(messageGREY191"^4[* ADMINS *] %s:  %s"namemessage[1])
    else
        
ColorChat(messageGREY191"^4[* PLAYER *] %s:  %s"namemessage[1]) 

Example:
[* ADMINS *] arvEL.-: Hi all

[* *] = Yellow color
ADMINS = Green color
arvEL.- = Grey color
Hi all = Yellow color

^1[*^4 ADMINS ^1*]^3 %s^1: %s

i hope you understand my meaning
but i have problem with compile :/
help me plz

Spirit_12 10-11-2015 13:20

Re: [HELP] use ColorChat
 
What does it say?

PHP Code:

 if(get_user_flags(id) & ADMIN_CHAT)
        
format(message191"[* ADMINS *] %s:  %s"namemessage[1])
    else
        
format(message191"[* PLAYER *] %s:  %s"namemessage[1]) 

It says format. Colorchat is a replacement for client_print native, not format.

What you should be replacing here would be these lines.

PHP Code:

 client_print(players[i], print_chat"%s"message)
    }
    
client_print(idprint_chat"%s"message

PHP Code:

 Colorchat(players[i], GREY"%s"message)
    }
    
Colorchat(idGREY"%s"message


arvEL. 10-11-2015 14:18

Re: [HELP] use ColorChat
 
Quote:

Originally Posted by Spirit_12 (Post 2352120)
What does it say?

PHP Code:

 if(get_user_flags(id) & ADMIN_CHAT)
        
format(message191"[* ADMINS *] %s:  %s"namemessage[1])
    else
        
format(message191"[* PLAYER *] %s:  %s"namemessage[1]) 

It says format. Colorchat is a replacement for client_print native, not format.

What you should be replacing here would be these lines.

PHP Code:

 client_print(players[i], print_chat"%s"message)
    }
    
client_print(idprint_chat"%s"message

PHP Code:

 Colorchat(players[i], GREY"%s"message)
    }
    
Colorchat(idGREY"%s"message


Thx bro but can you fix my codes
and give me full codes

OciXCrom 10-11-2015 14:19

Re: [HELP] use ColorChat
 
Simple tutorial - https://youtu.be/xhyHNEK1TbU

Spirit_12 10-11-2015 14:21

Re: [HELP] use ColorChat
 
That was the fixed code. This is where that piece fits in.

PHP Code:

public cmdSayAdmin(id)
{
    
    new 
said[2]
    
read_argv(1said1)
    if (
said[0] != '@')
        return 
PLUGIN_CONTINUE
    
new message[192], name[32], authid[32]
    new 
players[32], inum
    read_args
(message191)
    
remove_quotes(message)
    
get_user_authid(idauthid31)
    
get_user_name(idname31)
    if(
get_user_flags(id) & ADMIN_CHAT)
        
format(message191"[* ADMINS *] %s:  %s"namemessage[1])
    else
        
format(message191"[* PLAYER *] %s:  %s"namemessage[1])
    
get_players(playersinum)
    for (new 
0inum; ++i)
    {
        
// dont print the message to the client that used the cmd if he has ADMIN_CHAT to avoid double printing
        
if (players[i] != id && get_user_flags(players[i]) & g_AdminChatFlag)
            
Colorchat(players[i], GREY"%s"message)
    }
    
Colorchat(idGREY"%s"message)
    return 
PLUGIN_HANDLED
    



arvEL. 10-11-2015 15:11

Re: [HELP] use ColorChat
 
Quote:

Originally Posted by Spirit_12 (Post 2352144)
That was the fixed code. This is where that piece fits in.

PHP Code:

public cmdSayAdmin(id)
{
    
    new 
said[2]
    
read_argv(1said1)
    if (
said[0] != '@')
        return 
PLUGIN_CONTINUE
    
new message[192], name[32], authid[32]
    new 
players[32], inum
    read_args
(message191)
    
remove_quotes(message)
    
get_user_authid(idauthid31)
    
get_user_name(idname31)
    if(
get_user_flags(id) & ADMIN_CHAT)
        
format(message191"[* ADMINS *] %s:  %s"namemessage[1])
    else
        
format(message191"[* PLAYER *] %s:  %s"namemessage[1])
    
get_players(playersinum)
    for (new 
0inum; ++i)
    {
        
// dont print the message to the client that used the cmd if he has ADMIN_CHAT to avoid double printing
        
if (players[i] != id && get_user_flags(players[i]) & g_AdminChatFlag)
            
Colorchat(players[i], GREY"%s"message)
    }
    
Colorchat(idGREY"%s"message)
    return 
PLUGIN_HANDLED
    



sorry not work :/
you should be fix this

PHP Code:

    if(get_user_flags(id) & ADMIN_CHAT)
        
format(message191"[* ADMINS *] %s:  %s"namemessage[1])
    else
        
format(message191"[* PLAYER *] %s:  %s"namemessage[1]) 


Adomaz1 10-11-2015 15:52

Re: [HELP] use ColorChat
 
just give the compiling error...

Banana. 10-11-2015 17:29

Re: [HELP] use ColorChat
 
PHP Code:

public cmdSayAdmin(id)
{
    
    new 
said[2]
    
read_argv(1said1)
    if (
said[0] != '@')
        return 
PLUGIN_CONTINUE
    
new message[192], name[32], authid[32]
    new 
players[32], inum
    read_args
(message191)
    
remove_quotes(message)
    
get_user_authid(idauthid31)
    
get_user_name(idname31)
    if(
get_user_flags(id) & ADMIN_CHAT)
        
client_print_color(id"[* ADMINS *] ^x04%s:  %s"namemessage[1])
    else
        
client_print_color(id"[* PLAYER *] ^x01%s:  %s"namemessage[1])
    
get_players(playersinum)
    for (new 
0inum; ++i)
    {
        
// dont print the message to the client that used the cmd if he has ADMIN_CHAT to avoid double printing
        
if (players[i] != id && get_user_flags(players[i]) & g_AdminChatFlag)
            
Colorchat(players[i], GREY"%s"message)
    }
    
Colorchat(idGREY"%s"message)
    return 
PLUGIN_HANDLED
    
}

stock client_print_color(const id, const input[], any:...)  
{  
    new 
count 1players[32];  
    static 
msg[191];  
    
vformat(msg190input3);  

    
replace_all(msg190"!g""^x04"); // Green Color  
    
replace_all(msg190"!n""^x01"); // Default Color  
    
replace_all(msg190"!t""^x03"); // Team Color  

    
if (idplayers[0] = id; else get_players(playerscount"ch");  
    {  
        for (new 
0counti++)  
        {  
            if (
is_user_connected(players[i]))  
            {  
                
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i]);  
                
write_byte(players[i]);  
                
write_string(msg);  
                
message_end();  
            }  
        }  
    }  



Banana. 10-11-2015 17:32

Re: [HELP] use ColorChat
 
What you are really trying to do?

If chatcolor , try this: https://forums.alliedmods.net/showthread.php?p=556619

arvEL. 10-11-2015 19:33

Re: [HELP] use ColorChat
 
Quote:

Originally Posted by Banana. (Post 2352212)
PHP Code:

public cmdSayAdmin(id)
{
    
    new 
said[2]
    
read_argv(1said1)
    if (
said[0] != '@')
        return 
PLUGIN_CONTINUE
    
new message[192], name[32], authid[32]
    new 
players[32], inum
    read_args
(message191)
    
remove_quotes(message)
    
get_user_authid(idauthid31)
    
get_user_name(idname31)
    if(
get_user_flags(id) & ADMIN_CHAT)
        
client_print_color(id"[* ADMINS *] ^x04%s:  %s"namemessage[1])
    else
        
client_print_color(id"[* PLAYER *] ^x01%s:  %s"namemessage[1])
    
get_players(playersinum)
    for (new 
0inum; ++i)
    {
        
// dont print the message to the client that used the cmd if he has ADMIN_CHAT to avoid double printing
        
if (players[i] != id && get_user_flags(players[i]) & g_AdminChatFlag)
            
Colorchat(players[i], GREY"%s"message)
    }
    
Colorchat(idGREY"%s"message)
    return 
PLUGIN_HANDLED
    
}

stock client_print_color(const id, const input[], any:...)  
{  
    new 
count 1players[32];  
    static 
msg[191];  
    
vformat(msg190input3);  

    
replace_all(msg190"!g""^x04"); // Green Color  
    
replace_all(msg190"!n""^x01"); // Default Color  
    
replace_all(msg190"!t""^x03"); // Team Color  

    
if (idplayers[0] = id; else get_players(playerscount"ch");  
    {  
        for (new 
0counti++)  
        {  
            if (
is_user_connected(players[i]))  
            {  
                
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i]);  
                
write_byte(players[i]);  
                
write_string(msg);  
                
message_end();  
            }  
        }  
    }  



thx bro but i want use ColorChat because it have a GREY color!
see example

[* ADMINS *] arvEL.-: Hi all

[* *] = Yellow color
ADMINS = Green color
arvEL.- = Grey color
Hi all = Yellow color

^1[*^4 ADMINS ^1*]^3 %s^1: %s

i hope you understand my meaning
thx bro i wish you help me bro


All times are GMT -4. The time now is 22:17.

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