View Single Post
Phant
Veteran Member
Join Date: Sep 2009
Location: New Jersey
Old 02-06-2015 , 11:39   Re: LANG string with variable
Reply With Quote #5

Quote:
Originally Posted by Arkshine View Post
Use format or formatex to ... format a string.
I use it and want add text at end after all:
PHP Code:
    new szMsg[192]
    if(
i_state 7)
    {
        
formatex(szMsgcharsmax(szMsg), "%s%L (T %i:%i (%i:%i) CT)."PREFIXLANG_SERVERszMsgStateg_cw_rounds_alphag_cw_rounds_bravog_cw_ov_rounds_alphag_cw_ov_rounds_bravo)
    } else if(
i_state 3) {
        
formatex(szMsgcharsmax(szMsg), "%s%L (T %i:%i CT)."PREFIXLANG_SERVERszMsgStateg_cw_rounds_alphag_cw_rounds_bravo)
    } else {
        
formatex(szMsgcharsmax(szMsg), "%s%L."PREFIXLANG_SERVERszMsgState)
    }
    
    if(
last_round)
    {
        
// HOW?
        //add(szMsg, charsmax(szMsg), "%L", LANG_SERVER, "S_LAST")
    

I do not want to do like that (add more if/else's):
PHP Code:
    new szMsg[192]
    if(
i_state 7)
    {
        if(
last_round)
        {
            
formatex(szMsgcharsmax(szMsg), "%s%L (T %i:%i (%i:%i) CT). %L"PREFIXLANG_SERVERszMsgStateg_cw_rounds_alphag_cw_rounds_bravog_cw_ov_rounds_alphag_cw_ov_rounds_bravoLANG_SERVER"S_LAST")
        } else {
            
formatex(szMsgcharsmax(szMsg), "%s%L (T %i:%i (%i:%i) CT)."PREFIXLANG_SERVERszMsgStateg_cw_rounds_alphag_cw_rounds_bravog_cw_ov_rounds_alphag_cw_ov_rounds_bravo)
        }
    } else if(
i_state 3) {
        if(
last_round)
        {
            
formatex(szMsgcharsmax(szMsg), "%s%L (T %i:%i CT). %L"PREFIXLANG_SERVERszMsgStateg_cw_rounds_alphag_cw_rounds_bravoLANG_SERVER"S_LAST")
        } else {
            
formatex(szMsgcharsmax(szMsg), "%s%L (T %i:%i CT)."PREFIXLANG_SERVERszMsgStateg_cw_rounds_alphag_cw_rounds_bravo)
        }
    } else {
        if(
last_round)
        {
            
formatex(szMsgcharsmax(szMsg), "%s%L. %L"PREFIXLANG_SERVERszMsgStateLANG_SERVER"S_LAST")
        } else {
            
formatex(szMsgcharsmax(szMsg), "%s%L."PREFIXLANG_SERVERszMsgState)
        }
    } 

Last edited by Phant; 02-06-2015 at 11:40.
Phant is offline
Send a message via ICQ to Phant