Thread: [Solved] FormatPlayerMenu()
View Single Post
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 04-12-2020 , 08:57   Re: FormatPlayerMenu()
Reply With Quote #4

Quote:
Originally Posted by OciXCrom View Post
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(szTempcharsmax(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(iFilePointerszLinecharsmax(szText))) {
        
trim(szLine);

        if(
szLine[0] == EOS || szLine[0] == ';') {
            continue;
        }

        
split(szLineszColorcharsmax(szColor), szLinecharsmax(szLine), " ");
        
remove_quotes(szColor);
        
format(szTextcharsmax(szText), "%s"szColor);
        
add(szLinecharsmax(szLine), szColor);

        
menu_additem(iColorMenuszTextszLine);
        
log_amx("Color: %s - RGB: %i"szTextszLine);
    }
    
fclose(iFilePointer);

__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be