Jump to content

New Question :P


12p

Recommended Posts

Posted

Sorry about this, guys. How can I save all the objects I have created in a LUA file?

I mean, I want to create 1 line for each object in the map, so next time the resource start, every object will be respawned.

This is the (not ready) code I have:

addEventHandler ("onClientPlayerQuit",getRootElement(), 
function ()  
 for i,theBlock in ipairs (blocks) do --"blocks" is a table that returns all the objects I need. 
  --What to do here? 
 end 
end) 

Can anybody, at least, give me a clue?

Posted

why?

it's more efficient, and these functions will make things easy

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted

well if you want to store something client-side, your only option is XML really, file functions are server-side only as i recall.

though you can export/create server-side Lua file which will create the objects, but then you'll need to figure a way for it to run.

like some separate "lua-map" resource that you will update with your lua files and restart. that's first that comes to mind :D

or something with runcode/loadstring.

imo XML is the way, why create mapping system if there already is one.

?

Posted

Well said. You can save whatever objects or other elements you've created with a line or two of code, if you do things properly and use the MTA map format.

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...