Fixed issue where hostname could be retrieved too early if it was set in server.cfg;

thereby having an incorrect hostname if %hostname% was used in the message

Also, if the hostname cvar changes at any time before a map change occurs, then %hostname% should be replaced with the new value
This commit is contained in:
Scott Ehlert 2006-04-25 07:35:02 +00:00
parent 1f44f5f481
commit f673e641f3
2 changed files with 12 additions and 9 deletions

View File

@ -64,6 +64,11 @@ public infoMessage()
if (g_Current >= g_MessagesNum) if (g_Current >= g_MessagesNum)
g_Current = 0 g_Current = 0
new hostname[64]
get_cvar_string("hostname", hostname, 63)
replace(g_Messages[g_Current], 380, "%hostname%", hostname)
set_hudmessage(g_Values[g_Current][0], g_Values[g_Current][1], g_Values[g_Current][2], X_POS, Y_POS, 0, 0.5, HOLD_TIME, 2.0, 2.0, -1) set_hudmessage(g_Values[g_Current][0], g_Values[g_Current][1], g_Values[g_Current][2], X_POS, Y_POS, 0, 0.5, HOLD_TIME, 2.0, 2.0, -1)
show_hudmessage(0, "%s", g_Messages[g_Current]) show_hudmessage(0, "%s", g_Messages[g_Current])
client_print(0, print_console, "%s", g_Messages[g_Current]) client_print(0, print_console, "%s", g_Messages[g_Current])
@ -86,11 +91,6 @@ public setMessage()
remove_task(12345) remove_task(12345)
read_argv(1, g_Messages[g_MessagesNum], 380) read_argv(1, g_Messages[g_MessagesNum], 380)
new hostname[64]
get_cvar_string("hostname", hostname, 63)
replace(g_Messages[g_MessagesNum], 380, "%hostname%", hostname)
while (replace(g_Messages[g_MessagesNum], 380, "\n", "^n")) {} while (replace(g_Messages[g_MessagesNum], 380, "\n", "^n")) {}
new mycol[12] new mycol[12]

View File

@ -84,6 +84,13 @@ public msgInit()
g_startPos = 0 g_startPos = 0
g_xPos = 0.65 g_xPos = 0.65
new hostname[64]
get_cvar_string("hostname", hostname, 63)
replace(g_scrollMsg, SCROLLMSG_SIZE-1, "%hostname%", hostname)
g_Length = strlen(g_scrollMsg)
set_task(SPEED, "showMsg", 123, "", 0, "a", g_Length + 48) set_task(SPEED, "showMsg", 123, "", 0, "a", g_Length + 48)
client_print(0, print_console, "%s", g_scrollMsg) client_print(0, print_console, "%s", g_scrollMsg)
} }
@ -93,10 +100,6 @@ public setMessage()
remove_task(123) /* remove current messaging */ remove_task(123) /* remove current messaging */
read_argv(1, g_scrollMsg, SCROLLMSG_SIZE-1) read_argv(1, g_scrollMsg, SCROLLMSG_SIZE-1)
new hostname[64]
get_cvar_string("hostname", hostname, 63)
replace(g_scrollMsg, SCROLLMSG_SIZE-1, "%hostname%", hostname)
g_Length = strlen(g_scrollMsg) g_Length = strlen(g_scrollMsg)
new mytime[32] new mytime[32]