Okay. I've had this problem for quite awhile now. No idea why, but my menu is way screwed up.
Everytime I go to the menu by typing "/ninjamenu" it automatically sets my class to "Strong", and the menu doesn't show.
the second time I type it, it gives me the error that "I'm already a Strong Ninja, pick something else". And shows the menu, but I can't close it using the Exit button. Pretty sure that's just a chuunk of code I left out, but doesn't explain the above errors.
Here's the menu code.
Code:
register_menucmd(register_menuid("menu_ChooseType"),1023,"DoChooseType");
Code:
public ChooseType(id) {
new menu[192]
format(menu, 191, "Ninja Mod: Choose Ninja Type^n^n1. Strong^n2. Fast^n3. Stealthy^n4. Balanced^n^n0. Exit")
new keys = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)
show_menu(id, keys, menu, 15, "menu_ChooseType")
return PLUGIN_HANDLED
}
public DoChooseType(id, key) {
switch(key) {
case 0: {
if(PlayerClass[id] == CLASS_STRONG) {
client_print(id, print_chat, "[Ninja Mod] You are already a Strong Ninja! Choose something else!")
ChooseType(id)
return PLUGIN_HANDLED
}
PlayerClass[id] = CLASS_STRONG
set_user_maxspeed(id,320.0)
cs_set_user_model(id,"models/player/ninja.mdl")
client_print(id, print_chat, "[Ninja Mod] You are now a Strong Ninja!")
return PLUGIN_HANDLED
}
case 1: {
if(PlayerClass[id] == CLASS_FAST) {
client_print(id, print_chat, "[Ninja Mod] You are already a Fast Ninja! Choose something else!")
ChooseType(id)
return PLUGIN_HANDLED
}
PlayerClass[id] = CLASS_FAST
set_user_maxspeed(id,1000.0)
cs_set_user_model(id,"models/player/ninja.mdl")
client_print(id, print_chat, "[Ninja Mod] You are now a Fast Ninja!")
return PLUGIN_HANDLED
}
case 2: {
if(PlayerClass[id] == CLASS_STEALTHY) {
client_print(id, print_chat, "[Ninja Mod] You are already a Steatlhy Ninja! Choose something else!")
ChooseType(id)
return PLUGIN_HANDLED
}
PlayerClass[id] = CLASS_STEALTHY
set_user_maxspeed(id,320.0)
cs_set_user_model(id,"models/player/ninja.mdl")
client_print(id, print_chat, "[Ninja Mod] You are now a Stealthy Ninja!")
return PLUGIN_HANDLED
}
case 3: {
if(PlayerClass[id] == CLASS_BALANCED) {
client_print(id, print_chat, "[Ninja Mod] You are already a Balanced Ninja! Choose something else!")
ChooseType(id)
return PLUGIN_HANDLED
}
PlayerClass[id] = CLASS_BALANCED
set_user_maxspeed(id,320.0)
cs_set_user_model(id,"models/player/ninja.mdl")
client_print(id, print_chat, "[Ninja Mod] You are now a Balanced Ninja!")
return PLUGIN_HANDLED
}
}
return PLUGIN_HANDLED
}