05.07.2020, 17:39
Quote:
This is how I would do it:
pawn Code:
Note the next few things: 1) There is an array named "AdminLevelName". By using AdminLevelName[0] it would return "User", AdminLevelName[1] would return "Semi Administrator [Level 1]" etcetera. Rather than switching between two variables, you can now get the level name from the array. 2) Note how I used "const" for AdminLevelName; because of this, you can't alter the array after creating it to prevent problems 3) I use 'AdminLevel' to hold someone's level. Note how I used 'MAX_PLAYERS char' instead of 'MAX_PLAYERS'. This decreases the array size by 4 (what it basically does is MAX_PLAYERS / 4) 4) As an addition to 3), I use {playerid} (or {i}, in this scenario) instead of [playerid] (or [i]). By using curly brackets ({}) instead of the regular ones ([]) you access a single byte instead of a whole cell. One cell uses 4 bytes. Whereas 1 byte, well, uses 1 byte. When accessing a single byte you can only use values from 0 up to 255. Since AdminLevel is, in this scenario, is 0 up to 6, I'm accessing a single byte instead of a whole cell. This saves 4 times the space it otherwise would use. |