Garages not loading? rep
#1

Code:
http://pastebin.com/deBaR1HL

I included the majority of all the garage code, its dynamic.

I can create it in-game, etc it saves to the file but it never loads

+rep thanks
Reply
#2

You had the interior and owner variables switched when you were loading them.
PHP Code:
LoadGarages() {
 
    if(!
fexist("Garages/garages.cfg")) return 1;
 
    new
        
szFileStr[1024],
        
FileiFileHandle fopen("Garages/garages.cfg"io_read),
        
iIndex;
 
    while(
iIndex MAX_GARAGES && fread(iFileHandleszFileStr)) {
        if(!
sscanf(szFileStr"p<|>s[24]iffffffffiiii",
                
arrGarage[iIndex][b_szOwner],
                
arrGarage[iIndex][b_iInteriorID],
                
arrGarage[iIndex][b_fExteriorPos][0],
                
arrGarage[iIndex][b_fExteriorPos][1],
                
arrGarage[iIndex][b_fExteriorPos][2],
                
arrGarage[iIndex][b_fExteriorPos][3],
                
arrGarage[iIndex][b_fInteriorPos][0],
                
arrGarage[iIndex][b_fInteriorPos][1],
                
arrGarage[iIndex][b_fInteriorPos][2],
                
arrGarage[iIndex][b_fInteriorPos][3],
                
arrGarage[iIndex][b_iValue],
                
arrGarage[iIndex][b_iFee],
                
arrGarage[iIndex][b_iSafeMoney],
                
arrGarage[iIndex][b_iLocked])
        ) {
            if(!
isnull(arrGarage[iIndex][b_szOwner])) {
                
format(szFileStrsizeof(szFileStr), "Garage\n%s\nOwned by %s\nID: %d", ((arrGarage[iIndex][b_iLocked]) ? ("{FF0000}Closed{33AA33}") : ("{E8A831}Open{33AA33}")), arrGarage[iIndex][b_szOwner], iIndex);
            }
            else {
                
format(szFileStrsizeof(szFileStr), "{E8A831}This garage is for sale for $%d!\n{33AA33}/buygarage to purchase.\nID: %d"arrGarage[iIndex][b_iValue], iIndex);
            }
            
            if(
arrGarage[iIndex][b_iFee] > 0)
            {
                if(!
isnull(arrGarage[iIndex][b_szOwner])) format(szFileStrsizeof(szFileStr), "Garage\n%s\nEntrance fee: $%i\nOwned by %s\nID: %d", ((arrGarage[iIndex][b_iLocked]) ? ("{FF0000}Closed{33AA33}") : ("{E8A831}Open{33AA33}")), arrGarage[iIndex][b_iFee], arrGarage[iIndex][b_szOwner], iIndex);
            }
            
            
arrGarage[iIndex][b_iPickupID] = CreateDynamicPickup(123923arrGarage[iIndex][b_fExteriorPos][0], arrGarage[iIndex][b_fExteriorPos][1], arrGarage[iIndex][b_fExteriorPos][2], .worldid 0, .interiorid 0);
            
arrGarage[iIndex][b_tLabelID] = CreateDynamic3DTextLabel(szFileStrCOLOR_GREENarrGarage[iIndex][b_fExteriorPos][0], arrGarage[iIndex][b_fExteriorPos][1], arrGarage[iIndex][b_fExteriorPos][2] + 0.5,30.0, .testlos 1, .streamdistance 30.0, .worldid 0, .interiorid 0);
            ++
iIndex;
        }
    }
    
    return 
fclose(iFileHandle);

Reply
#3

This works, thank you!!!

But when it loads it says 'Owned by 0' instead of my name? And on the .ini file it says my name
Reply
#4

What's in the file?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)