View Single Post
Author Message
Nickolay
Member
Join Date: Jan 2020
Old 06-30-2020 , 23:46   Changing from client name to SteamID args
Reply With Quote #1

Got zero knowledge when it comes to this, so any help would be great.
Trying to change the code so instead of typing in client name or userid, I can just type in steamid.


Code:
{
	RegAdminCmd("sm_addvip", Command_Addvip, ADMFLAG_SLAY, "Adds an admin to admins_simple.ini");
}

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];
	GetClientAuthId(target, AuthId_Steam2, 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\"  //%N", steamid, target);

	CloseHandle(hFile);

	return Plugin_Handled;
}
Nickolay is offline