An extract from a plugin I'm making.
I guess what the error means is that the array used in teleother_confirm_menu = menu_create(teleother_confirm_menu_name[id],"teleother_confirm_menu_handle") must be constant but im using a variable
I tried to fix it by formatting a string with the id already in it but it doesn't work.
PHP Code:
new teleother_confirm_menu[33]
new teleother_confirm_menu_name[33][58]
public teleother(id, targetid)
{
new Arg1[32]
read_argv(1, Arg1, 31)
new targetplayer = cmd_target(id, Arg1, 4)
if(!targetplayer)
{
client_print(id, print_chat, "%s Sorry, player %s could not be found or targetted!", PLUGIN_SNAME, Arg1)
return PLUGIN_HANDLED
}
else
{
new username[32]
get_user_name(targetplayer, username, 31)
format(teleother_confirm_menu_name[id], 57, "%s would like you to join them", username)
new menu_name[32]
format(menu_name, 31, "teleother_confirm_menu_name[%i]", id)
new menu_id[27]
format(menu_id, 26, "teleother_confirm_menu[%i]", id)
teleother_confirm_menu = menu_create(menu_name,"teleother_confirm_menu_handle")
menu_additem(menu_id, "yes", id)
menu_additem(menu_id, "no", id)
menu_display(targetplayer, menu_id, 0)
}
}
I can't really think at the moment, perhaps I am to tired but I would appreciate some help.
Thanks.
EDIT:
Other problem. The reason I have used arrays for a menu is because I couldn't think of any other way.
What I thought:
The menu is specific to a single player, so it can't be global/constant because then it wouldn't be specific as each player would see the same menu?
Solution, have many different menu's?
EDIT2: This code is so baad >.<