AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [SOLVED]menu multi lang. problem (https://forums.alliedmods.net/showthread.php?t=117898)

One 02-05-2010 22:04

[SOLVED]menu multi lang. problem
 
hi,

i wanted to make my welcome menu ML and i get following errors :

Code:

L 02/06/2010 - 04:00:28: String formatted incorrectly - parameter 4 (total 4)
what i did :

Code:

new menuText[512]
    new len = formatex(menuText,511,"\rJailmod Freeday Manager \d1.0.2b by \rOne^n")

---->
Code:

new menuText[512]
    new len = formatex(menuText,511,"%L","MENU_1")

in ML dictionary/File :

Code:

MENU_1 = \rJailmod Freeday Manager \d1.0.2b by \rOne^n
PS. do i have better replace \r , \w and ^n ? or i can let the texts so ?

sorry but its my first time with ML

fysiks 02-05-2010 22:07

Re: menu multi lang. problem
 
Quote:

Originally Posted by One (Post 1079986)
PS. do i have better replace \r , \w and ^n ? or i can let the texts so ?

Remove them and see if it helps. It's called debugging.

One 02-05-2010 22:09

Re: menu multi lang. problem
 
the same :(

without \r or \d or ^n is the same like with..

Emp` 02-05-2010 23:53

Re: menu multi lang. problem
 
Quote:

Originally Posted by fysiks (Post 1079987)
Remove them and see if it helps. It's called debugging.

You should have seen this...


@ One: when using ML formatting, you need to include an id for the language. Before the ML key ("MENU_1") you can either specify a player id or LANG_SERVER. (for some other natives you can use LANG_PLAYER, eg. client_print)

So your code should either be:
Code:

new len = formatex(menuText,511,"%L",LANG_SERVER,"MENU_1")
or:
Code:

new len = formatex(menuText,511,"%L",id,"MENU_1")

fysiks 02-05-2010 23:56

Re: menu multi lang. problem
 
Quote:

Originally Posted by Emp` (Post 1080032)
You should have seen this...

Maybe, but I've not used ML all that much :). I guess I was just trying to get him to learn for himself.

@One, before posting go back and read a simple tutorial and you probably would have got it working on your own.

One 02-06-2010 08:32

Re: menu multi lang. problem
 
yay :P ty @ both :P

its working now :P

for other when anyone needs the right code :

PHP Code:

public show_welcome(id)
{
    if(
get_pcvar_num(g_welcome_menu))
    {
        if(
g_welcomed[id]) 
        {
            return
        }
        
        new 
menuidkeys
        get_user_menu
(id,menuid,keys)
    
        if(
menuid 0)
        {
            
set_task(3.0,"show_welcome",id)
            return;
        }
        new 
menuText[512];
        new 
len formatex(menuText,511,"%L",id,"MENU_1")
        
len += formatex(menuText[len],511-len,"%L",id,"MENU_2")
        if(
get_pcvar_num(g_free_vote))
        {
            
len += formatex(menuText[len],511-len,"%L",id,"MENU_3")
        }
        else
        {
            
len += formatex(menuText[len],511-len,"%L",id,"MENU_4")
        }
        
        if(
get_pcvar_num(g_vip_admin))
        {
            
len += formatex(menuText[len],511-len,"%L",id,"MENU_5")
        }
        else
        {
            
len += formatex(menuText[len],511-len,"%L",id,"MENU_6")
        }
        if(
get_pcvar_num(g_show_votes))
        {
            
len += formatex(menuText[len],511-len,"%L",id,"MENU_7")
        }
        else
        {
            
len += formatex(menuText[len],511-len,"%L",id,"MENU_8")
        }
        if(
get_pcvar_num(g_leach_cvar))
        {
            
len += formatex(menuText[len],511-len,"%L",id,"MENU_9")
        }
        else
        {
            
len += formatex(menuText[len],511-len,"%L",id,"MENU_10")
        }
        if(
get_pcvar_num(g_free_vote))
        {
            
len += formatex(menuText[len],511-len,"%L",id,"MENU_11",get_pcvar_num(g_vote_round_number))
        }
        
len += formatex(menuText[len],511-len,"%L",id,"MENU_12")
        
len += formatex(menuText[len],511-len,"%L",id,"MENU_13")
        
len += formatex(menuText[len],511-len,"%L",id,"MENU_14")
        
len += formatex(menuText[len],511-len,"%L",id,"MENU_15")
        
len += formatex(menuText[len],511-len,"%L",id,"MENU_16")
        
        
show_menu(id,1023,menuText,-1,"welcome_menu")
    }




All times are GMT -4. The time now is 07:22.

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