Check if the player's color is white
#6

Just compare it with COLOR_WHITE? What is so hard about that? They're just numbers, after all.

Quote:
Originally Posted by dominik523
Посмотреть сообщение
@zSuYaNw: Isn't that the same as !GetPlayerColor or GetPlayerColor == 0?
The ~ operator is known as bitwise not, or the one's complement; it inverts all the bits. So when applied to decimal 0, which has 32 bits all set to 0, you get 32 bits set to 1. When converting that to decimal you get decimal -1 or hexadecimal 0xFFFFFFFF, which is coincidentally the color white. So basically that if-statement would return true for anything BUT the color white and is therefore equal to GetPlayerColor != -1.
Reply


Messages In This Thread
Check if the player's color is white - by dionisak0s - 10.07.2015, 20:09
Re: Check if the player's color is white - by zSuYaNw - 10.07.2015, 20:16
Re: Check if the player's color is white - by dominik523 - 10.07.2015, 20:17
Re: Check if the player's color is white - by shadowdog - 10.07.2015, 20:18
Re: Check if the player's color is white - by dionisak0s - 10.07.2015, 20:20
Re: Check if the player's color is white - by Vince - 10.07.2015, 21:14
Re: Check if the player's color is white - by dionisak0s - 11.07.2015, 05:33

Forum Jump:


Users browsing this thread: 2 Guest(s)