Raised This Month: $51 Target: $400
 12% 

Solved SourceMod API GetClientAuthId Function


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:31.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode