View Single Post
Author Message
PC Gamer
Veteran Member
Join Date: Mar 2014
Old 11-01-2019 , 23:36   SourceMod API GetClientAuthId Function
Reply With Quote #1

Team,

I've upgraded to Sourcemod 1.10 and began cleaning up plugins. I've noticed this warning on a few of them when compiling: warning 234: symbol "GetClientAuthString" is marked as deprecated: Use GetClientAuthId

I reviewed the GetClientAuthId function (link: https://sm.alliedmods.net/new-api/cl...etClientAuthId). However, I'm a bit stumped on how to use it to get the Steam2 ID.

How would you rewrite the code below to use GetClientAuthId instead of GetClientAuthString to get a Steam2 ID?

Code:
public Action:Command_Addvip(client, args)
{
	if(args < 1)
	{
		ReplyToCommand(client, "[SM] Usage: sm_addvip <name or #userid>");
		return Plugin_Handled;
	}
	decl String:buffer[64];
	GetCmdArg(1, buffer, sizeof(buffer));
	new target = FindTarget(client, buffer, true, false);
	decl String:steamid[64];
	GetClientAuthString(target, steamid, sizeof(steamid));

	new String:szFile[256];
	BuildPath(Path_SM, szFile, sizeof(szFile), "configs/admins_simple.ini");

	new Handle:hFile = OpenFile(szFile, "at");

	WriteFileLine(hFile, "\"%s\" \"5:a\"", steamid);

	CloseHandle(hFile);

	return Plugin_Handled;
}

Last edited by PC Gamer; 11-02-2019 at 00:36.
PC Gamer is offline