Quote:
Originally Posted by Lolz0r
Maybe could do with cvar?
|
Done, check code above
Quote:
Originally Posted by Exolent[jNr]
PHP Code:
static szPlayers[20];
if(!szPlayers[0])
#if Hide_Option == 0
copy(szPlayers, charsmax(szPlayers), "All players");
#endif
#if Hide_Option == 1
copy(szPlayers, charsmax(szPlayers), "Teammates");
#endif
#if Hide_Option == 2
copy(szPlayers, charsmax(szPlayers), "Enemy players");
#endif
1. There's no point in making it static inside of a command handler since it isn't called often enough to need that.
2. You can just declare it as a constant (whether static or not) to save a native call.
Code:
#if Hide_Option == 1
new const szPlayers[] = "Teammates";
#else
#if Hide_Option == 2
new const szPlayers[] = "Enemy players";
#else
new const szPlayers[] = "All players";
#endif // Hide_Option == 2
#endif // Hide_Option == 1
|
I made it static because it wasn't gonna change once it was assigned.
I wasn't sure if it would compile making new const szPlayers[] when the define is changed, that's why i did it that way.
Good to know it works like that.
__________________