Last active
September 26, 2021 02:00
-
-
Save nagadomi/8395743 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Left 4 Dead 2 Panic Events */ | |
#include <sourcemod> | |
public OnPluginStart() | |
{ | |
/* Hook Panic Create event after it has happened */ | |
HookEvent("create_panic_event", OnPanicCreate); | |
/* Hook Left Player event after it has happened */ | |
HookEvent("player_left_start_area", OnPlayerLeftStartArea); | |
} | |
public Action:OnPanicCreate(Handle:event, const String:name[], bool:dontBroadcast) | |
{ | |
/* Copy the UserID from the event over */ | |
new uId = GetEventInt(event, "userid"); | |
/* Now get the person's name */ | |
new client = GetClientOfUserId(uId); | |
if (client > 0 && IsClientInGame(client)) { | |
new String:cName[MAX_NAME_LENGTH]; | |
GetClientName(client, cName, sizeof(cName)); | |
/* Now tell everyone who created the event */ | |
PrintToChatAll("\x03[Panic Event]\x01 %s created a panic event!", cName); | |
} | |
} | |
public Action:OnPlayerLeftStartArea(Handle:event, const String:name[], bool:dontBroadcast) | |
{ | |
/* Copy the UserID from the event over */ | |
new uId = GetEventInt(event, "userid"); | |
/* Now get the person's name */ | |
new client = GetClientOfUserId(uId); | |
if (client > 0 && IsClientInGame(client)) { | |
new String:cName[MAX_NAME_LENGTH]; | |
GetClientName(client, cName, sizeof(cName)); | |
/* Now tell everyone who created the event */ | |
PrintToChatAll("\x03[Panic Event]\x01 %s was the first one out of the safe area!", cName); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment