Jump to content

[HELP] How to save table datas?


Tokio

Recommended Posts

Posted

if i create a table, and i insert datas with table.insert, the datas are deleted when i reconnect.. why? how to save datas?

sorry for my terrible english :ss 

My servers:

Fun:

n-560x95_FFFFFF_FFFFFF_000000_000000.png

Derby(DD):

n-560x95_FFFFFF_FFFFFF_000000_000000.png

Posted (edited)

Can you save through XML. here's an example:
 

function saveTable()
	local loadFile = xmlLoadFile("save.xml", "root")
	if not (loadFile) then
		loadFile = xmlCreateFile("save.xml", "root")
	end

	for i, v in ipairs(ourTable) do -- change 'ourTable' to your table name
	    local createChild = xmlCreateChild(loadFile, "vehicle")

	    xmlNodeSetAttribute(createChild, "x", v.x) -- v.x is your table value, just change it
	    xmlNodeSetAttribute(createChild, "y", v.y)
	    xmlNodeSetAttribute(createChild, "z", v.z)
	end
end
addCommandHandler("rsave", saveTable)


 

Edited by Geteco

~~ 'thanks' my post if i helped u (づ ̄ ³ ̄)づ

Dze5YZL.gif

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