Raised This Month: $ Target: $400
 0% 

/weapons menu will not open "counter terrorist only" weapon menu.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
{PHILMAGROIN}
Senior Member
Join Date: Aug 2007
Location: In the middle of the des
Old 07-26-2008 , 14:56   /weapons menu will not open "counter terrorist only" weapon menu.
Reply With Quote #1

Ok i fixed all of the errors and warnings but when i press 1. counter terrorist only weapons it does nothing. here is the code. any one know why?
Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #include <cstrike> #include <fun> #define PLUGIN "Ct/T Only Guns" #define VERSION "1.0" #define AUTHOR "{PHILMAGROIN}" new m4akcost, autocost, shieldcost, defusecost, bombcost; new ctwmenu, twmenu; public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         register_clcmd("say /weapons", "weaponsmenu")     register_clcmd("say_team /weapons", "weaponsmenu")     m4akcost = register_cvar("m4akprice", "2580")     autocost = register_cvar("autoprice", "5080")     shieldcost = register_cvar("shieldprice", "2200")     defusecost = register_cvar("defuseprice", "200")     bombcost = register_cvar("bombprice", "3000") } public weaponsmenu(id) {     new weaponmenu = menu_create("\rGuns:", "menu_handler")         menu_additem(weaponmenu, "Counter-Terrorist Only Weapons", "1", 0)     menu_additem(weaponmenu, "Terrorist Only Weapons", "2", 0)     menu_setprop(weaponmenu, MPROP_EXIT, MEXIT_ALL)     menu_display(id, weaponmenu, 0) } public ctmenu(id) {     new ctwmenu = menu_create("\rCounter-Terrorist Only Weapons", "menu_handler2")         menu_additem(ctwmenu, "/w M4", "1", 0)     menu_additem(ctwmenu, "/w Auto Sniper", "2", 0)     menu_additem(ctwmenu, "/w Shield", "3", 0)     menu_additem(ctwmenu, "/w Defuser Kit", "4", 0)     menu_display(id, ctwmenu, 2) } public tmenu(id) {     new twmenu = menu_create("/rTerrorist Only Weapons", "menu_handler3")         menu_additem(twmenu, "/w AK47", "1", 0)     menu_additem(twmenu, "/w Auto Sniper", "2", 0)     menu_additem(twmenu, "/w Bomb", "3", 0)     menu_display(id, twmenu, 0) } public menu_handler(id, weaponmenu, item) {     if (item == MENU_EXIT)     {         menu_destroy(weaponmenu)         return PLUGIN_HANDLED     }         new data[6], iName[64]     new access, callback         menu_item_getinfo(weaponmenu, item, access, data, 5, iName, 63, callback)         new key = str_to_num(data)         switch(key)     {         case 1:{             menu_display(id, ctwmenu, 0)             return PLUGIN_HANDLED         }         case 2:{             menu_display(id, twmenu, 0)             return PLUGIN_HANDLED         }     }     menu_destroy(weaponmenu)     return PLUGIN_HANDLED } public menu_handler2(id, ctwmenu, item) {     if (item == MENU_EXIT)     {         menu_destroy(ctwmenu)         return PLUGIN_HANDLED     }         new money = cs_get_user_money(id);     new data[6], iName[64]     new access, callback         menu_item_getinfo(ctwmenu, item, access, data, 5, iName, 63, callback)         new key = str_to_num(data)         switch(key)     {         case 1:{             if(money < m4akcost)             {                 client_print(id, print_chat,"[AMXX] You don't have enough money for an M4.")             }             else {                 cs_set_user_money(id, money - m4akcost);                 client_print(id, print_chat,"[AMXX] You just purchased an M4.")                 dropcurweapon(id)                 give_item(id,"weapon_m4a1");                 give_item(id, "ammo_556nato");                 give_item(id, "ammo_556nato");                 give_item(id, "ammo_556nato");                 menu_destroy(ctwmenu)             }         }         case 2:{             if(money < autocost)             {                 client_print(id, print_chat,"[AMXX] You don't have enough money for an Auto Sniper.")             }             else {                 cs_set_user_money(id, money - autocost);                 client_print(id, print_chat,"[AMXX] You just purchased an Auto Sniper.")                 dropcurweapon(id)                 give_item(id,"weapon_g3sg1");                 give_item(id, "ammo_762nato");                 give_item(id, "ammo_762nato");                 give_item(id, "ammo_762nato");                 menu_destroy(ctwmenu)             }         }         case 3:{             if(money < shieldcost)             {                 client_print(id, print_chat,"[AMXX] You don't have enough money for a Shield.")             }             else {                 cs_set_user_money(id, money - shieldcost);                 client_print(id, print_chat,"[AMXX] You just purchased a Shield.")                 dropcurweapon(id)                 give_item(id,"weapon_shield");                 menu_destroy(ctwmenu)             }         }         case 4:{             if(money < defusecost)             {             client_print(id, print_chat,"[AMXX] You don't have enough money for a Defuse Kit.")             }             else {                 cs_set_user_money(id, money - defusecost);                 client_print(id, print_chat,"[AMXX] You just purchased a Defuse Kit.")                 give_item(id,"item_thighpack");                 menu_destroy(ctwmenu)                 return PLUGIN_HANDLED             }                                 }                         }     return PLUGIN_HANDLED } public dropcurweapon(id){     engclient_cmd(id, "drop", "weapon_shield")     engclient_cmd(id, "drop", "weapon_m3")     engclient_cmd(id, "drop", "weapon_xm1014")     engclient_cmd(id, "drop", "weapon_mp5navy")         engclient_cmd(id, "drop", "weapon_p90")     engclient_cmd(id, "drop", "weapon_mac10")     engclient_cmd(id, "drop", "weapon_tmp")     engclient_cmd(id, "drop", "weapon_ump45")     engclient_cmd(id, "drop", "weapon_galil")     engclient_cmd(id, "drop", "weapon_famas")         engclient_cmd(id, "drop", "weapon_m4a1")     engclient_cmd(id, "drop", "weapon_aug")     engclient_cmd(id, "drop", "weapon_ak47")     engclient_cmd(id, "drop", "weapon_sg552")     engclient_cmd(id, "drop", "weapon_scout")     engclient_cmd(id, "drop", "weapon_awp")     engclient_cmd(id, "drop", "weapon_sg550")     engclient_cmd(id, "drop", "weapon_g3sg1")     engclient_cmd(id, "drop", "weapon_m249") } public menu_handler3(id, twmenu, item) {         if (item == MENU_EXIT)     {         menu_destroy(twmenu)         return PLUGIN_HANDLED     }     new money = cs_get_user_money(id);     new data[6], iName[64]     new access, callback                         menu_item_getinfo(twmenu, item, access, data, 5, iName, 63, callback)                         new key = str_to_num(data)         switch(key)     {         case 1:{             if(money < m4akcost)             {                 client_print(id, print_chat,"[AMXX] You don't have enough money for an AK47.")             }             else {                 cs_set_user_money(id, money - m4akcost);                 client_print(id, print_chat,"[AMXX] You just purchased an AK47.")                 dropcurweapon(id)                 give_item(id,"weapon_ak47");                 give_item(id, "ammo_762nato");                 give_item(id, "ammo_762nato");                 give_item(id, "ammo_762nato");                 menu_destroy(ctwmenu)             }         }         case 2:{             if(money < autocost)             {                 client_print(id, print_chat,"[AMXX] You don't have enough money for an Auto Sniper.")             }             else {                 cs_set_user_money(id, money - autocost);                 client_print(id, print_chat,"[AMXX] You just purchased an Auto Sniper.")                 dropcurweapon(id)                 give_item(id,"weapon_sg552");                 give_item(id, "ammo_556nato");                 give_item(id, "ammo_556nato");                 give_item(id, "ammo_556nato");                 menu_destroy(ctwmenu)             }         }         case 4:{             if(money < defusecost)             {                 client_print(id, print_chat,"[AMXX] You don't have enough money for a Bomb.")             }             else {                 cs_set_user_money(id, money - bombcost);                 client_print(id, print_chat,"[AMXX] You just purchased a Bomb.")                 give_item(id,"item_c4");             }             menu_destroy(twmenu)             return PLUGIN_HANDLED         }                             }     return PLUGIN_HANDLED }
__________________
[B]

Last edited by {PHILMAGROIN}; 07-27-2008 at 03:59.
{PHILMAGROIN} is offline
PvtSmithFSSF
Senior Member
Join Date: Jul 2008
Old 07-26-2008 , 15:04   Re: Menu problem. [errors]
Reply With Quote #2

I didn't read it all yet but just for now I'm telling you look at this part:

menu_additem(ctwmenu, "/w M4", "1", 0)
menu_additem(ctwmenu, "/w Auto Sniper", "1", 0)
menu_additem(ctwmenu, "/w Shield", "1", 0)
menu_additem(ctwmenu, "/w Defuser Kit", "1", 0)


You have all "1"s. It should be:

menu_additem(ctwmenu, "/w M4", "1", 0)
menu_additem(ctwmenu, "/w Auto Sniper", "2", 0)
menu_additem(ctwmenu, "/w Shield", "3", 0)
menu_additem(ctwmenu, "/w Defuser Kit", "4", 0)

I believe that those are the numbers you press on the menu to get that certain item.. So like case1 { } would refer to "1" (m4), case2 {} would refer to "2" (auto sniper), and so on.
Same for the twmenu


I can rewrite it for you but in like 5 minutes i g2g for 3-4 hours, but soon, I will re-write it for you ;) Unless you don't need it. But I just started working with menus yesterday and I had no problem whatsoever, this shall be a piece of cake

