09.11.2009, 19:48
Quote:
Originally Posted by LienK
I have defined 100 colors like this:
#define COLOR_1 0xAAAAAAFF #define COLOR_2 0xAAAAAAFF ... #define COLOR_100 0xAAAAAAFF And I want the player to be able to write /color [number] and then get the color that the number is associated with in the #defines. Of course I could use: if(number == 1) { SetPlayerColor(playerid, COLOR_1); } if(number == 2 { SetPlayerColor(playerid, COLOR_2); } Etc. But is there a simpler way to do this? Like taking the number the player inputs and set it at the end of COLOR_, or something? |
pawn Код:
format(string, 20, "COLOR_%d", number);
SetPlayerColor(playerid, string);