Adding Colors in Stats
#1

I was wondering if there is a way to have all the letters in /stats a certain color and all the numbers a certain color. I tried using Hex (ex. {FFFFFF}) but it made it all disappear. Any help is appreciated.
Reply
#2

What is this a ClientMessage Dialog what ?
Reply
#3

Oh yes its a client message, sorry.
Reply
#4

Make it easy for u

pawn Код:
#define WHITE          "{FFFFFF}"
#define RED            "{F81414}"
#define GREEN          "{6EF83C}"
#define ORANGE         "{FFAF00}"
#define BLUE           "{0049FF}"

//then use it like this(example)
SendClientMessage(playerid,""WHITE"This is white, "BLUE" this is blue");
Will work in dialog as well
Reply
#5

Ok, I tried what you did and got a few errors. I will try to make it more specific lol.


Here's the code and what I want to do:
Код:
		format(string, sizeof(string), "Stats for %s (ID: %d):", PlayerName(targetid), targetid);
		SendClientMessage(playerid, WHITE, string);
		
	        format(string, sizeof(string),	"Level: %d | Gender: %s | Age: %d | Origin: %s | Cash: $%s | Bank: $%s | Phone Number: %d | Job: %s (%d)", plevel, gender, age, PlayerInfo[targetid][pOrigin], InsertCommas(wallet), InsertCommas(bank), number, job, joblevel);
		SendClientMessage(playerid, SGREEN, string);

                format(string, sizeof(string), "Total Hours Online: %d | Warnings: %d | Upgrade Points: %d | Spawn Armor: %d | Experience: %d/%d | Crimes Committed: %d | Times Arrested: %d", hours, warns, upgradepoints, spawnhealth, exp, expamount - PlayerInfo[targetid][pLevelExp], crimes, arrests);
		SendClientMessage(playerid, SGREEN, string);
For "Level | Gender | Age |" etc I want it to be a certain color. And for "%d, %s" I want to be white. I hope this makes it easier.
Reply
#6

pawn Код:
format(string, sizeof(string), "Stats for %s (ID: %d):", PlayerName(targetid), targetid);
        SendClientMessage(playerid, WHITE, string);
       
            format(string, sizeof(string)"{HEXCODES}Level: {FFFFFF}%d | {HEXCODES}Gender: {FFFFFF}%s | {HEXCODES}Age: {FFFFFF}%d | {HEXCODES}Origin: {FFFFFF}%s | {HEXCODES}Cash: {FFFFFF}$%s | {HEXCODES}Bank: {FFFFFF}$%s | {HEXCODES}Phone Number: {FFFFFF}%d | {HEXCODES}Job: {FFFFFF}%s (%d)", plevel, gender, age, PlayerInfo[targetid][pOrigin], InsertCommas(wallet), InsertCommas(bank), number, job, joblevel);
        SendClientMessage(playerid, SGREEN, string);

                format(string, sizeof(string), "Total Hours Online: %d | Warnings: %d | Upgrade Points: %d | Spawn Armor: %d | Experience: %d/%d | Crimes Committed: %d | Times Arrested: %d", hours, warns, upgradepoints, spawnhealth, exp, expamount - PlayerInfo[targetid][pLevelExp], crimes, arrests);
        SendClientMessage(playerid, SGREEN, string);
Replace HEXCODES with actual hex codes. I've set the %s and %d for white.
Reply
#7

Quote:
Originally Posted by Goldilox
Посмотреть сообщение
pawn Код:
format(string, sizeof(string), "Stats for %s (ID: %d):", PlayerName(targetid), targetid);
        SendClientMessage(playerid, WHITE, string);
       
            format(string, sizeof(string)"{HEXCODES}Level: {FFFFFF}%d | {HEXCODES}Gender: {FFFFFF}%s | {HEXCODES}Age: {FFFFFF}%d | {HEXCODES}Origin: {FFFFFF}%s | {HEXCODES}Cash: {FFFFFF}$%s | {HEXCODES}Bank: {FFFFFF}$%s | {HEXCODES}Phone Number: {FFFFFF}%d | {HEXCODES}Job: {FFFFFF}%s (%d)", plevel, gender, age, PlayerInfo[targetid][pOrigin], InsertCommas(wallet), InsertCommas(bank), number, job, joblevel);
        SendClientMessage(playerid, SGREEN, string);

                format(string, sizeof(string), "Total Hours Online: %d | Warnings: %d | Upgrade Points: %d | Spawn Armor: %d | Experience: %d/%d | Crimes Committed: %d | Times Arrested: %d", hours, warns, upgradepoints, spawnhealth, exp, expamount - PlayerInfo[targetid][pLevelExp], crimes, arrests);
        SendClientMessage(playerid, SGREEN, string);
Replace HEXCODES with actual hex codes. I've set the %s and %d for white.
I've tried that, it just made the whole clientmessage disappear.
Reply
#8

Bump
Reply
#9

Each color you use subtracts 8 characters from the total maximum length of the string. 16 * 8 = 128 which leaves you with 16 characters for your text.
Reply
#10

Quote:
Originally Posted by ArmandoRamiraz
Посмотреть сообщение
Ok, I tried what you did and got a few errors. I will try to make it more specific lol.


Here's the code and what I want to do:
Код:
		format(string, sizeof(string), "Stats for %s (ID: %d):", PlayerName(targetid), targetid);
		SendClientMessage(playerid, WHITE, string);
		
	        format(string, sizeof(string),	"Level: %d | Gender: %s | Age: %d | Origin: %s | Cash: $%s | Bank: $%s | Phone Number: %d | Job: %s (%d)", plevel, gender, age, PlayerInfo[targetid][pOrigin], InsertCommas(wallet), InsertCommas(bank), number, job, joblevel);
		SendClientMessage(playerid, SGREEN, string);

                format(string, sizeof(string), "Total Hours Online: %d | Warnings: %d | Upgrade Points: %d | Spawn Armor: %d | Experience: %d/%d | Crimes Committed: %d | Times Arrested: %d", hours, warns, upgradepoints, spawnhealth, exp, expamount - PlayerInfo[targetid][pLevelExp], crimes, arrests);
		SendClientMessage(playerid, SGREEN, string);
For "Level | Gender | Age |" etc I want it to be a certain color. And for "%d, %s" I want to be white. I hope this makes it easier.

Try, changing "SGREEN" to GREEN..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)