Colour trouble.
#1

Hi, I have setted a color for the whisper cmd, and if I set for example to red it sends me with the black colour, why?
Here's an example:
pawn Код:
if(strcmp(x_nr,"red",true) == 0)
        {
             format(string, sizeof(string), "0xD40000AA");
              strmid(PlayerInfo[playerid][pWispCol], string, 0, strlen(string), 255);
             PlayerInfo[playerid][pWispCols] = 1;
             format(string,sizeof(string),"Your whisper color was setted to RED.");
             SendClientMessage(playerid, COLOR_WHITE, string);
             return 1;
        }
pawn Код:
format(string, sizeof(string), "%s(ID: %d) whispers: %s", sendername, playerid, (result));
SendClientMessage(giveplayerid, PlayerInfo[giveplayerid][pWispCol], string);
format(string, sizeof(string), "Whisper sent to %s(ID: %d): %s", giveplayer, giveplayerid, (result));
SendClientMessage(playerid, PlayerInfo[playerid][pWispCol], string);
What's wrong?
Reply
#2

PlayerInfo[giveplayerid][pWispCol] needs to be an integer, not a string.
the hex notation 0xd4 represents d*16+4 = 13*16=208 +4=212, its like an integer, more handy to use for colors
Reply
#3

Quote:
Originally Posted by Babul
PlayerInfo[giveplayerid][pWispCol] needs to be an integer, not a string.
the hex notation 0xd4 represents d*16+4 = 13*16=208 +4=212, its like an integer, more handy to use for colors
Err, but can you make it for me? I haven't understood very good.
Reply
#4

hmm, I think that your code should get some errors.

Anyway, there is a better way to do that:
pawn Код:
x = 0xD40000AA;
// ...
SendClientMessage(playerid,x,"red message");
Try this way.
Reply
#5

Quote:
Originally Posted by Amit B
hmm, I think that your code should get some errors.

Anyway, there is a better way to do that:
pawn Код:
x = 0xD40000AA;
// ...
SendClientMessage(playerid,x,"red message");
Try this way.
Yeah, but I want to set the color from another command..
Reply
#6

Код:
if(strcmp(x_nr,"red",true) == 0)
	{
		PlayerInfo[playerid][pWispCol]=0xd40000aa;
//		PlayerInfo[playerid][pWispCols] = 1; //idk what this is needed for, so i just commented it out
		format(string,sizeof(string),"Your whisper color was setted to RED.");
		SendClientMessage(playerid, PlayerInfo[playerid][pWispCol], string);
		return 1;
	}
Reply
#7

Quote:
Originally Posted by Babul
Код:
if(strcmp(x_nr,"red",true) == 0)
	{
		PlayerInfo[playerid][pWispCol]=0xd40000aa;
//		PlayerInfo[playerid][pWispCols] = 1; //idk what this is needed for, so i just commented it out
		format(string,sizeof(string),"Your whisper color was setted to RED.");
		SendClientMessage(playerid, PlayerInfo[playerid][pWispCol], string);
		return 1;
	}
Thanks, works, but the color isn't saving when I type /quit, and whisper again it sends me the message with the black colour.
Reply
#8

just make sure that your saving routine handles the color like an integer (score, money, any numeric value), not like a string. it should work then ^^
Reply
#9

Quote:
Originally Posted by Babul
just make sure that your saving routine handles the color like an integer (score, money, any numeric value), not like a string. it should work then ^^
Yeah, did it yet, but it doesen't work .

btw, when I don't have my colour setted it sends me a message with the black colour.
Reply
#10

Don't hex numbers have their own variable? new hex:white = 0xFFFFFFFF or something?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)