Open CanadianJeff opened 3 years ago
If youd like to add this feature to your own, add an IsFakeClient(client)
check after line 125 of sourceirc-relayall and also on line 137 of Event_PlayerDisconnect
if (userid <= g_userid) // Ugly hack to get around mass connects on map change
return;
g_userid = userid;
if (IsFakeClient(client))
return;
decl String:playername[MAX_NAME_LENGTH], String:result[IRC_MAXLEN];
GetClientName(client, playername, sizeof(playername));
new userid = GetEventInt(event, "userid");
new client = GetClientOfUserId(userid);
if (client != 0 && !IsFakeClient(client)) {
public void OnClientAuthorized(client, const String:auth[]) { // We are hooking this instead of the player_connect event as we want the steamid
if (IsFakeClient(client)) return; // Please dont spam about bots
new userid = GetClientUserId(client);
if (userid <= g_userid) // Ugly hack to get around mass connects on map change
return;
g_userid = userid;
decl String:playername[MAX_NAME_LENGTH], String:result[IRC_MAXLEN];
GetClientName(client, playername, sizeof(playername));
Format(result, sizeof(result), "%t", "Player Connected", playername, auth, userid);
if (result[0] != '\0')
IRC_MsgFlaggedChannels("relay", "%s", result);
}
public Action:Event_PlayerDisconnect(Handle:event, const String:name[], bool:dontBroadcast)
{
if (!GetConVarBool(g_cvHideDisconnect)) {
new userid = GetEventInt(event, "userid");
new client = GetClientOfUserId(userid);
if (client != 0) {
if (IsFakeClient(client)) return; // Please dont spam about bots
decl String:reason[128], String:playername[MAX_NAME_LENGTH], String:auth[64], String:result[IRC_MAXLEN];
GetEventString(event, "reason", reason, sizeof(reason));
GetClientName(client, playername, sizeof(playername));
GetClientAuthString(client, auth, sizeof(auth));
for (new i = 0; i <= strlen(reason); i++) { // For some reason, certain disconnect reasons have \n in them, so i'm stripping them. Silly valve.
if (reason[i] == '\n')
RemoveChar(reason, sizeof(reason), i);
}
Format(result, sizeof(result), "%t", "Player Disconnected", playername, auth, userid, reason);
if (result[0] != '\0')
IRC_MsgFlaggedChannels("relay", "%s", result);
}
}
}
That works. If I were to add this feature, it would come with a convar for toggling. Will leave this issue open in the mean time.
A PR that adds it as a convar would be appreciated :)
otherwise flooded with crap like....