SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Plugin Development

Reply
 
Thread Tools Display Modes
Old 27/03/2014, 11:49 AM   #1
kurta999
High-roller
 
kurta999's Avatar
 
Join Date: Apr 2009
Location: Slovakia (HU)
Posts: 1,420
Reputation: 626
Default MTA -> SA-MP Map Converter v3.0 (MTA DM & MTA Race support)

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:
  • Objects - MTA DM & Race resource
  • Remove world objects
  • Vehicles (License plate, Interior, VirtualWorld, Paintjob, Mods, Color!)
  • Markers
  • Pickups
  • PEDs (aka Actors)

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 Code:
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 Code:
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 Code:
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 Code:
#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
__________________
I don't play and have ANY interest in SA:MP anymore! Please do not ask for help, because I'm not going to reply.

Last edited by kurta999; 15/02/2017 at 07:20 PM.
kurta999 is offline   Reply With Quote
Old 27/03/2014, 11:57 AM   #2
Pottus
Godfather
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 5,419
Reputation: 1240
Default Re: MTA -> SA-MP Map Converter v1.0 (MTA DM & MTA Race support)

OnConvertationStart should be OnConversionStart spelling error
Pottus is offline   Reply With Quote
Old 27/03/2014, 11:59 AM   #3
kurta999
High-roller
 
kurta999's Avatar
 
Join Date: Apr 2009
Location: Slovakia (HU)
Posts: 1,420
Reputation: 626
Default Re: MTA -> SA-MP Map Converter v1.0 (MTA DM & MTA Race support)

Quote:
Originally Posted by [uL]Pottus View Post
OnConvertationStart should be OnConversionStart spelling error
I'll change it in 1.1, I was think that name is bad
Thanks.
__________________
I don't play and have ANY interest in SA:MP anymore! Please do not ask for help, because I'm not going to reply.
kurta999 is offline   Reply With Quote
Old 27/03/2014, 12:04 PM   #4
Schocc
High-roller
 
Join Date: Mar 2012
Location: /home
Posts: 3,253
Reputation: 378
Default Re: MTA -> SA-MP Map Converter v1.0 (MTA DM & MTA Race support)

Nice work, rep+=4.
no comments, very good
Schocc is offline   Reply With Quote
Old 27/03/2014, 12:07 PM   #5
iZN
High-roller
 
Join Date: Jun 2010
Posts: 2,448
Reputation: 569
Default Re: MTA -> SA-MP Map Converter v1.0 (MTA DM & MTA Race support)

Awesome work. I was just going to develop something like that for personal use, but you made it already. Good!
__________________
iZN is offline   Reply With Quote
Old 28/03/2014, 10:24 AM   #6
Niko_boy
High-roller
 
Niko_boy's Avatar
 
Join Date: Aug 2010
Location: Somewhere i belong
Posts: 1,423
Reputation: 138
Default Re: MTA -> SA-MP Map Converter v1.0 (MTA DM & MTA Race support)

Very great plugin. loved callbacks implemented and the plans for future !
__________________
nope[IMG]http://*******/1r0SOkH_[/IMG]
•••[CLOSED]LCS•Freeroam•DM•Stunts•••AutoArena [0.3z][No SkinShot][sixtytiger.com]Want a decent Attack Defend Gamemode?
N/A176.31.229.148:7830Get This! Attack-Defend(v2.3.1)
Niko_boy is offline   Reply With Quote
Old 28/03/2014, 10:41 AM   #7
PT
Godfather
 
PT's Avatar
 
Join Date: Nov 2012
Location: Portugal
Posts: 7,202
Reputation: 775
Default Re: MTA -> SA-MP Map Converter v1.0 (MTA DM & MTA Race support)

Nice work man.
__________________
"Quem caiu e se levantou honrado era e honrado ficou..."


CVU vai voltar e.e


http://steamcommunity.com/id/pt_player/
PT is offline   Reply With Quote
Old 28/03/2014, 11:19 AM   #8
Ayham
Huge Clucker
 
Ayham's Avatar
 
Join Date: Nov 2013
Location: Dead Sea , Jordan
Posts: 240
Reputation: 26
Default Re: MTA -> SA-MP Map Converter v1.0 (MTA DM & MTA Race support)

Nice.
__________________
..:: || Back to SA-MP || ::..
..:: || 2009 - N/A || ::..
Ayham is offline   Reply With Quote
Old 28/03/2014, 11:47 AM   #9
kurta999
High-roller
 
kurta999's Avatar
 
Join Date: Apr 2009
Location: Slovakia (HU)
Posts: 1,420
Reputation: 626
Default Re: MTA -> SA-MP Map Converter v1.0 (MTA DM & MTA Race support)

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.
__________________
I don't play and have ANY interest in SA:MP anymore! Please do not ask for help, because I'm not going to reply.
kurta999 is offline   Reply With Quote
Old 27/08/2014, 11:34 AM   #10
khimera
Big Clucker
 
khimera's Avatar
 
Join Date: Jun 2014
Posts: 122
Reputation: 18
Default Re: MTA -> SA-MP Map Converter v1.0 (MTA DM & MTA Race support)

Did everything like you said here and when I reloadfs converter 'Sa-MP dedicated server stopped working', it crashes
khimera is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Include] rMTA - Easy MTA-Race Map Converter (Scriptside) Narushi Includes 8 23/12/2014 09:27 PM
[RYDER RACE] Race problem : Cant make new Race !!! S_ILYa™ Server Support 6 25/10/2014 01:51 PM
[Map] [Tuned Cars!][Drift!][Race!][Roleplay!] Aero's Underground Race League II! Aerotactics Maps 12 03/04/2014 12:23 PM
[Race]How to get Player Position in Race (example: 3rd/10) Basss Help Archive 5 17/07/2009 09:23 PM
[Tool/Web/Other] [TOOL] Offline Map, Car and Object Converter (MTA:Race->SA-MP) Shargrat Tools and Files 2 12/05/2009 03:26 PM


All times are GMT. The time now is 04:17 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.