I'm attempting to intercept the connection attempt and subsequent rejection messages a user receives when banned. For example, as seen in console when the player is rejected:
12.345.67.890:12345/steamID/Username Rejecting connection - You are banned from this server (reason text)I assumed the CanUserLogin hook would capture and/or control this rejection, but after testing, it is apparent that it does not fire at all on said event. I had written the following segment in an attempt to intercept and relay the rejection to a log file (some irrelevant bits have been omitted) but was not successful:
bool IsPlayerBannedFromServer(ulong steamID)
{
ServerUsers.User user = ServerUsers.Get(steamID);
return user != null && user.group == ServerUsers.UserGroup.Banned;
}
object CanUserLogin(string _player_name, string _player_id, string _player_ip)
{
ulong convertedSteamID = Convert.ToUInt64(_player_id);
if (IsPlayerBannedFromServer(convertedSteamID))
{
ServerUsers.User banned = ServerUsers.Get(convertedSteamID);
string _player_reason = banned.notes;
// Connection Rejected
var dict = new Dictionary<string, string>
{
{ "playername", _player_name },
{ "playerip", _player_ip },
{ "playersteamid", _player_id },
{ "playerreason", _player_reason }
};
// Do some stuff with the info
}
return null;
}Anyone willing to help write a quick plugin that will do this? or better yet, guide me in the right direction as to which hook can see these rejections?
Thank you for your time and consideration. I really appreciate it.