SA-MP Forums Archive
loading objects using xml loader - 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: loading objects using xml loader (/showthread.php?tid=478120)



loading objects using xml loader - newbienoob - 28.11.2013

I want to load .map(mta map) file using xml loader by zeex. But I've got 1 problem. It only loads 1 object.

pawn Код:
enum obj
{
    modelid,
    Float:X,
    Float:Y,
    Float:Z,
    Float:rx,
    Float:ry,
    Float:rz
}
new Obj[][obj];


//gamemodeinit
    new XML:test = xml_open("testmap.map");
    new aaa = xml_get_int(test, "count(map/object)");
    for(new i = 0; i < sizeof(aaa); i++)
    {
        Obj[i][modelid] = xml_get_int(test, "map/object/@model");
        Obj[i][X] = xml_get_float(test, "map/object/@posX");
        Obj[i][Y] = xml_get_float(test, "map/object/@posY");
        Obj[i][Z] = xml_get_float(test, "map/object/@posZ");
        Obj[i][rx] = xml_get_float(test, "map/object/@rotX");
        Obj[i][ry] = xml_get_float(test, "map/object/@rotY");
        Obj[i][rz] = xml_get_float(test, "map/object/@rotZ");
        CreateDynamicObject(Obj[i][modelid] ,Obj[i][X] ,Obj[i][Y] ,Obj[i][Z] ,Obj[i][rx] ,Obj[i][ry] ,Obj[i][rz]);
    }
    xml_close(test);



Re: loading objects using xml loader - Avi Raj - 28.11.2013

You can use this :- MTA Map Loader

Usage:
* Place mtamap.inc in pawno/include folder
* Put #include mtamap on top of your gamemode script
* place all your .map files in the scriptfiles folder
* Use LoadMtaMap("filename.map") anywhere in your script to load map.
* compile and run your script, the objects will be loaded from file. You can unload filterscript after map is loaded

Example
pawn Код:
public OnGameModeInit()
{
    LoadMtaMap("LosSantos.map");
    LoadMtaMap("LasVenturas.map");
    LoadMtaMap("Island.map");
    LoadMtaMap("03ctest.map", true);
}
pawn Код:
LoadMtaMap("03ctest.map", true);



Re: loading objects using xml loader - newbienoob - 28.11.2013

No. I want to create my own. I don't like using a downloaded scripts.


Re: loading objects using xml loader - Avi Raj - 28.11.2013

The script defines this, so it will only show 1 Object.
Try adding it 5-10 times and tell result.
pawn Код:
CreateDynamicObject(Obj[i][modelid] ,Obj[i][X] ,Obj[i][Y] ,Obj[i][Z] ,Obj[i][rx] ,Obj[i][ry] ,Obj[i][rz]);