Castillo Posted August 18, 2010 Posted August 18, 2010 hi there, i've got a problem with my character system, i can create characters etc but the problem is that i can create with same names and thats a big problem, i've tryed to fix it and no luck. maybe someone of you can help me out, here is a piece of my code, function create_character (nametext,age,skin,red,green,blue) local root = getResourceConfig("character/playerdb.xml") local index = getUserIndex (getAccountName(getPlayerAccount(source)),root) for i , v in ipairs ( xmlNodeGetChildren ( root ) ) do local accName = xmlNodeGetAttribute ( v , "name" ) if ( accName == tostring ( nametext ) ) then outputChatBox ( "A character with that name already exists." , source , 255 , 0 , 0 ) return false end end Thanks in advance.
dzek (varez) Posted August 18, 2010 Posted August 18, 2010 Hey, theres few (two?) active topics. No need to bump. And when you reply to yourself, on topics list you get 1 in "reples" colums = less chance that somebody will open your topic than when it´s zero. Its better to wait a bit. About your problem: Post your xml example too.
Castillo Posted August 18, 2010 Author Posted August 18, 2010 <playerdb> <user account="Snake"> <character name="Optimus-Prime" age="15" skin="29" x="-1225.029296875" y="-126.671875" z="14.1484375" cash="3743800" redcolor="94" w0="0" a0="0" w1="0" a1="0" w2="24" a2="9980" w3="27" a3="9993" w4="29" a4="9896" w5="31" a5="9999" w6="34" a6="9998" w7="0" a7="0" w8="16" a8="9980" w9="43" a9="9999" w10="0" a10="0" w11="44" a11="0" w12="0" a12="0" wl="2" bank="99800484" int="0" dim="0" car1="511" car2="No car" car3="415" car4="422" rotation="167.59075927734" greencolor="242" bluecolor="191" /> </user> </playerdb> this?
Callum Posted August 18, 2010 Posted August 18, 2010 That script is checking if the node has a "name" attribute, you'll have to get the child node of the child node of the file.
Castillo Posted August 19, 2010 Author Posted August 19, 2010 That script is checking if the node has a "name" attribute, you'll have to get the child node of the child node of the file. ok my friend and me fixed it.
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