string colors and money problem -
GabiXx - 01.12.2016
I use this
PHP код:
CMD:setmoney(playerid, params[])
{
new pID, value;
if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, -1, "{FF0000}EROARE: {FFFFFF}Nu ai acces la aceasta comanda.");
else if(sscanf(params, "ui", pID, value)) return SendClientMessage(playerid, COL_GOLD, "Foloseste: /setmoney [id] [suma]");
else if(pID == INVALID_PLAYER_ID) return SendClientMessage(playerid, COL_TOM, "Jucatorul nu este conectat.");
else
{
new string[100], target[MAX_PLAYER_NAME], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
GetPlayerName(pID, target, sizeof(target));
format(string, sizeof(string), "I-ai setat lui %s%s%s suma de %s%i$.",COL_BLUE, target, COL_GYELLOW, COL_GREEN, value);
SendClientMessage(playerid, COL_GYELLOW, string);
format(string, sizeof(string), "Ai primit suma de %s%i$%s de la %s%s.",COL_GREEN, value,COL_GYELLOW , COL_BLUE, pName);
SendClientMessage(pID, COL_GYELLOW, string);
PlayerInfo[pID][pCash] = value;
SetPlayerMoney(pID, PlayerInfo[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$?
Re: string colors and money problem -
Dayrion - 01.12.2016
Colors is working like that
PHP код:
format(string, sizeof(string), "I-ai setat lui "COL_BLUE"%s suma de "COL_GREEN"%i$.", target, value);
For 200,000, you need to create a function which is doing this.
Re: string colors and money problem -
GabiXx - 01.12.2016
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.
Re: string colors and money problem -
Dayrion - 01.12.2016
I made this for you.
PHP код:
NumberWithSign(const number, const sign[2] = "'")
{
new str[10 + EOS];
format(str, sizeof(str), "%i", number);
for(new j = strlen(str)-3; j > 0; j -= 3)
{
strins(str, sign, j);
}
return str;
}
Write there your message with colors.
Re: string colors and money problem -
GabiXx - 02.12.2016
This
PHP код:
format(string, sizeof(string), "I-ai setat lui "COL_BLUE"%s suma de "COL_GREEN"%i$.", target, value);
SendClientMessage(playerid, COL_GYELLOW, string);
=
PHP код:
format(string, sizeof(string), "You set "COL_BLUE"%s amount of "COL_GREEN"%i$.", target, value);
SendClientMessage(playerid, COL_GYELLOW, string);
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?
Re: string colors and money problem -
Dayrion - 02.12.2016
PHP код:
format(string, sizeof(string), "You set "COL_BLUE"%s "COL_GYELLOW "amount of "COL_GREEN"%i"COL_GYELLOW "$.", target, value);
SendClientMessage(playerid, COL_GYELLOW, string);
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.
Re: string colors and money problem -
GabiXx - 02.12.2016
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(str, sizeof(str), "%i", number);
for(new j = strlen(str)-3; j > 0; j -= 3)
{
strins(str, sign, j);
}
return str;
}
But the value it's same like 50000$, not 50.000. I have to add another codes in my setmoney cmd?
Re: string colors and money problem -
Dayrion - 02.12.2016
PHP код:
format(string, sizeof(string), "You set "COL_BLUE"%s amount of "COL_GREEN"%i$.", target, NumberWithSign(value, "."));
Try this.