Raised This Month: $ Target: $400
 0% 

Array must be indexed


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
EpicKiller
Senior Member
Join Date: Jun 2014
Location: Constanta, Romania
Old 02-11-2015 , 17:14   Array must be indexed
Reply With Quote #1

Hi! So I have
PHP Code:
    static data[192], steamid[32], password[32], flags[32], mode[10];
    
    
ArrayClear(g_steamid);
    
ArrayClear(g_password);
    
ArrayClear(g_flags);
    
ArrayClear(g_mode);
    
    new 
fopen(filename"rt");
    
    while(!
feof(f))
    {
        
fgets(fdata191);
        
        if(
data[0] == "/" && data[1] == "/" || data[0] == ";" || !data[0] || data[0] == "^n")
            continue;
        
        if(
parse(datasteamid31password31flags31mode9) != 4)
            continue;
            
        
ArrayPushString(g_steamidsteamid);
        
ArrayPushString(g_passwordpassword);
        
ArrayPushCell(g_flagsread_flags(flags));
        
ArrayPushCell(g_moderead_flags(mode));
    } 
I'm getting an array indexing error for the first if statement. Could you please help? I'm clueless.
__________________
~ Swiftly and with style ~
EpicKiller is offline
Send a message via Yahoo to EpicKiller Send a message via Skype™ to EpicKiller
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-11-2015 , 17:38   Re: Array must be indexed
Reply With Quote #2

data[0] == '^n' ; Should be simple character. This is not a string, but a control character (new line). Remember ^ in pawn is to escape.

And by the way, since you use fgets, you don't need to check that.
__________________

Last edited by Arkshine; 02-11-2015 at 17:39.
Arkshine is offline
EpicKiller
Senior Member
Join Date: Jun 2014
Location: Constanta, Romania
Old 02-13-2015 , 16:03   Re: Array must be indexed
Reply With Quote #3

Oh, I see. Also, I had no idea I don't even have to check that. Thank you!
__________________
~ Swiftly and with style ~
EpicKiller is offline
Send a message via Yahoo to EpicKiller Send a message via Skype™ to EpicKiller
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 21:02.


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