Raised This Month: $ Target: $400
 0% 

error 033: array must be indexed


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
moosewanted
Member
Join Date: May 2009
Old 05-25-2009 , 19:39   error 033: array must be indexed
Reply With Quote #1

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(idtargetid)
{
    new 
Arg1[32]
    
read_argv(1Arg131)
    new 
targetplayer cmd_target(idArg14)
    
    if(!
targetplayer)
    {
        
client_print(idprint_chat"%s Sorry, player %s could not be found or targetted!"PLUGIN_SNAMEArg1)
        return 
PLUGIN_HANDLED
    
}
    else
    {
        new 
username[32]
        
get_user_name(targetplayerusername31)

        
format(teleother_confirm_menu_name[id], 57"%s would like you to join them"username)
        new 
menu_name[32]
        
format(menu_name31"teleother_confirm_menu_name[%i]"id)
        new 
menu_id[27]
        
format(menu_id26"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(targetplayermenu_id0)
    }

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 >.<

Last edited by moosewanted; 05-25-2009 at 19:45.
moosewanted is offline
 



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:35.


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