View Single Post
Author Message
Phant
Veteran Member
Join Date: Sep 2009
Location: New Jersey
Old 01-04-2015 , 22:12   LANG string with variable
Reply With Quote #1

Hello. Right now I have this dumb code:
PHP Code:
    switch(i_state)
    {
        case 
0:
        {
            
client_print(idprint_chat"%s%L"PREFIXLANG_SERVER"S_0")
        }
        case 
1:
        {
            
client_print(idprint_chat"%s%L"PREFIXLANG_SERVER"S_1")
        }
        case 
2:
        {
            
client_print(idprint_chat"%s%L"PREFIXLANG_SERVER"S_2")
        }
        case 
3:
        {
            
client_print(idprint_chat"%s%L"PREFIXLANG_SERVER"S_3")
        }
        case 
4:
        {
            
client_print(idprint_chat"%s%L"PREFIXLANG_SERVER"S_4")
        }
        case 
5:
        {
            
client_print(idprint_chat"%s%L"PREFIXLANG_SERVER"S_5")
        }
    } 
How I can simplify it? I try:
PHP Code:
    new state_str[32]
    
num_to_str(i_statestate_strcharsmax(state_str))
    
client_print(idprint_chat"%s%L"PREFIXLANG_SERVER"S_%s"state_str
But I got:

(ofcousre "S_0" exist in language file of plugin)

Last edited by Phant; 01-04-2015 at 22:13.
Phant is offline
Send a message via ICQ to Phant