this is the latest incarnation of the plugin with many fixes & restructuring. i believe i've sorted out all the issues with the menus & the client now binds to 'botmenu'. the problem now is the botname string defined in the botTarget function & how to make it available to the botClass & botRole functions. to be honest i have no idea where to go with this now
Code:
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "foxbot commanders menu"
#define VERSION "0.2"
#define AUTHOR "stanwebber"
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("botmenu", "botTarget", 0, "Bot command menu")
register_clcmd("botclass", "showBotClass", 0, "Bot class submenu")
register_clcmd("botrole", "showBotRole", 0, "Bot role submenu")
register_menucmd(register_menuid("changeBotClass"), 1023, "botClass")
register_menucmd(register_menuid("changeBotRole"), 1023, "botRole")
}
public botTarget(id, level, cid)
{
if (!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED
new entid, entbody
get_user_aiming(id, entid, entbody, 9999)
if(!is_user_bot(entid) && (get_user_team(id) != get_user_team(entid)))
return PLUGIN_HANDLED
new botname[32]
get_user_name(entid, botname, 31)
client_cmd(id, "botclass")
return PLUGIN_HANDLED
}
public showBotClass(id)
{
new menuClass[1024], keyClass = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9)
format(menuClass, 1023, "Change bot class^n^n1. scout^n2. sniper^n3. soldier^n4. demoman^n5. medic^n6. hw guy^n7. pyro^n8. spy^n9. engineer^n^n0. Change bot role")
show_menu(id, keyClass, menuClass, -1, "changeBotClass")
return PLUGIN_HANDLED
}
public showBotRole(id)
{
new menuRole[1024], keyRole = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9)
format(menuRole, 1023, "Change bot role^n^n1. attack^n2. defend^n3. roam^n9. previous menu^n0. exit")
show_menu(id, keyRole, menuRole, -1, "changeBotRole")
return PLUGIN_HANDLED
}
public botClass(id, key, botname)
{
switch (key)
{
case 0:{
client_cmd(id, "say_team %s changeclass 1", botname)
} case 1:{
client_cmd(id, "say_team %s changeclass 2", botname)
} case 2:{
client_cmd(id, "say_team %s changeclass 3", botname)
} case 3:{
client_cmd(id, "say_team %s changeclass 4", botname)
} case 4:{
client_cmd(id, "say_team %s changeclass 5", botname)
} case 5:{
client_cmd(id, "say_team %s changeclass 6", botname)
} case 6:{
client_cmd(id, "say_team %s changeclass 7", botname)
} case 7:{
client_cmd(id, "say_team %s changeclass 8", botname)
} case 8:{
client_cmd(id, "say_team %s changeclass 9", botname)
} case 9:{
client_cmd(id, "botRole")
}
}
return PLUGIN_HANDLED
}
public botRole(id, key, botname)
{
switch (key)
{
case 0:{
client_cmd(id, "say_team %s changerole attack", botname)
} case 1:{
client_cmd(id, "say_team %s changerole defend", botname)
} case 2:{
client_cmd(id, "say_team %s changerole roam", botname)
} case 3:{
return PLUGIN_CONTINUE
} case 4:{
return PLUGIN_CONTINUE
} case 5:{
return PLUGIN_CONTINUE
} case 6:{
return PLUGIN_CONTINUE
} case 7:{
return PLUGIN_CONTINUE
} case 8:{
client_cmd(id, "botclass")
} case 9:{
return PLUGIN_HANDLED
}
}
return PLUGIN_HANDLED
}