how to convert this
public Action: to
public Help_MenuHandler: i wanted to add comand for open menu with /addadmin_ext, tried many examples, but fail.
Original plugin
Code:
#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("smaddadmin_version", VERSION, "SM Addadmin Version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
RegAdminCmd("sm_addadmin", Command_AddAdmin, ADMFLAG_RCON, "Adds an admin to admins_simple.ini");
}
public Action:Command_AddAdmin(client, args)
{
if(args < 1)
{
ReplyToCommand(client, "[SM] Usage: sm_addadmin <name or #userid> <flags> <password>");
return Plugin_Handled;
}
new String:szTarget[64], String:szFlags[20], String:szPassword[32];
GetCmdArg(1, szTarget, sizeof(szTarget));
GetCmdArg(2, szFlags, sizeof(szFlags));
GetCmdArg(3, szPassword, sizeof(szPassword));
new String:szFile[256];
BuildPath(Path_SM, szFile, sizeof(szFile), "configs/admins_simple.ini");
new Handle:hFile = OpenFile(szFile, "at");
WriteFileLine(hFile, "\"%s\" \"%s\" \"%s\"", szTarget, szFlags, szPassword);
CloseHandle(hFile);
return Plugin_Handled;
}
I wanted create menu for this plugin like my this in my adminmenu_custom.txt
Code:
"Set admin"
{
"cmd" "sm_addadmin_ext #1 #2 #3"
"execute" "player"
"admin" "sm_rcon"
"1"
{
"type" "player"
"method" "name"
"title" "Player:"
}
"2"
{
"type" "player"
"method" "steamid"
"title" "Confirm new Admin:"
}
"3"
{
"type" "list"
"title" "cmds"
"1" "b"
"1." "b"
"2" "ab"
"2." "ab"
"3" "abc"
"3." "abc"
"4" "abcd"
"4." "abcd"
"5" "99:z"
"5." "99:z"
}
}
"Reload admins"
{
"cmd" "sm_reloadadmins"
}
My edited version I want to add a menu with command chat /addadmin_ext and !addadmin_ext :
Code:
#pragma semicolon 1
/*
* SM addadmin_ext
* by Narug0 ([email protected])
* thx MaTTe (mateo10)
*/
#define VERSION "3.1"
public Plugin:myinfo =
{
name = "addadmin_ext",
author = "Narug0 ",
description = "Add an admin during the game with sm_addadmin_ext All thx for thx MaTTe ",
version = VERSION,
url = "http://fearless-assassins.com"
};
public OnPluginStart()
{
CreateConVar("smaddadmin_ext_version", VERSION, "SM addadmin_ext Version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
RegAdminCmd("sm_addadmin_ext", Command_addadmin_ext, ADMFLAG_RCON, "Adds an admin to admins_simple.ini");
}
public Action:Command_addadmin_ext(client, args)
{
if(args < 1)
{
ReplyToCommand(client, "[SM] Usage: sm_addadmin_ext <name> <#steamid> <flags> ");
return Plugin_Handled;
}
new String:szNome[64];
GetCmdArg(1, szNome, sizeof(szNome));
new String:szTarget[64], String:szFlags[20];
GetCmdArg(2, szTarget, sizeof(szTarget));
GetCmdArg(3, szFlags, sizeof(szFlags));
new String:szFile[256];
BuildPath(Path_SM, szFile, sizeof(szFile), "configs/admins_simple.ini");
new Handle:hFile = OpenFile(szFile, "at");
WriteFileLine(hFile, "\"%s\"", szNome); //How can I add // before the name?
WriteFileLine(hFile, "\"%s\" \"%s\"", szTarget, szFlags);
CloseHandle(hFile);
return Plugin_Handled;
}