Jump to content

Exporting data


kev|GER

Recommended Posts

Hey there,

I'm dealing with some problem that I can't solve without help.

I've got a script that saves a player's cash in a xml file. In another script, I need to somehow, import the player's cash from the xml file to do an if check. Can someone help me out?

The xml file looks like that:

<users> 
    <user> 
        <SERIAL_1948D27D64A12DD19329F2D5377717E3 points="78" cash="318" ></SERIAL_1948D27D64A12DD19329F2D5377717E3> 
        <SERIAL_2631516CC240A88B3BBD41F466C11844 "></SERIAL_2631516CC240A88B3BBD41F466C11844> 
        <SERIAL_E9A45949A1814608ADD0C7D9F2881B03 points="130" cash="10211"></SERIAL_E9A45949A1814608ADD0C7D9F2881B03> 
        <SERIAL_00E6645D0EDE3AE58733D9E0D8DC24E4"></SERIAL_00E6645D0EDE3AE58733D9E0D8DC24E4> 
    </user> 
</users> 
  

I hope I made myself understandable.

Thanks in advance.

Link to comment

Then, loadPlayerData is your function to get the XML cash and that.

Well, you must add this line in the meta.xml:

<export function="loadPlayerData" type="server" /> 

Then to use that function in another resource do this:

exports["YOUR_RESOURCE_NAME"]:loadPlayerData (player,"cash") 

Link to comment
Then, loadPlayerData is your function to get the XML cash and that.

Well, you must add this line in the meta.xml:

<export function="loadPlayerData" type="server" /> 

Then to use that function in another resource do this:

exports["YOUR_RESOURCE_NAME"]:loadPlayerData (player,"cash") 

I've done this in another resource:

function testt (source) 
pMoneyz = exports["points"]:loadPlayerData (source,"cash") 
outputChatBox (pMoneyz, source) 
end 
addCommandHandler ("cha", testt) 

But in debugscript it outputs :

'ERROR: Call: failed to call 'points:loadPlayerData' [string "?"]'

Thanks in advance.

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