nextmap.sma - Fix mp_chattime getting increased on quick map change (#1044)

This commit is contained in:
rtxa 2022-07-01 03:16:05 -03:00 committed by GitHub
parent fde732f66d
commit df6b589ba1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,6 +22,7 @@ new g_nextMap[32]
new g_mapCycle[32] new g_mapCycle[32]
new g_pos new g_pos
new g_currentMap[32] new g_currentMap[32]
new g_changeMapCalled;
// pcvars // pcvars
new g_mp_friendlyfire, g_mp_chattime new g_mp_friendlyfire, g_mp_chattime
@ -94,10 +95,14 @@ public sayFFStatus()
public delayedChange(param[]) public delayedChange(param[])
{ {
if (g_mp_chattime) { engine_changelevel(param)
}
public plugin_end()
{
if (g_mp_chattime && g_changeMapCalled) {
set_pcvar_float(g_mp_chattime, get_pcvar_float(g_mp_chattime) - 2.0) set_pcvar_float(g_mp_chattime, get_pcvar_float(g_mp_chattime) - 2.0)
} }
engine_changelevel(param)
} }
public changeMap() public changeMap()
@ -107,6 +112,7 @@ public changeMap()
if (g_mp_chattime) { if (g_mp_chattime) {
set_pcvar_float(g_mp_chattime, chattime + 2.0) // make sure mp_chattime is long set_pcvar_float(g_mp_chattime, chattime + 2.0) // make sure mp_chattime is long
g_changeMapCalled = true;
} }
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