Fix nextmap plugin failing in game where mp_chattime cvar doesn't exist (bug 5922, r=arkshine)

This commit is contained in:
DynamicBits 2014-03-20 19:05:41 +01:00
parent 33cdfa644e
commit 64327b8ddb

View File

@ -115,16 +115,20 @@ public sayFFStatus()
public delayedChange(param[]) public delayedChange(param[])
{ {
set_pcvar_float(g_mp_chattime, get_pcvar_float(g_mp_chattime) - 2.0) if (g_mp_chattime) {
set_pcvar_float(g_mp_chattime, get_pcvar_float(g_mp_chattime) - 2.0)
}
server_cmd("changelevel %s", param) server_cmd("changelevel %s", param)
} }
public changeMap() public changeMap()
{ {
new string[32] new string[32]
new Float:chattime = get_pcvar_float(g_mp_chattime) new Float:chattime = g_mp_chattime ? get_pcvar_float(g_mp_chattime) : 10.0; // mp_chattime defaults to 10 in other mods
set_pcvar_float(g_mp_chattime, chattime + 2.0) // make sure mp_chattime is long if (g_mp_chattime) {
set_pcvar_float(g_mp_chattime, chattime + 2.0) // make sure mp_chattime is long
}
new len = getNextMapName(string, charsmax(string)) + 1 new len = getNextMapName(string, charsmax(string)) + 1
set_task(chattime, "delayedChange", 0, string, len) // change with 1.5 sec. delay set_task(chattime, "delayedChange", 0, string, len) // change with 1.5 sec. delay
} }