SA-MP Forums Archive
[Plugin] MTA -> SA-MP Map Converter v1.0 (MTA DM & MTA Race support) - 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: Plugin Development (https://sampforum.blast.hk/forumdisplay.php?fid=18)
+--- Thread: [Plugin] MTA -> SA-MP Map Converter v1.0 (MTA DM & MTA Race support) (/showthread.php?tid=503008)

Pages: 1 2


MTA -> SA-MP Map Converter v3.0 (MTA DM & MTA Race support) - kurta999 - 27.03.2014

MTA -> SA-MP Map converter
This is a map converter plugin which purpose is converting maps from MTA to SAMP as easy as possible. You can just drag'n'drop your MTA maps, even folder containing maps to scriptfiles\maps\MTA and start the server.

With this converter you can load map to your server. You can even of course unload it, and convert it. For a deeper knownledge see MapConverter.pwn.

Supported elements:
Usage:

Extract MapConverter.zip into your server root directory. In server.cfg add MapConverter to plugins and MapConverter to filterscripts too!

Afterwards move your maps to scriptfiles\maps\MTA which you want to convert. Start the server. Converter will convert every .map files from MTA directory to scriptfiles\maps\SAMP directory.

Natives:

pawn Код:
native MC_LoadMap(const mapname[], callPawnFunctions);
native MC_LoadAllMap(callPawnFunctions);
native MC_UnloadMap(const mapname[]);
native MC_SaveMap(mapid, E_SavingFlags:flags);
native MC_GetMapName(mapid, name[], len = sizeof(name));
native MC_GetIDFromName(const mapname[]);
native MC_IsValidMap(mapid);
native MC_GetMapUpperID();
Saving options

pawn Код:
enum E_SavingFlags
{
    ONLY_CREATE_VEHICLE = 1, // There will be no special data converted ex: paintjob, interior and mods. Only CreateVehicle() line
    CONVERT_NUMBER_PLATE = 2, // Convert vehicle number plate?
    HIDE_WHEN_ALPHA_NOT_255 = 4, // If you change the object alpha value different than 255, then hide object in samp? Its useful if you want to create invisible objects in samp
    CONVERT_ELEMENT_NAME = 8 // Convert the name of the element which you give to the element in MTA, useful if you want to find specific model after conversion
};
Callbacks:

pawn Код:
forward OnMapLoadingStart(mapid, EMapType:maptype, callPawnFunctions);
forward OnMapLoadingFinish(mapid, EMapType:maptype, callPawnFunctions, objects, removeobjects, vehicles, markers, pickups, actors);

forward OnObjectDataLoaded(mapid, modelid, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ, interior, virtualworld);
forward OnObjectDataUnLoaded(mapid, extraid);
forward OnRemoveObjectDataLoaded(mapid, modelid, Float:fX, Float:fY, Float:fZ, Float:fRadius);
forward OnRemoveObjectDataUnLoaded(mapid, extraid);
forward OnVehicleDataLoaded(mapid, modelid, Float:fX, Float:fY, Float:fZ, Float:fAngle, color1, color2, paintjob, upgrades[], plate[], interior, virtualworld);
forward OnVehicleDataUnLoaded(mapid, extraid);
forward OnMarkerDataLoaded(mapid, E_MarkerType:type, Float:fX, Float:fY, Float:fZ, Float:fSize, interior, virtualworld);
forward OnMarkerDataUnLoaded(mapid, extraid);
forward OnPickupDataLoaded(mapid, modelid, Float:fX, Float:fY, Float:fZ, virtualworld);
forward OnPickupDataUnLoaded(mapid, extraid);
forward OnActorDataLoaded(mapid, modelid, Float:fX, Float:fY, Float:fZ, Float:fAngle, virtualworld);
forward OnActorDataUnLoaded(mapid, extraid);
Example output of a MTA map:
pawn Код:
#include <a_samp>
#include <streamer>
// Map Type: DM

public OnPlayerConnect(playerid)
{
    /*-------------------------------------------------- Remove Objects -------------------------------------------------*/
    RemoveBuildingForPlayer(playerid, 1418, 2512.260254, -1683.393311, 13.234910, 3.923507);
    RemoveBuildingForPlayer(playerid, 1418, 2517.184814, -1684.861694, 13.543220, 3.923507);
    RemoveBuildingForPlayer(playerid, 1410, 2498.239990, -1688.230103, 13.295510, 4.462929);
    RemoveBuildingForPlayer(playerid, 1410, 2493.158691, -1687.941772, 13.388060, 4.462929);
    RemoveBuildingForPlayer(playerid, 1410, 2487.835693, -1687.999146, 13.150440, 4.462929);
    return 1;
}

public OnFilterScriptInit()
{
    new tempvehid;

    /*-------------------------------------------------- Objects -------------------------------------------------*/
    CreateDynamicObject(1225, 2496.800049, -1672.699951, 12.700000, 0.000000, 0.000000, 0.000000); // object (barrel4) (1)
    CreateDynamicObject(1225, 2495.100098, -1672.699951, 12.700000, 0.000000, 0.000000, 0.000000); // object (barrel4) (2)
    CreateDynamicObject(1225, 2495.199951, -1674.500000, 12.700000, 0.000000, 0.000000, 0.000000); // Test name
    CreateDynamicObject(1225, 2497.300049, -1674.500000, 12.700000, 0.000000, 0.000000, 0.000000); // object (barrel4) (4)
    CreateDynamicObject(1225, 2497.800049, -1676.400024, 12.800000, 0.000000, 0.000000, 0.000000); // object (barrel4) (5)
    CreateDynamicObject(1225, 2495.699951, -1676.400024, 12.700000, 0.000000, 0.000000, 0.000000); // object (barrel4) (6)
    CreateDynamicObject(1225, 2496.100098, -1678.199951, 12.700000, 0.000000, 0.000000, 0.000000); // object (barrel4) (7)
    CreateDynamicObject(1225, 2498.600098, -1678.500000, 12.800000, 0.000000, 0.000000, 0.000000); // object (barrel4) (8)
    CreateDynamicObject(1225, 2499.399902, -1680.800049, 12.800000, 0.000000, 0.000000, 0.000000); // object (barrel4) (9)
    CreateDynamicObject(1225, 2497.000000, -1680.699951, 12.800000, 0.000000, 0.000000, 0.000000); // object (barrel4) (10)
    CreateDynamicObject(1218, 2493.300049, -1672.800049, 12.800000, 0.000000, 0.000000, 0.000000); // object (barrel1) (1)
    CreateDynamicObject(1218, 2493.500000, -1674.300049, 12.800000, 0.000000, 0.000000, 0.000000); // object (barrel1) (2)
    CreateDynamicObject(1218, 2493.800049, -1675.900024, 12.800000, 0.000000, 0.000000, 0.000000); // object (barrel1) (3)
    CreateDynamicObject(1218, 2493.899902, -1677.599976, 12.800000, 0.000000, 0.000000, 0.000000); // object (barrel1) (4)
    CreateDynamicObject(1218, 2494.899902, -1680.400024, 12.800000, 0.000000, 0.000000, 0.000000); // object (barrel1) (5)

    /*-------------------------------------------------- Vehicles -------------------------------------------------*/
    tempvehid = CreateVehicle(534, 2485.199951, -1679.500000, 13.200000, 0.000000, 86, 1, -1); // vehicle (Remington) (1)
    ChangeVehiclePaintjob(tempvehid, 2);
    AddVehicleComponentInline(tempvehid, 1087, 1010, 1126, 1185, 1178, 1080, 1122);
    tempvehid = CreateVehicle(560, 2480.899902, -1679.099976, 13.100000, 0.000000, 79, 29, -1); // vehicle (Sultan) (1)
    AddVehicleComponentInline(tempvehid, 1033, 1138, 1028, 1079, 1010, 1087, 1030, 1169, 1141);

    /*-------------------------------------------------- Checkpoints -------------------------------------------------*/
    CreateDynamicRaceCP(2, 2481.8999, -1661.1000, 13.3000, 0.0, 0.0, 0.0, 1.0000); // SAMP CP 1
    CreateDynamicRaceCP(2, 2482.3000, -1655.5000, 13.3000, 0.0, 0.0, 0.0, 1.0000); // marker (cylinder) (1)
    CreateDynamicCP(2477.2000, -1661.5000, 12.2645, 1.0000); // SAMP RaceCP
    CreateDynamicRaceCP(4, 2483.5000, -1658.2000, 17.3000, 0.0, 0.0, 0.0, 1.0000); // marker (ring) (1)
    CreateDynamicRaceCP(4, 2480.0000, -1658.4000, 15.1000, 0.0, 0.0, 0.0, 1.0000); // marker (ring) (2)
    CreateDynamicRaceCP(2, 2488.8000, -1656.9000, 13.4000, 0.0, 0.0, 0.0, 1.0000); // This corona has the maximum possible name lengt, do you see it? a
    SetDynamicObjectMaterial(CreateDynamicObject(19180, 2488.000000, -1665.900024, 14.800000, 0.0, 0.0, 0.0), 0, 0, "a", "a", 0xFD2900FF); // marker (arrow) (1)

    /*-------------------------------------------------- Pickups -------------------------------------------------*/
    CreateDynamicPickup(1240, 2, 2476.600098, -1684.300049, 13.400000); // pickup (health) (1)
    CreateDynamicPickup(356, 2, 2474.399902, -1683.400024, 13.400000); // pickup (M4) (1)
    CreateDynamicPickup(348, 2, 2471.899902, -1681.900024, 13.400000); // pickup (Deagle) (1)
    CreateDynamicPickup(1240, 2, 2482.800049, -1679.500000, 13.300000); // pickup (health) (4)
    CreateDynamicPickup(1242, 2, 2470.199951, -1679.900024, 13.500000); // pickup (armor) (1)
    CreateDynamicPickup(342, 2, 2468.699951, -1678.400024, 13.500000); // pickup (Grenade) (1)
    CreateDynamicPickup(362, 2, 2467.800049, -1677.199951, 13.500000); // pickup (Minigun) (1)

    /*-------------------------------------------------- Actors -------------------------------------------------*/
    CreateActor(169, 2478.800049, -1685.900024, 13.500000, 0.003000); // I would fuck her ass
    CreateActor(219, 2480.699951, -1686.099976, 13.500000, 30.000000); // ped (2)
    CreateActor(217, 2477.000000, -1686.099976, 13.500000, 180.000000); // Staff member guy
    CreateActor(145, 2485.000000, -1688.900024, 15.700000, 180.000000); // Drug bitch
    return 1;
}

stock AddVehicleComponentInline(vehicleid, ...)
{
    for (new i = 0, j = numargs(); i != j; ++i)
        AddVehicleComponent(vehicleid, getarg(i));
}
Download:
https://github.com/kurta999/MapConverter


Re: MTA -> SA-MP Map Converter v1.0 (MTA DM & MTA Race support) - Pottus - 27.03.2014

OnConvertationStart should be OnConversionStart spelling error


Re: MTA -> SA-MP Map Converter v1.0 (MTA DM & MTA Race support) - kurta999 - 27.03.2014

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
OnConvertationStart should be OnConversionStart spelling error
I'll change it in 1.1, I was think that name is bad
Thanks.


Re: MTA -> SA-MP Map Converter v1.0 (MTA DM & MTA Race support) - Schocc - 27.03.2014

Nice work, rep+=4.
no comments, very good


Re: MTA -> SA-MP Map Converter v1.0 (MTA DM & MTA Race support) - iZN - 27.03.2014

Awesome work. I was just going to develop something like that for personal use, but you made it already. Good!


Re: MTA -> SA-MP Map Converter v1.0 (MTA DM & MTA Race support) - Niko_boy - 28.03.2014

Very great plugin. loved callbacks implemented and the plans for future !


Re: MTA -> SA-MP Map Converter v1.0 (MTA DM & MTA Race support) - PT - 28.03.2014

Nice work man.


Re: MTA -> SA-MP Map Converter v1.0 (MTA DM & MTA Race support) - Ayham - 28.03.2014

Nice.


Re: MTA -> SA-MP Map Converter v1.0 (MTA DM & MTA Race support) - kurta999 - 28.03.2014

Thanks.

Would be good if someone would send me one MTA map which uses Roller Coaster Generator (RCG) resource. I need this to add support for convert rcg resource.


Re: MTA -> SA-MP Map Converter v1.0 (MTA DM & MTA Race support) - khimera - 27.08.2014

Did everything like you said here and when I reloadfs converter 'Sa-MP dedicated server stopped working', it crashes


Re: MTA -> SA-MP Map Converter v1.0 (MTA DM & MTA Race support) - MehranGta - 19.05.2015

Nothing happend after I did reloadfs converter


Re: MTA -> SA-MP Map Converter v1.0 (MTA DM & MTA Race support) - kurta999 - 31.01.2017

Does somebody would interested in better version of this plugin?

I have rewritten it before some weeks ago, just for learning some new techniques in C++. Now it works both at windows & linux. It converts everything from MTA, even peds to actors.

After the conversion has done, it creates a complete compilable .pwn file which you can load into server or copy conent of .pwn file and paste it into your object script. Its possible to call a pawn callback during the conversion with converted object parameters, this is useful when you want to test the map in game to make sure that you like it or not.

ofc, it is very fast.


Re: MTA -> SA-MP Map Converter v1.0 (MTA DM & MTA Race support) - iLearner - 31.01.2017

Quote:
Originally Posted by kurta999
View Post
Does somebody would interested in better version of this plugin?

I have rewritten it before some weeks ago, just for learning some new techniques in C++. Now it works both at windows & linux. It converts everything from MTA, even peds to actors.

After the conversion has done, it creates a complete compilable .pwn file which you can load into server or copy conent of .pwn file and paste it into your object script. Its possible to call a pawn callback during the conversion with converted object parameters, this is useful when you want to test the map in game to make sure that you like it or not.

ofc, it is very fast.
There's no harm in posting it, it might come handy to people, now or maybe in future


Re: MTA -> SA-MP Map Converter v1.0 (MTA DM & MTA Race support) - kurta999 - 04.02.2017

If somebody could send me some MTA (not race) maps which contains vehicles (with upgrades), peds, checkpoints, etc.., I would be very happy. I need them for testing.

With a 8KB/s mobile internet, it's fucking hard to browse


Re: MTA -> SA-MP Map Converter v1.0 (MTA DM & MTA Race support) - Crayder - 04.02.2017

Does this load the files and create everything? OR does it just output a pwn file?


Re: MTA -> SA-MP Map Converter v1.0 (MTA DM & MTA Race support) - kurta999 - 04.02.2017

Dont try it yet, its a bugged shit xD the git version (3.0) is good, which isnt released yet

Does this load the files and create everything? OR does it just output a pwn file?

Both possible.


Re: MTA -> SA-MP Map Converter v1.0 (MTA DM & MTA Race support) - Crayder - 05.02.2017

Quote:
Originally Posted by John252
View Post
How about you try it? uL piece of shit.
Lol... First off, I would've tried it but he said he's making a new version, so why would I try the old version? Second, why the insults... xD

Quote:
Originally Posted by kurta999
View Post
Does this load the files and create everything? OR does it just output a pwn file?

Both possible.
Awesome!


Re: MTA -> SA-MP Map Converter v1.0 (MTA DM & MTA Race support) - kurta999 - 05.02.2017

Crayder: have you tried to load ipl into samp, if yes it was succesdfully? Ive tried before but idk how i should convert these quats, there are something changed because "normal" quat algorithms doesnt works.

Mi idea was before to use limit adjustert and load all server obj as ipl. Benefits would be: smoother obj loading, lod support, badwich saving

I can do everything except convert these f.... Quats to euler angles and vice versa


Re: MTA -> SA-MP Map Converter v1.0 (MTA DM & MTA Race support) - Crayder - 05.02.2017

Quote:
Originally Posted by kurta999
View Post
Crayder: have you tried to load ipl into samp, if yes it was succesdfully? Ive tried before but idk how i should convert these quats, there are something changed because "normal" quat algorithms doesnt works.

Mi idea was before to use limit adjustert and load all server obj as ipl. Benefits would be: smoother obj loading, lod support, badwich saving

I can do everything except convert these f.... Quats to euler angles and vice versa
I don't think anyone has found a perfect way to convert GTA's quats to euler angles... In ColAndreas we extract the IPL data here and convert the angles with this.


Re: MTA -> SA-MP Map Converter v1.0 (MTA DM & MTA Race support) - kurta999 - 05.02.2017

Whats the problem with your version exactly?