getplayercolor and bits - 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: getplayercolor and bits (
/showthread.php?tid=74636)
getplayercolor and bits -
KingArthur - 24.04.2009
That is a very very very interessting topic

Can you explain me please what that do?
Код:
printf("%02x%06x", ih >>> 24, ih & 0x00FFFFFF);
I found it here:
http://forum.sa-mp.com/index.php?top...0537#msg280537
I think...
for example
ih = getplayercolor(playerid) //0xff0000ff with setplayercolor.
Now it looks in binary like this:
Код:
11111111 11111111 00000000 00000000 00000000 00000000 11111111 11111111 = FF 00 00 FF
Now bitshifting logical right(24):
Код:
00000000 00000000 00000000 11111111 11111111 00000000 00000000 00000000 = 00 0F F0 00
Now binary AND:
Код:
00000000 00000000 00000000 11111111 11111111 00000000 00000000 00000000 = 00 0F F0 00
Thats my result, but thats wrong :/
The code
Код:
printf("%02x%06x", ih >>> 24, ih & 0x00FFFFFF);
work perfecly but i cant understand it.
Can you please tell me what i think wrong?
Thanks
//EDIT
PLEASE EXPLAIN
Sry for doublelpost, but i think that no one saw this:
http://forum.sa-mp.com/index.php?top....msg630072#new
Re: getplayercolor and bits -
Redirect Left - 24.04.2009
Patience is a virtue.
Re: getplayercolor and bits -
KingArthur - 24.04.2009
Well yes of course.. i know i know i know, sry

But lol thats funny.... i don't really need a answer, because the code work perfectly.
That only think i want, is a explain what it do.
I mean.. i will understand what i do!
Not only copy/paste without information about the workprocess.
Greetings.