mirror of
https://github.com/Jackzmc/sourcemod-plugins.git
synced 2025-05-06 03:03:21 +00:00
l4d2_swarm: Turn off toggle on map start / targetted disconnect
This commit is contained in:
parent
476e2ae68f
commit
e4e8801179
2 changed files with 20 additions and 0 deletions
Binary file not shown.
|
@ -54,6 +54,25 @@ public void OnPluginStart()
|
||||||
HookEvent("triggered_car_alarm", Event_CarAlarm);
|
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) {
|
public Action Cmd_Swarm(int client, int args) {
|
||||||
if(args == 0) {
|
if(args == 0) {
|
||||||
SwarmUser(-1, hSwarmDefaultRange.IntValue);
|
SwarmUser(-1, hSwarmDefaultRange.IntValue);
|
||||||
|
@ -104,6 +123,7 @@ public Action Cmd_SwarmToggle(int client, int args) {
|
||||||
SwarmRadius = hSwarmDefaultRange.IntValue;
|
SwarmRadius = hSwarmDefaultRange.IntValue;
|
||||||
ReplyToCommand(client, "Deactivated swarm toggle.");
|
ReplyToCommand(client, "Deactivated swarm toggle.");
|
||||||
CloseHandle(timer);
|
CloseHandle(timer);
|
||||||
|
timer = INVALID_HANDLE;
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue