AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Problem with my mod code. (https://forums.alliedmods.net/showthread.php?t=27797)

SweatyBanana 04-29-2006 18:01

Problem with my mod code.
 
Hey all...Just wondering if you can help me out a bit...


Here is my code that I am starting to make my mod with...

It all compiles, and gets no bad-load, but when I type /skills(The command to bring up my menu), it does nothing and prints:

Code:

unknown command -rope
unknown command -rope

Heres my code:

Code:
/************************************************************************* *             Thanks Locks For making the LongJump part...Menu from podbot plugin                  * */ #include <amxmodx> #include <amxmisc> #include <cstrike> #include <fun> #define PLUGIN = Power-Mod #define VERSION = 1.0 #define AUTHOR = SweatyBanana new bool:g_hasLongJump[33] public plugin_init()     {     register_plugin("PLUGIN", "VERSION", "AUTHOR")         register_menucmd(register_menuid("\yPlease select an upgrade"), 1023, "mainMenu")     register_menucmd(register_menuid("\yPlease choose a Skill"), 1023, "skillMenu")     register_menucmd(register_menuid("\yPlease choose a Personality"), 1023, "actionCPMenu")     register_menucmd(register_menuid("\yPlease choose a Team"), 1023, "actionCTMenu")     register_menucmd(register_menuid("\yPlease choose a Model"), 1023, "actionCMMenu")     register_menucmd(register_menuid("\yKick Bot From"), 1023, "actionKBMenu")     register_menucmd(register_menuid("\yWeapon Mode"), 1023, "actionWMMenu")         register_clcmd("say /skills", "showMainMenu", ADMIN_ALL, "- displays Main-menu.")     register_clcmd("say_team /skills", "showMainMenu", ADMIN_ALL, "- displays Main-menu.")         register_cvar("mp_speedCost", "4000");     register_cvar("mp_invisiCost", "4000");     register_cvar("sv_longjump", "1");     register_cvar("mp_longcost","4000");         register_event("DeathMsg", "death", "a")         return PLUGIN_CONTINUE } /*--- Main Menu --------------------------------------------------------------*/ public mainMenu(id, key)     {     new name[32], authid[16]     get_user_name(id, name, 31)     get_user_authid(id, authid, 16)     switch(key)     {         case 0:         {             //client_cmd("giveSpeed")             client_cmd(id, "showMainMenu")             log_amx("[P-M] ^"%s<%d><%s><>^" has recieved speed", name, get_user_userid(id), authid)         }         case 1:         {             //client_cmd("giveInvis")             client_cmd(id, "showMainMenu")             log_amx("[P-M] ^"%s<%d><%s><>^" has recieved speed", name, get_user_userid(id), authid)         }         case 2:         {             server_cmd("buy_longjump")             log_amx("[P-M] ^"%s<%d><%s><>^" has recieved long-Jump", name, get_user_userid(id), authid)         }         case 3:         {             client_cmd(id, "showMainMenu")             log_amx("[P-M] ^"%s<%d><%s><>^" new round", name, get_user_userid(id), authid)         }         case 4:         {             client_cmd(id, "showMainMenu")         }         case 5:         {             client_cmd(id, "showMainMenu")         }         case 6:         {             server_cmd("pb removebots")             log_amx("[P-M] ^"%s<%d><%s><>^" kick all bots", name, get_user_userid(id), authid)         }         case 7:         {             client_cmd(id, "showMainMenu")         }     }     return PLUGIN_HANDLED } public showMainMenu(id) {     new menu[256]     format(menu, 255, "\yPurchase speed -$%i-^n^n\w1. Purchase invisibility -$%i-^n2. Purchase long-jump -$%i-^n3. Kill All Bots^n4. New Round^n5. Fill Server^n6. Kick Bot^n7. Kick All Bots^n8. Weapon Mode^n^n\w0. Exit",get_cvar_num("mp_speedcost"),get_cvar_num("mp_invisicost"),get_cvar_num("mp_longCost"))     show_menu(id, ((1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<9)), menu)     return PLUGIN_HANDLED } public client_connect(id)     {     g_hasLongJump[id] = false     return PLUGIN_HANDLED } public client_disconnect(id)     {     g_hasLongJump[id] = false     return PLUGIN_HANDLED } public death()     {     new id = read_data(2)     g_hasLongJump[id] = false } public buy_longjump(id)     {     if ( get_cvar_num("sv_longjump") == 0 )         {         client_print(id, print_chat, "[AMXX] Long Jump plugin is disabled.")         return PLUGIN_HANDLED     }         if ( g_hasLongJump[id] )         {         client_print(id, print_chat, "[AMXX] You have already purchased a jumppack.")     }         if( !is_user_alive(id) )         {         client_print(id,print_chat,"[AMXX] Dead clients are not allow to buy a jumppack.")         return PLUGIN_HANDLED     }         new money = cs_get_user_money(id)     new cost = get_cvar_num("amx_longjump_cost")         if ( money < cost )         {         client_print(id, print_chat, "[AMXX] You don't have enough money to buy a jumppack. ($%i needed).", cost)         return PLUGIN_CONTINUE     }         give_item(id,"item_longjump")     cs_set_user_money(id, money - cost)     client_print(id, print_chat, "[AMXX] You have bought a Jump Pack. To use it, press duck and jump while moving forward.")     g_hasLongJump[id] = true         return PLUGIN_CONTINUE } public giveSpeed(id) {     return PLUGIN_CONTINUE } public giveInvis(id) {     return PLUGIN_CONTINUE }

Kensai 04-29-2006 19:02

Your menu code is messed.

Registering it should look like this.

Code:
register_menucmd(register_menuid("menu_MainMenu"), 1023, "showMainMenu")

I make a global string for the keys.
Code:
new keys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_6|MENU_KEY_7|MENU_KEY_8|MENU_KEY_9

Menu code should look something like this
Code:
public MainMenu(id) {             format(menu,191,"BLAH: 1. BLAH^n2. BLAH^n3. BLAH^n^n0. Exit")       show_menu(id, keys, menu, -1, "menu_MainMenu")     return 0 } public showMainMenu(id, key) {     if(key == 0)     {         //BLAHBLAH      }         if(key == 1)     {         //BLAHBLAH      }     if(key == 2)     {         //BLAHBLAH      }     if(key == 3)     {         //BLAHBLAH      }     if(key == 4)     {         //BLAHBLAH      }         if(key == 9)     {         return 1     }     return 1 }

v3x 04-29-2006 19:48

For god's sake just use the new menu system and pcvar natives :P

Kensai 04-29-2006 20:27

NEVA!!!


All times are GMT -4. The time now is 05:13.

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