loading objects using xml loader
#1

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);
Reply
#2

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);
Reply
#3

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

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]);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)