Hello
I was wondering if it was possible to add a guy who is in the server , to add him (his name , his STEAM ID , and the flag) into the admins.cfg .
I know that someone already posted this sort of plugin , but it is adding the guy into "admins_simple" , and that's not what i want.
If someone could create a plugin like this , it would help me alot.
I just tested copy/paste admin form , which is this :
"NAME HERE"
{
"auth" "steam"
"identity" "STEAM ID HERE"
"flags" FLAG HERE"
}
But it don't accept more then 1 line .
Here is my modification of the "SM addadmin" plugin. (i added "test" at the end of addadmin , because it is a test.) Check where where i want to add more then 1 line :
#pragma semicolon 1
/*
* SM Addadmin
* by MaTTe (mateo10)
*/
#define VERSION "1.0"
public Plugin:myinfo =
{
name = "SM Addadmin",
author = "MaTTe",
description = "Add an admin during the game with sm_addadmin",
version = VERSION,
url = "http://www.sourcemod.net/"
};
public OnPluginStart()
{
CreateConVar("smaddadmintest_version", VERSION, "SM Addadmintest Version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FC VAR_NOTIFY);
RegAdminCmd("sm_addadmintest", Command_AddAdminTest, ADMFLAG_RCON, "Adds an admin to admins.cfg");
}
public Action:Command_AddAdminTest(client, args)
{
if(args < 1)
{
ReplyToCommand(client, "[SM] Usage: sm_addadmintest <name or #userid> <Steam ID> <Flags>");
}
if(args == 1)
{
ReplyToCommand(client, "[SM] Usage: sm_addadmintest <name or #userid> <Steam ID> <Flags>");
}
if(args == 2)
{
ReplyToCommand(client, "[SM] Usage: sm_addadmintest <name or #userid> <Steam ID> <Flags>");
}
if(args == 3)
{
ReplyToCommand(client, "[SM] The selected player was successfully added to admins list.");
}
new String:szTarget[64], String:szSteamId[20], String:szFlags[32];
GetCmdArg(1, szTarget, sizeof(szTarget));
GetCmdArg(2, szSteamId, sizeof(szSteamId));
GetCmdArg(3, szFlags, sizeof(szFlags));
new String:szFile[256];
BuildPath(Path_SM, szFile, sizeof(szFile), "configs/admins.cfg");
new Handle:hFile = OpenFile(szFile, "at");
if(args == 3)
WriteFileLine(hFile, "I WANT TO ADD MORE THEN 1 LINE HERE" , szTarget, szSteamId, szFlags);
CloseHandle(hFile);
return Plugin_Handled;
}
And when i try to compile (with the text that has more then 1 line) , it tell me this :
error 037: invalid string (possibly non-terminated string)
warning 215: expression has no effect
error 001: expected token ";" , but found "-string-"
warning 215: expression has no effect
error 001:expected token ";" , but found "-string-"
warning 215: expression has no effect
error 001:expected token ";" , but found "-string-"
fatal error 127: too many error messages on one line
Compilation aborted
5 errors.
So my probleme is : i want to add more then 1 line (2 , 3 etc....) but i can't .
Someone help me ? :3
Actually , i just saw that you can make multiple line with WriteFileLine :oops:.
So now , the probleme is :
-i cannot put "{" or "}"
-it says "undefined symbol auth , indentity and flags"
And since i want to add this into admins.cfg :
"NAME HERE"
{
"auth" "steam"
"identity" "STEAM ID HERE"
"flags" FLAG HERE"
}
It dosen't work.
Can someone help me ? :cry:
PS: sorry for double post
Someone
Impact123
12-15-2011, 15:18
For this kind of work you should use KeyValues.
Yours sincerely
Impact
What exaclty is KeyValues ? :shock:
vBulletin® v3.8.7, Copyright ©2000-2024, vBulletin Solutions, Inc.