Jump to content

Save data into a xml file


Recommended Posts

Posted

Hello guys, Can somebody how i can use XML Functions to save players in a xml file like example"data.xml" and in that file it should output the nick and some element data's(from my choice) everytime the player login or join.

Thanks in advance.

P.S:It would be cool if there is a function to refresh the xml file data's every minute.

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

You could use fileCreate functions, i find them pretty interesting.. i dont like xml tbh honest, and at a refresh of every min, you'll need something faster, where i'd suggest MTA's SQL integrated functions.

My ingame nick is ~HyPeX~

BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager

gKhdyRJ.png

Posted

I have no SQL knowledge..

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

I know but it's too advanced for me.

That's why i'm trying to do it with XML functions.

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted
I know but it's too advanced for me.

That's why i'm trying to do it with XML functions.

Trust me, XML will only cause problems, and it isnt that hard to learn SQL compared to XML either. (I myself have hard times at XML)

If you need some help about SQL/JQery, just check this webpage, its pretty awesome. http://www.w3schools.com/

My ingame nick is ~HyPeX~

BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager

gKhdyRJ.png

Posted

They are right, do it through SQL because XML isnt fast enough. If you have small server with few players.. maybe. I had it done thru XML as well at the start but when the number of accounts was about 1000 it started to lag.. and every time it had to load/save XML it lagged as hell.. so i went for MySQL.. today i have about 10k accounts in there and no lags at all. XML is just not supposed to be used fpr databases but more like config files.

Lua Scripter

?ucet=miki_cz

Owner of mshost.cz MTA portal.

Posted

You don't understand.

I'm trying to output every logged in player's data into "data.xml" not save them and load etc..

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

Thanks, And how i can use getElementData exactly to get some element data of the players?

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

I already know that-.-

The problem is where i shall locate it.

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

I know you're good at scripting, could you show us some small part of the code so we get what you actually want to do? Or if you're going to start one, please specify a little better how you want to use/save the element data :D

But i myself cant simply explain XML since i dont handle it so well.

My ingame nick is ~HyPeX~

BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager

gKhdyRJ.png

Posted

Trying to output every logged in player data(level, xp, rank, acl, challenges) in a xml file called"data.xml" only. And make it refresh every time a player login.

Simple :]

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

Simple, but it will be very laggy each access and search into that database to save/load the values.

My ingame nick is ~HyPeX~

BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager

gKhdyRJ.png

Posted

Omg.

I don't want to load them from XML.

I just want output the logged in players data every 30 seconds.

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

You need to load the file to edit it, it doesnt matter if you take values out from it or not.

I'd suggest you using down fileCreate functions for this instead. Check at how i managed to save registers down:

  
function onPlayerGuiRegister(user,pass) 
local result = addAccount(user, pass) 
if result == false then 
triggerClientEvent(source, "onClientGuiClickReturn", source, "Register", "false") 
else 
triggerClientEvent(source, "onClientGuiClickReturn", source, "Register", "true") 
if not fileExists("accounts.txt") then 
MyFile = fileCreate("accounts.txt") 
FileLength = fileGetSize(MyFile) 
fileSetPos(MyFile, FileLength) 
fileWrite(MyFile, "\n | Player: '"..getPlayerName(source).."' :^: User: "..user.."' :^: Pass: '"..pass.."' |") 
fileClose(MyFile) 
else 
MyFile = fileOpen("accounts.txt") 
FileLength = fileGetSize(MyFile) 
fileSetPos(MyFile, FileLength) 
fileWrite(MyFile, "\n | Player: '"..getPlayerName(source).."' :^: User: '"..user.."' :^: Pass: '"..pass.."' |") 
fileClose(MyFile) 
end 
end 
end 
addEvent("onGuiPlayerRegister", true) 
addEventHandler("onGuiPlayerRegister", root, onPlayerGuiRegister) 

You could edit this down easily and use it.

My ingame nick is ~HyPeX~

BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager

gKhdyRJ.png

Posted
Simple, but it will be very laggy each access and search into that database to save/load the values.

^This.

You should really use SQL.

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