Raised This Month: $ Target: $400
 0% 

{plz delete wrong section sorry}Menu convert public Action:to public MenuHandler


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
narugo
Member
Join Date: Mar 2013
Location: São Paulo - Brazil
Old 04-18-2013 , 17:50   {plz delete wrong section sorry}Menu convert public Action:to public MenuHandler
Reply With Quote #1

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;
}

Last edited by narugo; 04-18-2013 at 20:55. Reason: wrong section
narugo is offline
Send a message via Skype™ to narugo
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 04-18-2013 , 17:57   Re: Menu convert public Action:to public MenuHandler
Reply With Quote #2

This isn't the forum you want
Backstabnoob is offline
narugo
Member
Join Date: Mar 2013
Location: São Paulo - Brazil
Old 04-18-2013 , 20:31   Re: Menu convert public Action:to public MenuHandler
Reply With Quote #3

u r right bro... plz im reporting this topic because i posted in amx and wanted post it in sourcemod srcds .smx
narugo is offline
Send a message via Skype™ to narugo
Reply



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 06:19.


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