PlayerManager: add sm_auth

This commit is contained in:
Dogan 2019-10-22 17:48:08 +02:00
parent 60e62a9e69
commit ed4a5595d2

View File

@ -46,6 +46,8 @@ public APLRes AskPluginLoad2(Handle hMyself, bool bLate, char[] sError, int erro
//----------------------------------------------------------------------------------------------------
public void OnPluginStart()
{
LoadTranslations("common.phrases");
g_hCvar_BlockSpoof = CreateConVar("sm_manager_block_spoof", "1", "Kick unauthenticated people that join with known steamids.", FCVAR_NONE, true, 0.0, true, 1.0);
g_hCvar_BlockAdmin = CreateConVar("sm_manager_block_admin", "1", "Should unauthenticated people be blocked from admin?", FCVAR_NONE, true, 0.0, true, 1.0);
g_hCvar_BlockVoice = CreateConVar("sm_manager_block_voice", "1", "Should unauthenticated people be blocked from voice?", FCVAR_NONE, true, 0.0, true, 1.0);
@ -55,6 +57,7 @@ public void OnPluginStart()
RegConsoleCmd("sm_steam", 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");
RegAdminCmd("sm_auth", Command_GetAuth, ADMFLAG_GENERIC, "Retreives the Steam ID of a player");
AutoExecConfig();
}
@ -79,6 +82,33 @@ public void OnPluginEnd()
RemoveMultiTargetFilter("@nosteam", Filter_NoSteam);
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Action Command_GetAuth(int client, int args)
{
if(args < 1)
{
ReplyToCommand(client, "[SM] Usage: sm_auth <#userid|name>");
return Plugin_Handled;
}
char sTarget[MAX_TARGET_LENGTH];
GetCmdArg(1, sTarget, sizeof(sTarget));
int iTarget;
if ((iTarget = FindTarget(client, sTarget, false, false)) <= 0)
return Plugin_Handled;
char sAuthID[32];
GetClientAuthId(iTarget, AuthId_Steam2, sAuthID, sizeof(sAuthID));
ReplyToCommand(client, "[SM] The Steam ID of %N is:", iTarget);
ReplyToCommand(client, "%s", sAuthID);
return Plugin_Handled;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------