View Single Post
replay_84
Senior Member
Join Date: Jun 2021
Old 12-06-2022 , 12:18   Re: [L4D2] Who called the horde?
Reply With Quote #20

Quote:
Originally Posted by Silvers View Post
Replace IsClientConnected with IsClientInGame

Seems like I still get an error



L 12/06/2022 - 15:138: [SM] Exception reported: Client index 0 is invalid
L 12/06/2022 - 15:138: [SM] Blaming: panic_fixed.smx



Quote:


#include <sourcemod>

public OnPluginStart()
{
/* Hook Panic Create event after it has happened */
HookEvent("create_panic_event", OnPanicCreate);
}

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);
new String:cName[ MAX_NAME_LENGTH ];
GetClientName(client, cName, sizeof(cName));

PrintToChatAll("\x05%s \x01has started the panic event!", cName);
}
replay_84 is offline