Castillo Posted November 13, 2010 Posted November 13, 2010 hi, i have a little problem on my "friends list" resource, i noticed that you aren't able to add a friend if someone else added him, i know why this happends but i have no idea how i can fix it, the problem must be that i'm checking all accounts not only mine. here is part of code: local root = getResourceConfig("data.xml") local index = getIndex (getPlayerSerial(client),root) for i , v in pairs ( xmlNodeGetChildren ( root ) ) do for s , t in pairs ( xmlNodeGetChildren ( v ) ) do local att = xmlNodeGetAttribute ( t, "name" ) local rn = string.lower ( tostring ( nametext ) ) local ra = string.lower ( att ) if ( rn == ra ) then outputChatBox ( "A friend with this name already exist." , client , 255 , 0 , 0 ) return false end end end i hope someone know how i can fix it. Thanks in advance. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Static-X Posted November 13, 2010 Posted November 13, 2010 You just need to make an nodeattribute for the account name for the player who added the friend, like when the players add another friend make it get the player's account who added the friend and check all the lines which has Account nodeattribute as ( e.g )"Static-X", then get the account of the player who I wanted to add, if the friendAccount is "Pulsar" it will return end.
dzek (varez) Posted November 13, 2010 Posted November 13, 2010 Just a thought: You are addicted to XML i see Notice that XML after getting big is much slower than SQL. And SQL is actually easier Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online! programista php rzeszów Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting. Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!
Castillo Posted November 13, 2010 Author Posted November 13, 2010 yeah varez, i know i may convert it to sqlite later but for now i'm trying to create it with XML. P.S: i don't really get what do you mean static San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
dzek (varez) Posted November 13, 2010 Posted November 13, 2010 post your small xml example, and i'll show you what you need to change if you dont understand Static-X Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online! programista php rzeszów Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting. Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!
Castillo Posted November 13, 2010 Author Posted November 13, 2010 <playerfriends> <user account="2F71C8856F19CD2523627FFCE58BA3A1"> <friend name="Chase_Oquinn" serial="B92D9BF5F9C1AE0A514F445EBFC63394" /> <friend name="[MM]Castillo" serial="2F71C8856F19CD2523627FFCE58BA3A1" /> </user> </playerfriends> that? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
dzek (varez) Posted November 13, 2010 Posted November 13, 2010 local playerSerial = getPlayerSerial(client) -- added, fix if needed local root = getResourceConfig("data.xml") local index = getIndex (getPlayerSerial(client),root) for i , v in pairs ( xmlNodeGetChildren ( root ) ) do local xmlNodeUserSerial = xmlNodeGetAttribute(v,"account") --- added if (xmlNodeUserSerial==playerSerial) then -- added for s , t in pairs ( xmlNodeGetChildren ( v ) ) do local att = xmlNodeGetAttribute ( t, "name" ) local rn = string.lower ( tostring ( nametext ) ) local ra = string.lower ( att ) if ( rn == ra ) then outputChatBox ( "A friend with this name already exist." , client , 255 , 0 , 0 ) return false end end end -- added, lol end Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online! programista php rzeszów Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting. Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!
Castillo Posted November 13, 2010 Author Posted November 13, 2010 thank you varez, new version uploaded https://community.multitheftauto.com/index.php?p=resources&s=details&id=1267 San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
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