AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved Menu malfunction (https://forums.alliedmods.net/showthread.php?t=317612)

Fuck For Fun 07-21-2019 07:54

Menu malfunction
 
Talking about the row below 1.
There is a t4shot
https://i.imgur.com/4BiIrsw.png
Code:

new g_rgLR[eLastRequest] = { GAME_NONE, 0, 0 };
I have a kind of BUG, I do not find the problem here in the code:
PHP Code:

ShowMenuS4S(this)
{
    new 
iMenuszBuffer[64], iLen;

    
formatex(szBuffercharsmax(szBuffer), "\r[4Honor`] \d- \wLR \yShot4Shot \wMenu");
    
iMenu menu_create(szBuffer"MenuS4S");

    
iLen copy(szBuffercharsmax(szBuffer), "Guard: \y");

    if (!
g_rgLR[LR_GUARD])
        
iLen += copy(szBuffer[iLen], charsmax(szBuffer) - iLen"Not yet selected");
    else
        
iLen += formatex(szBuffer[iLen], charsmax(szBuffer) - iLen"%n"g_rgLR[LR_GUARD]);

    
szBuffer[iLen] = '^n';

    
menu_additem(iMenuszBuffer);

    
formatex(szBuffercharsmax(szBuffer), "Health: \d%d"g_iHealthMAX_HEALTH);
    
menu_additem(iMenuszBuffer);

    
formatex(szBuffercharsmax(szBuffer), "Weapon: \y%s"g_szCSWeaponNames[g_iWeaponId]);
    
menu_additem(iMenuszBuffer);

    
AddMenuSettings(iMenu);

    if (!
g_rgLR[LR_GUARD])
        
copy(szBuffercharsmax(szBuffer), "\dStart");
    else
        
copy(szBuffercharsmax(szBuffer), "Start");

    
menu_additem(iMenuszBuffer);

    
menu_display(thisiMenu);



E1_531G 07-21-2019 10:42

Re: Menu malfunction
 
Those text is a part of a menu title.
Reset the buffer after formating the title. (menu_create())

Fuck For Fun 07-21-2019 12:09

Re: Menu malfunction
 
Quote:

Originally Posted by E1_531G (Post 2660033)
Those text is a part of a menu title.
Reset the buffer after formating the title. (menu_create())

Fixed, thanks

fysiks 07-21-2019 12:50

Re: Menu malfunction
 
One simple way is to set the first character as the "end of string" (EOS).

Code:

szBuffer[0] = EOS


All times are GMT -4. The time now is 17:23.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.