|
Junior Member
Join Date: Apr 2023
Location: warga Bogor
|
11-15-2024
, 08:14
Re: [L4D1 AND L4D2] Cannounce Player Info
|
#11
|
Quote:
Originally Posted by Slaven555
try:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <geoip>
#pragma newdecls required
public void OnPluginStart()
{
HookEvent("player_disconnect", event_PlayerDisconnect, EventHookMode_Pre);
}
public void OnClientPutInServer(int client)
{
if (!IsFakeClient(client))
{
char IP[99], Country[99];
GetClientIP(client, IP, sizeof(IP), true);
if (!GeoipCountry(IP, Country, sizeof Country))
{
Country = "Unknown Region";
}
if (CheckCommandAccess(client, "sm_admin", ADMFLAG_GENERIC, true))
return;
PrintToChatAll("\x01Player: \x04%N \x01connected from (\x03%s\x01)", client, Country);
}
}
public Action event_PlayerDisconnect(Event event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(event.GetInt("userid"));
if (client && !IsFakeClient(client))
{
char reason[70];
event.GetString("reason", reason, sizeof(reason));
{
PrintToChatAll("\x01Player: \x04%N \x01-> \x05%s", client, reason);
}
}
return Plugin_Stop;
}
|
huge thanks Slaven555, this works
|
|
|
|