Raised This Month: $51 Target: $400
 12% 

Solved Formatex menu dont show ingame


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
The overrated maniac
Member
Join Date: Jun 2021
Location: Argentina
Old 06-12-2021 , 09:23   Formatex menu dont show ingame
Reply With Quote #1

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?

Last edited by The overrated maniac; 06-13-2021 at 03:55.
The overrated maniac is offline
Crackhead69
Member
Join Date: Feb 2021
Old 06-12-2021 , 10:19   Re: Formatex menu dont show ingame
Reply With Quote #2

Can't display a menu without --- menu_display
Crackhead69 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-12-2021 , 10:30   Re: Formatex menu dont show ingame
Reply With Quote #3

  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.
__________________
Bugsy is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 13:33.


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