string colors and money problem
#1

I use this
PHP код:
CMD:setmoney(playeridparams[])
{
    new 
pIDvalue;
    if(
PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, -1"{FF0000}EROARE: {FFFFFF}Nu ai acces la aceasta comanda.");
    else if(
sscanf(params"ui"pIDvalue)) return SendClientMessage(playeridCOL_GOLD"Foloseste: /setmoney [id] [suma]");
    else if(
pID == INVALID_PLAYER_ID) return SendClientMessage(playeridCOL_TOM"Jucatorul nu este conectat.");
    else
    {
        new 
string[100], target[MAX_PLAYER_NAME], pName[MAX_PLAYER_NAME];
        
GetPlayerName(playeridpNamesizeof(pName));
        
GetPlayerName(pIDtargetsizeof(target));
        
format(stringsizeof(string), "I-ai setat lui %s%s%s suma de %s%i$.",COL_BLUEtargetCOL_GYELLOWCOL_GREENvalue);
        
SendClientMessage(playeridCOL_GYELLOWstring);
        
format(stringsizeof(string), "Ai primit suma de %s%i$%s de la %s%s.",COL_GREENvalue,COL_GYELLOW COL_BLUEpName);
        
SendClientMessage(pIDCOL_GYELLOWstring);
        
PlayerInfo[pID][pCash] = value;
        
SetPlayerMoney(pIDPlayerInfo[pID][pCash]);
    }
    return 
1;

And look how appear on chat http://imgur.com/a/FkVSM
I want the word "suma de" and "de la" to be like rest of message (COL_GYELLOW). And what i need to money look like 200,000$ instead of 200000$?
Reply
#2

Colors is working like that
PHP код:
format(stringsizeof(string), "I-ai setat lui "COL_BLUE"%s suma de "COL_GREEN"%i$."targetvalue); 
For 200,000, you need to create a function which is doing this.
Reply
#3

How look this function?
EDIT:It's same thing man the words between that 2 culors get the first color's value. I want to get message color.
If you want, i can to make that message in English to understand better.
Reply
#4

I made this for you.
PHP код:
NumberWithSign(const number, const sign[2] = "'")
{
    new 
str[10 EOS];
    
format(strsizeof(str), "%i"number);
    for(new 
strlen(str)-30-= 3)
    {
        
strins(strsignj);
    }
    return 
str;

Write there your message with colors.
Reply
#5

This
PHP код:
format(stringsizeof(string), "I-ai setat lui "COL_BLUE"%s suma de "COL_GREEN"%i$."targetvalue);  
SendClientMessage(playeridCOL_GYELLOWstring); 
=
PHP код:
format(stringsizeof(string), "You set "COL_BLUE"%s amount of "COL_GREEN"%i$."targetvalue);  
SendClientMessage(playeridCOL_GYELLOWstring); 
Now, the words "amount of" (suma de) will be blue, i want to keep string color COL_GYELLOW you know
EDIT:that function is a public?
Reply
#6

PHP код:
format(stringsizeof(string), "You set "COL_BLUE"%s "COL_GYELLOW "amount of "COL_GREEN"%i"COL_GYELLOW "$."targetvalue);   
SendClientMessage(playeridCOL_GYELLOWstring); 
I'm pretty sure this is wont work because COL_GYELLOW is an hexidecimal color and in string you need only to put GGBBRR.
Example:
PHP код:
SendClientMessage(playerid, -1"this is white{FF0000}this is red"); 
No, it's not.
Reply
#7

I resolved with function, stock it.
But how i obtain that code? this is col_gyellow 0xADFF2FAA
I guess the good code is ADFF2F, right?
EDIT: Thanks man with the string colors, now it's ok.
i put your function
PHP код:
stock NumberWithSign(const number, const sign[2] = "'")
{
    new 
str[10 EOS];
    
format(strsizeof(str), "%i"number);
    for(new 
strlen(str)-30-= 3)
    {
        
strins(strsignj);
    }
    return 
str;

But the value it's same like 50000$, not 50.000. I have to add another codes in my setmoney cmd?
Reply
#8

PHP код:
format(stringsizeof(string), "You set "COL_BLUE"%s amount of "COL_GREEN"%i$."targetNumberWithSign(value".")); 
Try this.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)