SA-MP Forums Archive
OnPlayerText Problem to new Functions ? - 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: OnPlayerText Problem to new Functions ? (/showthread.php?tid=208126)



OnPlayerText Problem to new Functions ? - DeadLyMann - 07.01.2011

New 0.3c function is " {RRGGBB}Text " in Message to Colored Text.. But PlayerColor is = 0xRRGGBBFF you know.
How to get PlayerColor 0xRRGGBBFF to RRGGBB ?

Код:
format(str, sizeof(str), "{%x}",GetPlayerColor(playerid));
format(MMM, sizeof(MMM),"{FFFFFF}[] %s%s : {FFFFFF}%s", playerid, str, oName, text);
This code doesn't work correctly The PlayerColor is ; 0x00F600F6 return is; F600F6 but correct return; 00F600

How can I do correct ? Sorry my bad english :/


Re: OnPlayerText Problem to new Functions ? - Wyu - 07.01.2011

You need to shift player color 8 bits right to remove the alpha part, like this:
pawn Код:
format(str, sizeof(str), "{%x}", GetPlayerColor(playerid) >> 8);
If you wanna know how this works:
https://sampwiki.blast.hk/wiki/Binary
https://sampwiki.blast.hk/wiki/Hex


Re: OnPlayerText Problem to new Functions ? - RyDeR` - 07.01.2011

or just
pawn Код:
format(str, sizeof(str), "{%06x}", GetPlayerColor(playerid));



Re: OnPlayerText Problem to new Functions ? - DeadLyMann - 07.01.2011

Thanks


Re: OnPlayerText Problem to new Functions ? - Jason_Blink - 11.03.2011

sdfsdfsf


Re: OnPlayerText Problem to new Functions ? - Jason_Blink - 11.03.2011

oops! sorry for the above reply.


Re: OnPlayerText Problem to new Functions ? - Kwarde - 11.03.2011

Jo thanks guys. I didn't know you could add '%' strings in the {} colors.


Re: OnPlayerText Problem to new Functions ? - OKStyle - 12.03.2011

Or:
pawn Код:
format(str, sizeof(str), "{%06x}", GetPlayerColor(playerid) >>> 8);