Jump to content

Elements To Lua Converter (Vehicles, Objects, Markers..)


AleksCore

Recommended Posts

[ETL] Elements To Lua Converter by AleksCore

Simple script (tool for map editor) to output position, rotation (and other properties) of vehicles (objects/markers/peds) to lua format.

How it works?

First of all start Map Editor and start this script (/start etl) :D, then:

1) Select vehicle (object/marker/ped) and press "H".

2) Open "Output Box" by pressing CTRL + G

3) You will get something like that:

createVehicle(411, 1234, -634, 20, 0, 0, 90) --if you was selected vehicle 

or

createMarker(1234, -634, 20, "corona", 10, 255, 255, 255, 255) --if you was selected marker 

4) You can also convert all vehicles (objects/markers/peds) from map by pressing "All Vehicles to lua" button in menu

Screenshots:

10458.png

10457.png

P.S. This is my first script with GUI.

Link to download

Edited by Guest
Link to comment
  • 2 weeks later...

I dug through the code to find something to complain about this resource:

function VehiclesToLua() 
vehicles = getElementsByType("vehicle") 
for key, vehicle in ipairs(vehicles) do 
x, y, z = getElementPosition(vehicle) 
rx, ry, rz = getElementRotation(vehicle) 
model = getElementModel(vehicle) 
    oldText = guiGetText(outputBoxMemo) 
    guiSetText(outputBoxMemo, oldText.."createVehicle("..model..", "..x..", "..y..", "..z..", "..rx..", "..ry..", "..rz..")") 
end 

You shouldn't really do this. Other resources can create vehicles, you know? Consider using the API (exports) that the map editor provides you.

Indent your code.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...