Message help
#1

PHP код:
CMD:a(playeridparams[])
{
    if(
isnull(params)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /a [chat]");
    new 
string[128];
    
format(stringsizeof(string), "%s says: %s",GetPlayerNameEx(playerid), params);
    
SendClientMessageToAllEx(COLOR_YELLOWstring);
    return 
1;

how to change the color of this chat in-game ?
like typing that /a {ff0000} Hello
Reply
#2

You can do that by putting {COLOR} here

Quote:

format(string, sizeof(string), "{COLOR}%s says: %s",GetPlayerNameEx(playerid), params);

Reply
#3

you did'nt understand
i mean to send in multiple colors in game like (/a {ffff00} Hello {ffffff} World
Reply
#4

You can do it like that:

PHP код:
CMD:a(playeridparams[]) 

    if(
isnull(params)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /a [chat]"); 
    new 
string[144]; 
    
format(stringsizeof(string), "%s says: %s",GetPlayerNameEx(playerid), ColoredString(params)); 
    
SendClientMessageToAllEx(COLOR_YELLOWstring); 
    return 
1
}  
stock ColoredString(const tmp[])
{
    new 
string[144];
    
strcat(string,tmp,sizeof string);
    for(new 
i=strfind(string,"("); i!=-1i=strfind(string,"(",false,i+1))
    {
        switch(
string[i+7]) {
            case 
')'string[i] = '{',string[i+7]='}';
        }
    }
    return 
string;

Usage:
/a (FF0000)Hi (FFFF00)Color!

So you need to use ( instead of {
Reply
#5

it works but is that possible to change this usage
PHP код:
Usage:
/
(FF0000)Hi (FFFF00)Color
into this

PHP код:
Usage:
/
{FF0000}Hi {FFFF00}Color
Reply
#6

No, sorry, thats impossible, because { get ignored in the command text
Reply
#7

but i saw an server in which that command works
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)