SA-MP Forums Archive
Objects Not Loading! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Objects Not Loading! (/showthread.php?tid=542600)



Objects Not Loading! - Chrillzen - 20.10.2014

Hey guys. I'm having a small problem with my furniture system that I'm working on. Basically I made the loading/saving system and also the furniture command which adds a furniture that you can edit. It saves the file and all the variables are correct and it also loads all the files. However, it does not add the object to the server. There is no object there when I log in. I need some help.

LOADING CODE:

pawn Код:
new furniturestring[256];
    for(new ida = 1; ida < sizeof(FurnitureInfo); ida++)
    {
        format(furniturestring, sizeof(furniturestring), FURNITUREPATH, ida);
        INI_ParseFile(furniturestring, "loadfurniture_%s", .bExtra = true, .extra = ida );
    }
   
    new fcount;
    for(new i= 0; i < MAX_FURNITURE; i++)
    {
        if(FurnitureInfo[i][furnitureID] != 0) fcount++;
       
        FurnitureInfo[i][furnitureID] = CreateDynamicObject(FurnitureInfo[i][furnitureModel], FurnitureInfo[i][furnitureX], FurnitureInfo[i][furnitureY], FurnitureInfo[i][furnitureZ], FurnitureInfo[i][furniturerX], FurnitureInfo[i][furniturerY], FurnitureInfo[i][furniturerZ], FurnitureInfo[i][furnitureWorld], FurnitureInfo[i][furnitureInt], -1, 200.0, 0.0);
    }
    printf("  Loaded %d furnitures.", fcount);



Re: Objects Not Loading! - AroseKhanNiazi - 20.10.2014

is it under OnGamemodeInit and did u try that it really loads variables correctly because mostly its the problem of loading...


Re: Objects Not Loading! - Chrillzen - 20.10.2014

It is under OnGameModeInit.

It should be loading the variables.

pawn Код:
public loadfurniture_data(ida, name[], value[])
{
    INI_Int("Model", FurnitureInfo[ida][furnitureModel]);
    INI_Int("ID", FurnitureInfo[ida][furnitureID]);
    INI_Int("Int", FurnitureInfo[ida][furnitureInt]);
    INI_Int("World", FurnitureInfo[ida][furnitureWorld]);
    INI_Float("X", FurnitureInfo[ida][furnitureX]);
    INI_Float("Y", FurnitureInfo[ida][furnitureY]);
    INI_Float("Z", FurnitureInfo[ida][furnitureZ]);
    INI_Float("rX", FurnitureInfo[ida][furniturerX]);
    INI_Float("rY", FurnitureInfo[ida][furniturerY]);
    INI_Float("rZ", FurnitureInfo[ida][furniturerZ]);
    return 1;
}



Re: Objects Not Loading! - AroseKhanNiazi - 20.10.2014

i mean try printing the result that it loads or not


Re: Objects Not Loading! - Chrillzen - 20.10.2014

Alright I debugged it and the first code did not load the variables correctly. HOWEVER this code does but it still does not create the objects.

pawn Код:
new fcount;
    for(new i = 1; i < sizeof(FurnitureInfo); i++)
    {
        if(FurnitureInfo[i][furnitureID] != 0) fcount++;
       
        FurnitureInfo[i][furnitureID] = CreateDynamicObject(FurnitureInfo[i][furnitureModel], FurnitureInfo[i][furnitureX], FurnitureInfo[i][furnitureY], FurnitureInfo[i][furnitureZ], FurnitureInfo[i][furniturerX], FurnitureInfo[i][furniturerY], FurnitureInfo[i][furniturerZ], FurnitureInfo[i][furnitureWorld], FurnitureInfo[i][furnitureInt], -1, 200.0, 0.0);
    }
    printf("  Loaded %d furnitures.", fcount);



Re: Objects Not Loading! - Chrillzen - 20.10.2014

I checked the debug and I noticed that it doesn't load the interior. It saves the interior correctly but it doesn't load it.. Ideas?

pawn Код:
public loadfurniture_data(ida, name[], value[])
{
    INI_Int("Model", FurnitureInfo[ida][furnitureModel]);
    INI_Int("ID", FurnitureInfo[ida][furnitureID]);
    INI_Int("Interior", FurnitureInfo[ida][furnitureInt]);
    INI_Int("World", FurnitureInfo[ida][furnitureWorld]);
    INI_Float("X", FurnitureInfo[ida][furnitureX]);
    INI_Float("Y", FurnitureInfo[ida][furnitureY]);
    INI_Float("Z", FurnitureInfo[ida][furnitureZ]);
    INI_Float("rX", FurnitureInfo[ida][furniturerX]);
    INI_Float("rY", FurnitureInfo[ida][furniturerY]);
    INI_Float("rZ", FurnitureInfo[ida][furniturerZ]);
    return 1;
}



Re: Objects Not Loading! - Chrillzen - 20.10.2014

It got fixed when I put everything in the same loop. Solved.


Re: Objects Not Loading! - AroseKhanNiazi - 20.10.2014

Great sorry i didn't saw the reply i was kinda busy helping other place