Jump to content

[HELP] XML Save


^iiEcoo'x_)

Recommended Posts

addEventHandler ( 'onResourceStop' , resourceRoot ,
	function ( )
		local XmlSave = xmlCreateFile ( 'Xml-Files/Players-Money.xml' , 'root' )
		exports [ 'Useful-Functions' ]:outputMessage ( false , 'De-Bug' , '[Money System] : ( Players-Money.xml ) Created' , 0 , 255 , 0 , 3 )
		
		if ( XmlSave ) then
			local NewChild = xmlCreateChild ( XmlSave , 'Save' )
			xmlNodeSetAttribute ( NewChild , 'Table' , toJSON ( Settings [ 'Table' ] [ 'Money' ] ) )
			xmlSaveFile ( XmlSave )
		end 
	end 
)

Hi,

when resource stopped, xml created and saved.

but when server shutdown nothing saved !

so, how i can do the save of xml even the server is shutting down?

Link to comment

You have to shut down your server safely with ctrl+c in windows, or shutdown command in the server console. 

If the server is stopped abruptly, onResourceStop will not be triggered!

To avoid losing data in the instance your server crashes, I highly recommend saving important player data such as money every time you update something.

Link to comment
4 hours ago, Tails said:

You have to shut down your server safely with ctrl+c in windows, or shutdown command in the server console. 

If the server is stopped abruptly, onResourceStop will not be triggered!

To avoid losing data in the instance your server crashes, I highly recommend saving important player data such as money every time you update something.

thanks, done.

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