Raised This Month: $ Target: $400
 0% 

[Solved] Error 033: array must be indexed


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
wangbochiang
Member
Join Date: Aug 2006
Location: Taiwan - Taichung
Old 08-16-2010 , 05:19   [Solved] Error 033: array must be indexed
Reply With Quote #1

I have stuck on this wried error and I cant fix this...

I wanna save climber timer when he was disconnect

and when the climber came back server,

timer will set to when he was left the server.

here is the pic of error


here is declaration of timersave
PHP Code:
new const NULLSTR[ ] = ""
//Temp save vars ; took from Climb
new savepos 0steamid[32][32], Float:originssave[32][48], timersave[32][15], Float:originstemp[33][48
and here is the code between 830-835..

PHP Code:
        timersave[savepos] = g_playertime[id//save timer array
        
        //clear data for new client in that slot
        
for( new 048i++ ) g_player_specposition[id][i] = 0.0
        
for( new 014i++ ) g_playertime[id][i] = 0
    


if that will be so smooth.. here is my whole save pos and timer code down here
what I trying to transform from Climb to Kz-Arg

PHP Code:
public client_disconnect(id)
{
    if( 
g_playerisvip[id] )
        
fm_remove_model_ents(id)
    
remove_task(id+TASK_ID_MINISECOND)
    
remove_task(id+TASK_ID_NIGHTVISION)
    
remove_task(id+TASK_ID_WELCOMMSG)
// start save pos and timer !

    
if( get_pcvar_num(cvar_enable) )
    {
        
savepos++
        if( 
savepos == 31 savepos 0
        
        
new saveid[32]
        
get_user_authididsaveid32 )
        
        
//erase previous save if exists
        
for( new i=0i<32i++ )
            if( 
equalsaveidsteamid[i] ) ) steamid[i] = NULLSTR        
        
        
        
if( g_playertime[id] && g_playerstart[id] ) g_playerpaused[id] = //Pause if running
        
        
pev(idpev_originoriginstemp[id])
        
steamid[savepos] = saveid //save steamid to position reference
        
originssave[savepos] = originstemp[id//save origins 
        
timersave[savepos] = g_playertime[id//save timer array
        
        //clear data for new client in that slot
        
for( new 048i++ ) g_player_specposition[id][i] = 0.0
        
for( new 014i++ ) g_playertime[id][i] = 0
    
}


when player putinserver

PHP Code:
public client_putinserver(id)
{
    if( 
get_pcvar_num(kz_welcomemsg) == )
        
set_task(1.0"welcomemsg"id+TASK_ID_WELCOMMSG)
        
    
//search steamid to position reference for match
    
new searchid[32]
    
get_user_authididsearchid31 )
    for(new 
032i++ )
        if( 
equalsearchidsteamid[i] ) )
        {
//load origins & timer array if match found
            
set_pev(idpev_originoriginssave[id])
            
timer[id] = timersave[i]
        }
         
//blah blah down here is original kz-arg code..

thanks is advance and sorry my bad english..
Attached Thumbnails
Click image for larger version

Name:	error033.jpg
Views:	516
Size:	17.2 KB
ID:	71720  
__________________
Catch me on : @twitter

Last edited by wangbochiang; 08-16-2010 at 13:09.
wangbochiang is offline
Send a message via MSN to wangbochiang Send a message via Yahoo to wangbochiang Send a message via Skype™ to wangbochiang
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-16-2010 , 05:35   Re: Error 033: array must be indexed
Reply With Quote #2

Show the declaration of timersave.
__________________
Arkshine is offline
wangbochiang
Member
Join Date: Aug 2006
Location: Taiwan - Taichung
Old 08-16-2010 , 05:43   Re: Error 033: array must be indexed
Reply With Quote #3

Quote:
Originally Posted by Arkshine View Post
Show the declaration of timersave.
here it is

PHP Code:
new const NULLSTR[ ] = ""
//Temp save vars ; took from Climb
new savepos 0steamid[32][32], Float:originssave[32][48], timersave[32][15], Float:originstemp[33][48
thank you for helping me :'(
__________________
Catch me on : @twitter
wangbochiang is offline
Send a message via MSN to wangbochiang Send a message via Yahoo to wangbochiang Send a message via Skype™ to wangbochiang
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-16-2010 , 09:01   Re: Error 033: array must be indexed
Reply With Quote #4

There are numerous things that need fixing in your code. For this particular error:

timersave array is 2-dimensional and you are using it as a 1-dimension array.

timersave[32][15]
timersave[savepos] = g_playertime[id]

The compiler expects this:

timersave[savepos][ some_other_index ] = g_playertime[id]
__________________
Bugsy is offline
wangbochiang
Member
Join Date: Aug 2006
Location: Taiwan - Taichung
Old 08-16-2010 , 13:08   Re: Error 033: array must be indexed
Reply With Quote #5

Quote:
Originally Posted by Bugsy View Post
There are numerous things that need fixing in your code. For this particular error:

timersave array is 2-dimensional and you are using it as a 1-dimension array.

timersave[32][15]
timersave[savepos] = g_playertime[id]

The compiler expects this:

timersave[savepos][ some_other_index ] = g_playertime[id]
thank you Bugsy, Now plugin is working fine
__________________
Catch me on : @twitter
wangbochiang is offline
Send a message via MSN to wangbochiang Send a message via Yahoo to wangbochiang Send a message via Skype™ to wangbochiang
Reply


Thread Tools
Display Modes

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 21:55.


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