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

ML Menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 08-31-2011 , 10:38   ML Menu
Reply With Quote #1

I have 5 menu's and i want to make them ML (multi-language)
What is best way of doing this?
I tried something like this in every menu

Code:
public Menu1(id)
{
	new headline[30], mlexit[20], mlback[20], mlnext[20];
	formatex(headline, charsmax(headline), "%L", id, "ML_HEADMENU")
	formatex(mlexit, charsmax(mlexit), "%L", id, "ML_MENUEXIT")
	formatex(mlback, charsmax(mlback), "%L", id, "ML_MENUBACK")
	formatex(mlnext, charsmax(mlnext), "%L", id, "ML_MENUNEXT")
	
	new menu = menu_create(headline, "Menu1_Handle");
	menu_additem(menu, "TRALALALALALAL");
	//etc

	menu_setprop(menu, MPROP_EXITNAME, mlexit);
	menu_setprop(menu, MPROP_BACKNAME, mlback);
	menu_setprop(menu, MPROP_NEXTNAME, mlnext);
	menu_display(id, menu);
}
but could i do this only once for all five menu's?
Code:
	new headline[30], mlexit[20], mlback[20], mlnext[20];
	formatex(headline, charsmax(headline), "%L", id, "ML_HEADMENU")
	formatex(mlexit, charsmax(mlexit), "%L", id, "ML_MENUEXIT")
	formatex(mlback, charsmax(mlback), "%L", id, "ML_MENUBACK")
	formatex(mlnext, charsmax(mlnext), "%L", id, "ML_MENUNEXT")
OvidiuS is offline
Send a message via Skype™ to OvidiuS
The Inhabitant Of Heavens
Member
Join Date: Aug 2011
Old 08-31-2011 , 11:01   Re: ML Menu
Reply With Quote #2

Use old system of the menu:

PHP Code:
#include <amxmodx>
#include <amxmisc>


#define PLUGIN_NAME                "x"
#define PLUGIN_VERSION            "x"
#define PLUGIN_AUTHOR            "x"



const KEYSMENU =                 MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_6|MENU_KEY_7|MENU_KEY_8|MENU_KEY_9|MENU_KEY_0


public plugin_init ( ) {

    
register_plugin PLUGIN_NAME PLUGIN_VERSION PLUGIN_AUTHOR )

    
register_dictionary("lang_menu.txt");
    
    
register_clcmd("menu""clcmd_saymenu")
    
register_menu("Game Menu"KEYSMENU"menu_game")


}
    
public 
clcmd_saymenu id 
    
show_menu_game id // show game menu

// Game Menu
show_menu_game id ) {

    
// Player disconnected?
    
if ( ! is_user_connected id )  )
        return;
    
    static 
menu 512 ] , len
    len 
0
    
    
// Title
    
len += formatex(menu[len], charsmax(menu) - len"\r%L^n"id,"MENU_TITLE")
    
    
// 1. 
    
len += formatex(menu[len], charsmax(menu) - len"\r1.\y %L^n"id,"MENU_1")
    
// 2. 
    
len += formatex(menu[len], charsmax(menu) - len"\r2.\w %L^n"id"MENU_2")
    
    
// 0. Exit
    
len += formatex(menu[len], charsmax(menu) - len"^n^n\r0.\w %L"id"MENU_EXIT")
    

    
show_menu(idKEYSMENUmenu, -1"Game Menu")
}

// Game Menu
public menu_game id key ) {

    
// Player disconnected?
    
if ( ! is_user_connected id )  )
        return 
PLUGIN_HANDLED;
    
    switch ( 
key )
    {

        case 
0client_print(idprint_chat"%L"id,"PRINT_TEXT_1")
        case 
1client_print(idprint_chat"%L"id,"PRINT_TEXT_2")
    }
    
    return 
PLUGIN_HANDLED;

The Inhabitant Of Heavens is offline
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 08-31-2011 , 11:05   Re: ML Menu
Reply With Quote #3

that doesn't help me, i have 5 pages in one menu
you still dont use
Code:
	menu_setprop(menu, MPROP_BACKNAME, mlback);
	menu_setprop(menu, MPROP_NEXTNAME, mlnext);

Last edited by OvidiuS; 08-31-2011 at 11:09.
OvidiuS is offline
Send a message via Skype™ to OvidiuS
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-31-2011 , 11:20   Re: ML Menu
Reply With Quote #4

You would have to format the item into a string using the ML key and the player's id.
Then you use that string in menu_additem(), similar to how you did the next/back/exit names.

Also, you can't do it just once because not all players have the same language, and players can change their language.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 08-31-2011 , 11:40   Re: ML Menu
Reply With Quote #5

Quote:
Originally Posted by Exolent[jNr] View Post
You would have to format the item into a string using the ML key and the player's id.
Then you use that string in menu_additem(), similar to how you did the next/back/exit names.
I don't understand, my english isn't best, but you are saying that code i posted is currently best method? :S

edit: i already translated item names, everything is working, curent problem is exit/next/back button and menu tittle
all five menus have the same ML_MENUNEXT, ML_MENUEXIT..etc, and i was thinking only to format it once for all five menus, not to format same ML in every menu

Last edited by OvidiuS; 08-31-2011 at 12:01. Reason: first post code
OvidiuS is offline
Send a message via Skype™ to OvidiuS
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-31-2011 , 11:47   Re: ML Menu
Reply With Quote #6

Yes, you have to format it every time like you already are doing.

Quote:
Originally Posted by Exolent[jNr] View Post
you can't do it just once because not all players have the same language, and players can change their language.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] 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 19:19.


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