Looping Problem (Loading Interiors)
#1

What's wrong in these loops? it's just loads everything in the first loop and doesn't load anything for the second one..
the second loop loads successfully if you put it in the first but it will not load the first loop which is the second one now.. !!

PHP код:
stock LoadInteriors()
{
    for(new 
0<= MAX_INTERIORSi++)
    {
        if(
fexist(InteriorFile(i)))
        {
            
INI_ParseFile(InteriorFile(i), "LoadInteriorData"falsetrueitruefalse);
            
InteriorCP[i] = CreateDynamicCP(INTInfo[i][INTCPOutX], INTInfo[i][INTCPOutY], INTInfo[i][INTCPOutZ], 1.500, -120);
            
            
// rest of loads...
        
}
    }
    for(new 
0<= MAX_INTERIORCPSi++)
    {
        if(
fexist(InteriorCPFile(i)))
        {
            
INI_ParseFile(InteriorCPFile(i), "LoadInteriorCPData"falsetrueitruefalse);
            
CreateDynamicObject(1559INTCPInfo[i][INTCPInX],INTCPInfo[i][INTCPInY],INTCPInfo[i][INTCPInZ], 0,0,0,-,-1, -120);
              
              
// rest of loads...
        
}
    }
    return 
1;
}
public 
OnGameModeInit()
{
    
DisableInteriorEnterExits();
    
LoadInteriors();
    return 
1;

Reply
#2

How much is MAX_INTERIORS?
Reply
#3

50 .. it's not about the max, it just work for the first loop whatever it is...
if you make the max_interiorcps the first loop, it will load perfect but the other loop (max_interiors) will not..
this includes the max_interiors either, if you make it the first it will work, but the other will not...
really CONFUSING!
Reply
#4

Try this:
pawn Код:
LoadInteriors()
{
    for(new i = 0; i < MAX_INTERIORS; i++)
    {
        if(fexist(InteriorFile(i)))
        {
            printf("Loading Int %d", i);
            INI_ParseFile(InteriorFile(i), "LoadInteriorData", .bExtra = true, .extra = i);
            InteriorCP[i] = CreateDynamicCP(INTInfo[i][INTCPOutX], INTInfo[i][INTCPOutY], INTInfo[i][INTCPOutZ], 1.5, 0, 0, -1, 20);

            // rest of loads...
        }
    }
    for(new i = 0; i < MAX_INTERIORCPS; i++)
    {
        if(fexist(InteriorCPFile(i)))
        {
            printf("Loading CP %d", i);
            INI_ParseFile(InteriorCPFile(i), "LoadInteriorCPData", .bExtra = true, .extra = i);
            CreateDynamicObject(1559, INTCPInfo[i][INTCPInX],INTCPInfo[i][INTCPInY],INTCPInfo[i][INTCPInZ], 0, 0, 0, -1 , -1, -1, 20);

              // rest of loads...
        }
    }
    return 1;
}
See if the lines 'Loading CP' and 'Loading Int' are being called. If they are being called, but nothing is loading correctly, show us your "LoadInteriorData" and "LoadInteriorCPData". If they are not being called, then make sure the files actually exist.
Reply
#5

Fixed, thank you :)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)