Quote:
Originally Posted by OciXCrom
That's not really valid. You're creating the "szTemp" variable in one function and trying to use it in another. The code won't even compile under AMXX < 1.8.3. There's no need for the "CreateTempArray()" function, simply register the variable directly in "FormatPlayerMenu()" if "AMXX_VERSION_NUM < 183".
"LANG_PLAYER" is not valid here. This is used when sending a message to all players and when the function it's used in contains a client index (e.g. "client_print"). You need to use "id" instead of "LANG_PLAYER".
The max name length is 32, not 33.
Code:
formatex(szUserId, charsmax(szUserId), "%d", get_user_userid(iPlayers[i]));
num_to_str()?
|
Then how should i format my menu's here?
PHP Code:
ReadFile() {
#if AMXX_VERSION_NUM < 183
formatex(szTemp, charsmax(szTemp), "%L", LANG_PLAYER, "MENU_CHOOSE_COLOR");
iColorMenu = menu_create(szTemp, "ColorMenuHandler");
#else
iColorMenu = menu_create(fmt("%L", LANG_PLAYER, "MENU_CHOOSE_COLOR"), "ColorMenuHandler");
#endif
new iFilePointer = fopen("addons/amxmodx/configs/GlowMenu.txt", "rt");
new szLine[64], szText[32], szColor[16];
while(fgets(iFilePointer, szLine, charsmax(szText))) {
trim(szLine);
if(szLine[0] == EOS || szLine[0] == ';') {
continue;
}
split(szLine, szColor, charsmax(szColor), szLine, charsmax(szLine), " ");
remove_quotes(szColor);
format(szText, charsmax(szText), "%s", szColor);
add(szLine, charsmax(szLine), szColor);
menu_additem(iColorMenu, szText, szLine);
log_amx("Color: %s - RGB: %i", szText, szLine);
}
fclose(iFilePointer);
}
__________________