AleksCore Posted April 28, 2013 Share Posted April 28, 2013 (edited) [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) , 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: P.S. This is my first script with GUI. Link to download Edited November 15, 2014 by Guest Link to comment
PaiN^ Posted April 29, 2013 Share Posted April 29, 2013 Looks great for a first script ! Keep up .. Link to comment
qaisjp Posted May 9, 2013 Share Posted May 9, 2013 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
ixjf Posted May 9, 2013 Share Posted May 9, 2013 Besides what A Concerned Citizen mentioned, you should use local variables except when strictly needed and perhaps, to make code look cleaner and easier to read, use format method from the Lua string library instead of formatting and sending the string directly to the function. Note that we are just trying to help you, so that you don't make the same mistakes twice. Link to comment
AleksCore Posted May 13, 2013 Author Share Posted May 13, 2013 A Concerned Citizen, ixjf, thx, but the only thing that I understand from this - I have to use local variables less ehh, programming it's not my.. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now