AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   willing to help a noob on a noob script? (https://forums.alliedmods.net/showthread.php?t=9258)

Revelation 01-11-2005 14:03

willing to help a noob on a noob script?
 
1 Attachment(s)
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.

f1del1ty.oXi 01-11-2005 14:30

Wrong forum. There is scripting help for a reason. Next time use it.

Peli 01-11-2005 21:49

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 }


All times are GMT -4. The time now is 19:28.

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