Raised This Month: $51 Target: $400
 12% 

Error 033 : Array must be indexed


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
atomen
Veteran Member
Join Date: Oct 2006
Location: Stockholm, Sweden
Old 06-12-2008 , 10:58   Error 033 : Array must be indexed
Reply With Quote #1

Hi !

I'm creating a point system and it works pretty well.
Though right now I'm having a compile problem.
Quote:
Error 033: array must be indexed (variable "-unknown-")
Quote:
033 array must be indexed (variable name)
An array as a whole cannot be used in a expression; you must indicate
an element of the array between square brackets.
Here's my script :
PHP Code:
new check check_exist(index); //This is where my error is occurring
if(check
Here's the function :
PHP Code:

check_exist
(indexpoints 0)
{
    if(
is_ps_on())
    {
        new 
readdata[128];
        new 
steamid[2][MAX_PLAYERS 1];
        new 
points[8], txtlen;

        new 
fsize file_size(filename1);
        for(new 
line 0line <= fsizeline++)
        {
            if(
line == 1)
                
line++;

            
read_file(filenamelinereaddata127txtlen);

            if(!
points)
                
parse(readdatasteamid[PARSED], MAX_PLAYERS);

            else if(
points)
                
parse(readdatasteamid[PARSED], MAX_PLAYERSpoints7);

            
get_user_authid(indexsteamid[ACTIVE], MAX_PLAYERS);

            if(
equal(steamid[ACTIVE], steamid[PARSED]))
            {
                if(!
points)
                    return 
line;

                else if(
points)
                {
                    
str_to_num(points);
                    return 
points;
                }
            }
        }
    }

    return 
0;

__________________
atomen is offline
Send a message via MSN to atomen
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-12-2008 , 11:24   Re: Error 033 : Array must be indexed
Reply With Quote #2

You return an array : return points;

And new check is an integer... That's normal you get this error.
__________________
Arkshine is offline
atomen
Veteran Member
Join Date: Oct 2006
Location: Stockholm, Sweden
Old 06-12-2008 , 11:49   Re: Error 033 : Array must be indexed
Reply With Quote #3

How should I solve it in this case ?
__________________
atomen is offline
Send a message via MSN to atomen
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-12-2008 , 12:15   Re: Error 033 : Array must be indexed
Reply With Quote #4

I've misread. -_-'

Actually, this is wrong :

Quote:
str_to_num(points);
return points;
Do : return str_to_num(points);
__________________
Arkshine is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-12-2008 , 12:30   Re: Error 033 : Array must be indexed
Reply With Quote #5

Do not pass 'points' in the function AND declare it in this function :

Code:
check_exist(index, points = 0)
{     if(is_ps_on())     {         new readdata[128];         new steamid[2][MAX_PLAYERS + 1];
        new points[8], txtlen;
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-12-2008 , 12:34   Re: Error 033 : Array must be indexed
Reply With Quote #6

mis-read 2 times lol. I'm tired. -_-'
__________________
Arkshine 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 09:07.


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