Veteran Member
Join Date: Sep 2009
Location: New Jersey
|
02-06-2015
, 11:39
Re: LANG string with variable
|
#5
|
Quote:
Originally Posted by Arkshine
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(szMsg, charsmax(szMsg), "%s%L (T %i:%i (%i:%i) CT).", PREFIX, LANG_SERVER, szMsgState, g_cw_rounds_alpha, g_cw_rounds_bravo, g_cw_ov_rounds_alpha, g_cw_ov_rounds_bravo) } else if(i_state > 3) { formatex(szMsg, charsmax(szMsg), "%s%L (T %i:%i CT).", PREFIX, LANG_SERVER, szMsgState, g_cw_rounds_alpha, g_cw_rounds_bravo) } else { formatex(szMsg, charsmax(szMsg), "%s%L.", PREFIX, LANG_SERVER, szMsgState) } 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(szMsg, charsmax(szMsg), "%s%L (T %i:%i (%i:%i) CT). %L", PREFIX, LANG_SERVER, szMsgState, g_cw_rounds_alpha, g_cw_rounds_bravo, g_cw_ov_rounds_alpha, g_cw_ov_rounds_bravo, LANG_SERVER, "S_LAST") } else { formatex(szMsg, charsmax(szMsg), "%s%L (T %i:%i (%i:%i) CT).", PREFIX, LANG_SERVER, szMsgState, g_cw_rounds_alpha, g_cw_rounds_bravo, g_cw_ov_rounds_alpha, g_cw_ov_rounds_bravo) } } else if(i_state > 3) { if(last_round) { formatex(szMsg, charsmax(szMsg), "%s%L (T %i:%i CT). %L", PREFIX, LANG_SERVER, szMsgState, g_cw_rounds_alpha, g_cw_rounds_bravo, LANG_SERVER, "S_LAST") } else { formatex(szMsg, charsmax(szMsg), "%s%L (T %i:%i CT).", PREFIX, LANG_SERVER, szMsgState, g_cw_rounds_alpha, g_cw_rounds_bravo) } } else { if(last_round) { formatex(szMsg, charsmax(szMsg), "%s%L. %L", PREFIX, LANG_SERVER, szMsgState, LANG_SERVER, "S_LAST") } else { formatex(szMsg, charsmax(szMsg), "%s%L.", PREFIX, LANG_SERVER, szMsgState) } }
Last edited by Phant; 02-06-2015 at 11:40.
|
|