Jacobob14 Posted April 3, 2015 Share Posted April 3, 2015 hi i want to make my own level system as I can do to detect exp and data 1 and data 2 level of each player "1" exp = "500" data1 = "100" data2="10" /> "2" exp = "1500" data1 = "200" data2="30" /> "3" exp = "3000" data1 = "300" data2="50" /> "4" exp = "6000" data1 = "400" data2="100" /> Link to comment
xXMADEXx Posted April 3, 2015 Share Posted April 3, 2015 Do you mean to load the XML? If not, please explain a bit more. Here's an example: local file = xmlLoadFile ( "xml_file.xml" ); local children = xmlNodeGetChildren ( file ); for index, node in pairs ( children ) do if ( xmlNodeGetName ( node ) == "level" ) then local name = tonumber ( xmlNodeGetAttribute ( node, "name" ) ); local exp = tonumber ( xmlNodeGetAttribute ( node, "exp" ) ); local data1 = tonumber ( xmlNodeGetAttribute ( node, "data1" ) ); local data2 = tonumber ( xmlNodeGetAttribute ( node, "data2" ) ); outputChatBox ( "Name: ".. name ); outputChatBox ( "Exp: ".. exp ); outputChatBox ( "Data1: ".. data1 ); outputChatBox ( "Data2: ".. data2 ); end end Link to comment
Jacobob14 Posted April 3, 2015 Author Share Posted April 3, 2015 I just want the information according to the level of the player is correct as well? local file = xmlLoadFile ( "xml_file.xml" ); local children = xmlNodeGetChildren ( file ); for index, node in pairs ( children ) do if ( xmlNodeGetName ( node ) == "level" ) then local name = tonumber ( xmlNodeGetAttribute ( node, "name" ) ); local exp = tonumber ( xmlNodeGetAttribute ( node, "exp" ) ); local data1 = tonumber ( xmlNodeGetAttribute ( node, "data1" ) ); local data2 = tonumber ( xmlNodeGetAttribute ( node, "data2" ) ); if name == getElementData(localPlayer,"level") then outputChatBox ( "Name: ".. name ); outputChatBox ( "Exp: ".. exp ); outputChatBox ( "Data1: ".. data1 ); outputChatBox ( "Data2: ".. data2 ); end end end Link to comment
Castillo Posted April 3, 2015 Share Posted April 3, 2015 Storing data of the player in XML is not a really good idea, since the file will get bigger and bigger with each new player. I would recommend you to use account data or SQL/MySQL to store the player exp and level. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now