l4d2_swarm: Turn off toggle on map start / targetted disconnect

This commit is contained in:
Jackzie 2020-12-24 17:19:54 -06:00
parent 476e2ae68f
commit e4e8801179
No known key found for this signature in database
GPG key ID: 1E834FE36520537A
2 changed files with 20 additions and 0 deletions

Binary file not shown.

View file

@ -54,6 +54,25 @@ public void OnPluginStart()
HookEvent("triggered_car_alarm", Event_CarAlarm);
}
public void OnMapStart() {
SwarmTarget = -1;
SwarmRadius = hSwarmDefaultRange.IntValue;
CloseHandle(timer);
timer = INVALID_HANDLE;
}
public void OnClientDisconnect(int client) {
if(SwarmTarget != -1 || timer != INVALID_HANDLE) {
int userid = GetClientUserId(client);
if(userid == SwarmTarget) {
SwarmTarget = -1;
SwarmRadius = hSwarmDefaultRange.IntValue;
CloseHandle(timer);
timer = INVALID_HANDLE;
}
}
}
public Action Cmd_Swarm(int client, int args) {
if(args == 0) {
SwarmUser(-1, hSwarmDefaultRange.IntValue);
@ -104,6 +123,7 @@ public Action Cmd_SwarmToggle(int client, int args) {
SwarmRadius = hSwarmDefaultRange.IntValue;
ReplyToCommand(client, "Deactivated swarm toggle.");
CloseHandle(timer);
timer = INVALID_HANDLE;
return Plugin_Handled;
}