SA-MP Forums Archive
Colour trouble. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Colour trouble. (/showthread.php?tid=141026)



Colour trouble. - Razvann - 11.04.2010

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?


Re: Colour trouble. - Babul - 11.04.2010

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


Re: Colour trouble. - Razvann - 11.04.2010

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.


Re: Colour trouble. - Amit_B - 11.04.2010

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.


Re: Colour trouble. - Razvann - 12.04.2010

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..


Re: Colour trouble. - Babul - 12.04.2010

Код:
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;
	}



Re: Colour trouble. - Razvann - 12.04.2010

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.


Re: Colour trouble. - Babul - 12.04.2010

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 ^^


Re: Colour trouble. - Razvann - 13.04.2010

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.


Re: Colour trouble. - biltong - 13.04.2010

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