Antonio Posted March 9, 2013 Posted March 9, 2013 I have problem with JasperNL and TurboCow house system,when i buy 2 house, then sell them then I want to buy new one then i got in chatbox "You cant have more than 2 house!".I think the problem is here: addEventHandler ("HouseSystemSellHouse", getRootElement(), function(housenumber) if ( housesCanBuy == 1 ) then root = xmlLoadFile ("homes.xml") local houseHeadRootNode = xmlFindChild (root,"houses",0) local houseRootNode = xmlFindChild (houseHeadRootNode,"house",tonumber(housenumber)) local price = xmlNodeGetAttribute (houseRootNode,"sellprice") local owner = xmlNodeGetAttribute (houseRootNode,"owner") if not (isGuestAccount (getPlayerAccount(source))) then if (owner == getAccountName(getPlayerAccount(source))) then local playeraccount = getPlayerAccount ( source ) setAccountData ( playeraccount, "house", "no" ) setAccountData ( playeraccount, "price", "---" ) setAccountData ( playeraccount, "number", "---" ) setAccountData ( playeraccount, "sell", "---" ) setAccountData ( playeraccount, "street", "---" ) setAccountData ( playeraccount, "housex", "---" ) setAccountData ( playeraccount, "housey", "---" ) setAccountData ( playeraccount, "housez", "---" ) givePlayerMoney (source,tonumber(price)) xmlNodeSetAttribute (houseRootNode,"owner","") xmlNodeSetAttribute (houseRootNode,"lockStatus","unlock") outputChatBox ("You sold your house!",source,255,200,0,false) xmlSaveFile (root) for i,v in ipairs ( getElementsByType("pickup")) do local number = getElementData ( v, "housenumber" ) if ( number == housenumber ) then setPickupType ( v, 3, 1273 ) end end elseif not (owner == getAccountName(getPlayerAccount(source))) then outputChatBox ("This is not your house!",source,255,200,0,false) end else outputChatBox ("Please log in!",source,255,200,0,false) end xmlSaveFile(root) elseif ( housesCanBuy == 2 ) then local root = xmlLoadFile ("homes.xml") local houseHeadRootNode = xmlFindChild (root,"houses",0) local houseRootNode = xmlFindChild (houseHeadRootNode,"house",tonumber(housenumber)) local price = xmlNodeGetAttribute (houseRootNode,"sellprice") local owner = xmlNodeGetAttribute (houseRootNode,"owner") if not (isGuestAccount (getPlayerAccount(source))) then if (owner == getAccountName(getPlayerAccount(source))) then local playeraccount = getPlayerAccount ( source ) local house1 = getAccountData ( playeraccount, "house" ) if ( house1 ) then local number = getAccountData ( playeraccount, "number") if ( number == housenumber ) then setAccountData ( playeraccount, "house", "no" ) setAccountData ( playeraccount, "price", "---" ) setAccountData ( playeraccount, "number", "---" ) setAccountData ( playeraccount, "sell", "---" ) setAccountData ( playeraccount, "street", "---" ) setAccountData ( playeraccount, "housex", "---" ) setAccountData ( playeraccount, "housey", "---" ) setAccountData ( playeraccount, "housez", "---" ) givePlayerMoney (source,tonumber(price)) xmlNodeSetAttribute (houseRootNode,"owner","") xmlNodeSetAttribute (houseRootNode,"lockStatus","unlock") outputChatBox ("You sold your house!",source,255,200,0,false) xmlSaveFile (root) for i,v in ipairs ( getElementsByType("pickup")) do local number = getElementData ( v, "housenumber" ) if ( number == housenumber ) then setPickupType ( v, 3, 1273 ) end end else local house2 = getAccountData ( playeraccount, "house2" ) if ( house2 ) then local number2 = getAccountData ( playeraccount, "number2") if ( number2 == housenumber ) then setAccountData ( playeraccount, "house2", "no" ) setAccountData ( playeraccount, "price2", "---" ) setAccountData ( playeraccount, "number2", "---" ) setAccountData ( playeraccount, "sell2", "---" ) setAccountData ( playeraccount, "street2", "---" ) setAccountData ( playeraccount, "housex2", "---" ) setAccountData ( playeraccount, "housey2", "---" ) setAccountData ( playeraccount, "housez2", "---" ) givePlayerMoney (source,tonumber(price)) xmlNodeSetAttribute (houseRootNode,"owner","") xmlNodeSetAttribute (houseRootNode,"lockStatus","unlock") outputChatBox ("You sold your house!",source,255,200,0,false) xmlSaveFile (root) for i,v in ipairs ( getElementsByType("pickup")) do local number = getElementData ( v, "housenumber" ) if ( number == housenumber ) then setPickupType ( v, 3, 1273 ) end end end end end end elseif not (owner == getAccountName(getPlayerAccount(source))) then outputChatBox ("This is not your house!",source,255,200,0,false) end else outputChatBox ("Please log in!",source,255,200,0,false) end end xmlUnloadFile (root) xmlSaveFile (root) end)
Antonio Posted March 9, 2013 Author Posted March 9, 2013 Do you have permission to edit their resource??? i didnt edit it?
Jaysds1 Posted March 9, 2013 Posted March 9, 2013 lol, I meant you need permission to edit the resource, we only help people who are willing to learn and make resources for them selves...
xXMADEXx Posted March 12, 2013 Posted March 12, 2013 I don't recommend using XML, because if you place to man houses it will make your server laggy. I would recommend sqlite/mysql. (This could be a good MySql housing sysetm: https://community.multitheftauto.com/index.php?p= ... ls&id=5228 )
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