NoSteamManager: add command sm_usertype.

This commit is contained in:
zaCade 2019-02-24 15:11:31 +01:00
parent d0e1ffab84
commit 1837af62f0

View File

@ -38,6 +38,8 @@ public void OnPluginStart()
RegConsoleCmd("sm_nosteam", Command_DisplaySteamStats, "Shows the number of Steam and No-Steam players"); RegConsoleCmd("sm_nosteam", Command_DisplaySteamStats, "Shows the number of Steam and No-Steam players");
RegConsoleCmd("sm_steam", Command_DisplaySteamStats, "Shows the number of Steam and No-Steam players"); RegConsoleCmd("sm_steam", Command_DisplaySteamStats, "Shows the number of Steam and No-Steam players");
RegAdminCmd("sm_usertype", Command_DisplayUserTypes, ADMFLAG_BAN, "Show the usertypes of Steam and No-Steam players");
AutoExecConfig(); AutoExecConfig();
Database.Connect(OnDatabaseConnect, "antispoofing"); Database.Connect(OnDatabaseConnect, "antispoofing");
@ -95,28 +97,6 @@ public Action Command_DisplaySteamStats(int client, int args)
{ {
aBuf[strlen(aBuf) - 2] = 0; aBuf[strlen(aBuf) - 2] = 0;
ReplyToCommand(client, "[SM] No-Steam clients online: %s", aBuf); ReplyToCommand(client, "[SM] No-Steam clients online: %s", aBuf);
if(CheckCommandAccess(client, "sm_rcon", ADMFLAG_RCON, false))
{
aBuf = "##################################################\n";
for(int i = 1; i <= MaxClients; i++)
{
if(IsClientInGame(i) && !IsFakeClient(i) && !RevEmu_IsPlayerSteam(i))
{
char sConnectionType[32];
RevEmu_GetPlayerType(i, sConnectionType, sizeof(sConnectionType));
Format(aBuf, sizeof(aBuf), "%s%L %s \n", aBuf, i, sConnectionType);
}
}
Format(aBuf, sizeof(aBuf), "%s##################################################", aBuf);
if(client)
{
ReplyToCommand(client, "Check Console for additional information.");
PrintToConsole(client, aBuf);
}
else
ReplyToCommand(client, aBuf);
}
} }
else else
ReplyToCommand(client, "[SM] No-Steam clients online: none"); ReplyToCommand(client, "[SM] No-Steam clients online: none");
@ -124,6 +104,46 @@ public Action Command_DisplaySteamStats(int client, int args)
return Plugin_Handled; return Plugin_Handled;
} }
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Action Command_DisplayUserTypes(int client, int args)
{
PrintToConsole(client, "# %8s %40s %24s %12s %s",
"userid", "name", "uniqueid", "type", "steam");
for(int player = 1; player <= MaxClients; player++)
{
if(!IsClientConnected(player) || IsFakeClient(player))
continue;
char sPlayerID[8];
char sPlayerName[MAX_NAME_LENGTH + 2];
char sPlayerAuth[24];
char sPlayerType[64];
char sPlayerSteam[64];
FormatEx(sPlayerID, sizeof(sPlayerID), "%d", GetClientUserId(player));
FormatEx(sPlayerName, sizeof(sPlayerName), "\"%N\"", player);
if(!GetClientAuthId(player, AuthId_Steam2, sPlayerAuth, sizeof(sPlayerAuth)))
FormatEx(sPlayerAuth, sizeof(sPlayerAuth), "STEAM_ID_PENDING");
if(!RevEmu_GetPlayerType(player, sPlayerType, sizeof(sPlayerType)))
FormatEx(sPlayerType, sizeof(sPlayerType), "Unknown");
if (RevEmu_IsPlayerSteam(player))
FormatEx(sPlayerSteam, sizeof(sPlayerSteam), "Yes");
else
FormatEx(sPlayerSteam, sizeof(sPlayerSteam), "No");
PrintToConsole(client, "# %8s %40s %24s %12s %s",
sPlayerID, sPlayerName, sPlayerAuth, sPlayerType, sPlayerSteam);
}
return Plugin_Handled;
}
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
// Purpose: // Purpose:
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------