l4d2_autobotcrown Fix ResetAutoCrown() failure

This commit is contained in:
Jackzie 2021-01-12 21:49:04 -06:00
parent 010c0c9d4f
commit a5fa49b43a
No known key found for this signature in database
GPG key ID: 1E834FE36520537A
2 changed files with 4 additions and 4 deletions

Binary file not shown.

View file

@ -86,7 +86,7 @@ public void Event_DifficultyChanged(Event event, const char[] name, bool dontBro
event.GetString("newDifficulty", diff, sizeof(diff)); event.GetString("newDifficulty", diff, sizeof(diff));
currentDifficulty = GetDifficultyInt(diff); currentDifficulty = GetDifficultyInt(diff);
if(hAllowedGamemodes.IntValue & currentDifficulty > 0) { if(hAllowedGamemodes.IntValue & currentDifficulty > 0) {
if(timer == INVALID_HANDLE) { if(timer == INVALID_HANDLE && AutoCrownBot == -1) {
timer = CreateTimer(SCAN_INTERVAL, Timer_Scan, _, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE); timer = CreateTimer(SCAN_INTERVAL, Timer_Scan, _, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
} }
}else{ }else{
@ -110,7 +110,7 @@ public Action Event_WitchSpawn(Event event, const char[] name, bool dontBroadcas
#if defined DEBUG #if defined DEBUG
PrintToServer("Witch spawned: %d", witchID); PrintToServer("Witch spawned: %d", witchID);
#endif #endif
if(timer == INVALID_HANDLE) { if(timer == INVALID_HANDLE && AutoCrownBot == -1) {
timer = CreateTimer(SCAN_INTERVAL, Timer_Scan, _, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE); timer = CreateTimer(SCAN_INTERVAL, Timer_Scan, _, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
} }
} }
@ -214,7 +214,7 @@ public Action Timer_Scan(Handle hdl) {
AutoCrownBot = GetClientUserId(bot); AutoCrownBot = GetClientUserId(bot);
AutoCrownInPosition = false; AutoCrownInPosition = false;
CreateTimer(ACTIVE_INTERVAL, Timer_Active, _, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE); CreateTimer(ACTIVE_INTERVAL, Timer_Active, _, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
return Plugin_Continue; return Plugin_Stop;
} }
} }
} }
@ -242,7 +242,7 @@ public void ResetAutoCrown() {
AutoCrownTarget = -1; AutoCrownTarget = -1;
AutoCrownInPosition = false; AutoCrownInPosition = false;
if(AutoCrownBot > -1) if(AutoCrownBot > -1)
L4D2_RunScript("CommandABot({cmd=3,bot=GetPlayerFromUserID(%i)})", GetClientUserId(AutoCrownBot)); L4D2_RunScript("CommandABot({cmd=3,bot=GetPlayerFromUserID(%i)})", AutoCrownBot);
AutoCrownBot = -1; AutoCrownBot = -1;
} }