SA-MP Forums Archive
Message help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Message help (/showthread.php?tid=584719)



Message help - muhsah007 - 07.08.2015

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


Re: Message help - TheRaGeLord - 07.08.2015

You can do that by putting {COLOR} here

Quote:

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




Re: Message help - muhsah007 - 07.08.2015

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


AW: Message help - Kaliber - 07.08.2015

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 {


Re: Message help - muhsah007 - 08.08.2015

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

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



AW: Message help - Kaliber - 08.08.2015

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


Re: Message help - muhsah007 - 08.08.2015

but i saw an server in which that command works