AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved Formatex menu dont show ingame (https://forums.alliedmods.net/showthread.php?t=332981)

The overrated maniac 06-12-2021 09:23

Formatex menu dont show ingame
 
PHP Code:

public menu_stats(id){

static 
statsMenu[100]

formatex(statsMenucharsmax(statsMenu), "\wAccount stats");
new 
oMenu menu_create(statsMenu"handler_statsMenu" );

formatex(statsMenu,charsmax(statsMenu),"\wNick: \y")
menu_additem(oMenustatsMenu,"0"); 
formatex(statsMenu,charsmax(statsMenu),"\wPassword: \y")
menu_additem(oMenustatsMenu,"1"); 
formatex(statsMenu,charsmax(statsMenu),"\wLifes: \y%d",g_lifes[id])
menu_additem(oMenustatsMenu,"2"); 
formatex(statsMenu,charsmax(statsMenu),"\wFrags: \y%d",g_frags[id])
menu_additem(oMenustatsMenu,"3"); 
formatex(statsMenu,charsmax(statsMenu),"\wKills: \y%d",g_kills[id])
menu_additem(oMenustatsMenu,"4"); 


public 
handler_statsMenu(idmenu_statsitem){
    switch(
item){
        case 
MENU_EXIT: {
            
menu_destroy(menu_stats);
            
Main_menu(id);
        }
    }


It compile and ingame it enters the function because I try a print_chat, I dont know why it dosnt show, what I'm doing bad?

Crackhead69 06-12-2021 10:19

Re: Formatex menu dont show ingame
 
Can't display a menu without --- menu_display

Bugsy 06-12-2021 10:30

Re: Formatex menu dont show ingame
 
  1. If you're not formatting a string (copying variable values into the output string) and only need static text copied to a variable, use copy() instead of formatex().
  2. There's no need to move the first 2 menu items to a string, pass them directly to menu_additem():
    PHP Code:

    menu_additem(oMenu"\wNick: \y","0"); 
    menu_additem(oMenu"\wPassword: \y","1"); 

  3. I don't think a static variable is necessary here, use new instead.


All times are GMT -4. The time now is 02:31.

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