Raised This Month: $ Target: $400
 0% 

willing to help a noob on a noob script?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Revelation
Junior Member
Join Date: Jan 2005
Old 01-11-2005 , 14:03   willing to help a noob on a noob script?
Reply With Quote #1

Code:
#include <amxmodx>

public plugin_init()
{
	register_plugin("PeepShowConfigLoader","1","Revelation")
	register_menucmd(register_menuid("Choose Option"), keys, "LoadConfig")
	register_clcmd("peepshowcfgmenu", "ShowPSCfgMenu")
}

public ShowPSCfgMenu(id)
{
	new menu[256]
	new keys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5
	format(menu, 255, "Choose Option^n^n1. Load PUBLIC Server Settings^n2. Load WAR Server Settings^n3. 3 Restarts then Live^n4. 4 Restarts the Knives^n5. Restart Round")
	show_menu(id, key, menu)
	return PLUGIN_HANDLED
}

public LoadConfig(id, key)
{
	if (key == 0) 
	{
		server_cmd("exec cfgs/public.cfg")
	} 
	else if (key == 1)
	{
		server_cmd("exec cfgs/war.cfg")
	}
	else if (key == 2)
	{
		server_cmd("exec cfgs/live.cfg")
	}
	else if (key == 3)
	{
		server_cmd("exec cfgs/knives.cfg")
	}
	else if (key == 4)
	{
		server_cmd("sv_restartround 1")
	}
}
As you can see I know nothing at all about scripting, I tried to copy it from the amxmodx help files. Im trying to make a menu with 5 options for my server. I get a couple of errors, they are
Code:
/home/users/amxmodx/tmp/phpLw775l.sma(1) : error 055: start of function body without function header
/home/users/amxmodx/tmp/phpLw775l.sma(4) : error 029: invalid expression, assumed zero
/home/users/amxmodx/tmp/phpLw775l.sma(11) : error 029: invalid expression, assumed zero
/home/users/amxmodx/tmp/phpLw775l.sma(20) : error 029: invalid expression, assumed zero

4 Errors.
please can someone fix it, Ive tried for ages

p.s I'd like 2 more things adding to it, that I dunno what to do, they are:
1. Another option, when a user presses the 0 key it exists the meny
2. Id like it so that only admins with admin level "u" or "ADMIN_MENU" can load the menu

Thanks in advance Rev.
Attached Files
File Type: sma Get Plugin or Get Source (peepshowconfigloader.sma - 83 views - 1.4 KB)
Revelation is offline
f1del1ty.oXi
Veteran Member
Join Date: Nov 2004
Old 01-11-2005 , 14:30  
Reply With Quote #2

Wrong forum. There is scripting help for a reason. Next time use it.
__________________
f1del1ty.oXi is offline
Peli
Veteran Member
Join Date: Mar 2004
Location: San Diego, CA
Old 01-11-2005 , 21:49  
Reply With Quote #3

Try this out.
Code:
#include <amxmodx> public plugin_init() {    register_plugin("PeepShowConfigLoader","1","Revelation")    register_menucmd(register_menuid("/yChoose Option:"),1023,"LoadConfig")    register_clcmd("say /peepshowcfgmenu","ShowPSCfgMenu") } public ShowPSCfgMenu(id) {     new szMenuBody[256]     new keys     format(szMenuBody,255,"\yCounter-Strike Powers Menu:\w^n^n")     add(szMenuBody,255,"1. Load Public Server Settings^n")     add(szMenuBody,255,"2. Load War Server Settings^n")     add(szMenuBody,255,"3. 3 Restarts Then Live^n")     add(szMenuBody,255,"4. Restarts The Knives^n^n")     add(szMenuBody,255,"5. Restarts Round")         keys = (1<<0|1<<1|1<<2|1<<3|1<<4)     show_menu(id,keys,szMenuBody,-1 )         return PLUGIN_CONTINUE } public LoadConfig(id,key) {     switch(key)     {        case 0:        {           server_cmd("exec cfgs/public.cfg")        }        case 1:        {           server_cmd("exec cfgs/war.cfg")        }        case 2:        {           server_cmd("exec cfgs/live.cfg")        }        case 3:        {           server_cmd("exec cfgs/knives.cfg")        }        case 4:        {           server_cmd("sv_restartround 1")        }     }     return PLUGIN_HANDLED }
Peli is offline
Send a message via MSN to Peli
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 19:28.


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