Piorun Posted July 16, 2011 Share Posted July 16, 2011 Hi My code function deleteVeh(source) if isPedInVehicle(source) then local veh = getPedOccupiedVehicle(source) local data = getElementData(veh, "datanum") if data then local xmlfile = xmlLoadFile("veh.xml") for i, node in ipairs(xmlNodeGetChildren(xmlfile)) do local datanode = xmlNodeGetAttribute(node, "datanum") if data == datanode then local result = xmlDestroyNode(node) xmlSaveFile(xmlfile) destroyElement(veh) end end end end end addCommandHandler("usunauto", deleteVeh) Is working when i restart resource. In other functions i've got creating a vehicle and saveing few info into xml file. When i create a veh and enter to it this function doesn't work, but when i restart resource and enter again - it's working. Why? Link to comment
Jaysds1 Posted July 17, 2011 Share Posted July 17, 2011 is this script suppose to delete a vehicle when a person leaves the vehicle??? Link to comment
Piorun Posted July 17, 2011 Author Share Posted July 17, 2011 Ok doesn't matter .. I fix my code and now is working . Bye. Link to comment
JR10 Posted July 17, 2011 Share Posted July 17, 2011 Can you post what you did, so that if someone searches for such topic he finds the answer. Link to comment
Jaysds1 Posted July 22, 2011 Share Posted July 22, 2011 Ok doesn't matter .. I fix my code and now is working . Bye. Why are you talking like that, I asked if it's suppose to delete the vehicle, I wanted to know more so I could help you with the script... Link to comment
Piorun Posted July 22, 2011 Author Share Posted July 22, 2011 I do nothing I sell this code to other user, but i can paste code here. Want it? 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