Last edited by PvtSmithFSSF; 07-26-2008 at 15:17.
PvtSmithFSSF is offline
{PHILMAGROIN}
Senior Member
Join Date: Aug 2007
Location: In the middle of the des
Old 07-26-2008 , 15:21   Re: Menu problem. [errors]
Reply With Quote #3

no need to rewrite it. i just need to figure out what the error is.
and i have a lot of loose indentations =\ i tried fixing them but i failed.

EDIT:and under public menu_handler2
I dont think i should have to put switch(key) at the beginning of each case. because menu_handler i didnt. but i got errors and put switch(key) in front of them and the errors were gone. but if anyone has the solution that would be good.
__________________
[B]

Last edited by {PHILMAGROIN}; 07-26-2008 at 16:36.
{PHILMAGROIN} is offline
Jon
Veteran Member
Join Date: Dec 2007
Old 07-26-2008 , 15:34   Re: Menu problem. [errors]
Reply With Quote #4

You messed up the brackets ({}).
Jon is offline
{PHILMAGROIN}
Senior Member
Join Date: Aug 2007
Location: In the middle of the des
Old 07-26-2008 , 16:10   Re: Menu problem. [errors]
Reply With Quote #5

ive been looking over it and over it and cant see the messed up brackets. because the brackets are in the same place but the public menu_handler2(id, ctwmenu, item) doesnt have any errors.
Code:
public menu_handler3(id, twmenu, item) {     if (item == MENU_EXIT)     {         menu_destroy(twmenu)         return PLUGIN_HANDLED     }     new money = cs_get_user_money(id);     new data[6], iName[64]     new access, callback

Code:
public menu_handler2(id, ctwmenu, item) {     if (item == MENU_EXIT)     {         menu_destroy(ctwmenu)         return PLUGIN_HANDLED     }     new money = cs_get_user_money(id)     new data[6], iName[64]     new access, callback
__________________
[B]
{PHILMAGROIN} is offline
{PHILMAGROIN}
Senior Member
Join Date: Aug 2007
Location: In the middle of the des
Old 07-27-2008 , 03:03   Re: Menu problem. [errors]
Reply With Quote #6

edit
__________________
[B]

Last edited by {PHILMAGROIN}; 07-27-2008 at 04:00. Reason: put up top
{PHILMAGROIN} is offline
Reply


Thread Tools
Display Modes

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 05:31.


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