Raised This Month: $ Target: $400
 0% 

please fix my bot command menu system plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
stanwebber
Junior Member
Join Date: Apr 2006
Old 07-28-2006 , 22:02   please fix my bot command menu system plugin
Reply With Quote #1

let me first say i have no idea what i'm doing. i cobbled together the following script solely from examples i've found on this forum. i'm only guessing at the plugin layout & line syntax so i know there are errors. i was able to get the plugin to compile successfully, but it does absolutely nothing when i bind to 'botclass' in-game. please someone fix my code & get my script working. thanks
Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "foxbot commanders menu"
#define VERSION "0.1"
#define AUTHOR "stanwebber"
#define keysClass (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9)
#define keysRole (1<<0)|(1<<1)|(1<<2)|(1<<3)

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	register_menucmd(register_menuid("Change bot class"), keysClass, "changeBotClass")
	register_menucmd(register_menuid("Change bot role"), keysRole, "changeBotRole")
	register_clcmd("botclass", "showBotClass", 0, "Bot class menu")
	register_clcmd("botrole", "showBotRole", 0, "Bot role menu")
}

public changeBotClass(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, "showBotRole")
		}
	}
	return PLUGIN_HANDLED
}

public changeBotRole(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_HANDLED
		}
	}
	return PLUGIN_HANDLED
}

public showBotClass(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)

	show_menu(id, keysClass, "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")

	return PLUGIN_HANDLED
}

public showBotRole(id, level, cid)
{

	if (!cmd_access(id, level, cid, 1))
		return PLUGIN_HANDLED

	show_menu(id, keysRole, "Change bot role^n^n1. attack^n2. defend^n3. roam^n^n4. exit")

	return PLUGIN_HANDLED
}
stanwebber is offline
s0upnazi
Member
Join Date: Mar 2006
Old 07-29-2006 , 00:58   Re: please fix my bot command menu system plugin
Reply With Quote #2

Your script compiles fine.
s0upnazi is offline
stanwebber
Junior Member
Join Date: Apr 2006
Old 07-29-2006 , 04:53   Re: please fix my bot command menu system plugin
Reply With Quote #3

Quote:
Originally Posted by s0upnazi
Your script compiles fine.
it may compile, but it still doesn't work

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 }

Last edited by stanwebber; 07-29-2006 at 04:58.
stanwebber is offline
stanwebber
Junior Member
Join Date: Apr 2006
Old 07-30-2006 , 06:53   Re: please fix my bot command menu system plugin
Reply With Quote #4

ok, i got some help in the irc channel & we manage to fix everything except one last problem. this menu options i.e.
Code:
client_cmd(id, "say_team ^"%s^" changeclass 1", botname)
aren't executing. the goal is to have the client say 'someplayer changeclass *' in the team speak channel, but it hasn't worked in ANY plugin revision. does anyone have any insight into how to accomplish this?
Code:
#include <amxmodx> #include <amxmisc> #define PLUGIN "foxbot commanders menu" #define VERSION "0.3" #define AUTHOR "stanwebber" new botname[32] public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_clcmd("botmenu", "botTarget", 0, "Bot command menu")     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     get_user_name(entid, botname, 31)     showBotClass(id)     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^n^n9. previous menu^n0. exit")     show_menu(id, keyRole, menuRole, -1, "changeBotRole")     return PLUGIN_HANDLED } public botClass(id, key) {     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:{         showBotRole(id)         }     }     return PLUGIN_HANDLED } public botRole(id, key) {     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:{         showBotClass(id)     } case 9:{         return PLUGIN_HANDLED         }     }     return PLUGIN_HANDLED }
stanwebber is offline
stanwebber
Junior Member
Join Date: Apr 2006
Old 07-30-2006 , 18:50   Re: please fix my bot command menu system plugin
Reply With Quote #5

the plugin is working now no thanks to anyone here giving me the slightest bit of help at any step. i fixed it by changing
Code:
client_cmd(id, "say_team ^"%s^" changeclass 1", botname)
to
Code:
engclient_cmd(id, "say_team", botname, "changeclass 1")
engclient_cmd(id, "say_team ^"%s^" changeclass 1", botname) did not work either
stanwebber is offline
Reply



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 01:56.


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