Jacobob14 Posted June 5, 2014 Share Posted June 5, 2014 as I can find the id Part of owner are stored here xml "ads" model ="411" x="216.7294921875" y="1913.1904296875" z="17.640625" rotX="0" rotY="0" rotZ="187.1082611084" ptype="con" owner="raul15" damage="false" r="0" g="0" b="0" sr="0" sg="0" sb="0"/> function drawPanel() local theVehicle = getPedOccupiedVehicle (localPlayer) local name =getVehicleName ( theVehicle ) local owner = getElementID(theVehicle) -- only give the id : ( end Link to comment
Max+ Posted June 5, 2014 Share Posted June 5, 2014 Hello , i didn't get what are you trying to do Here . . . you want to get the name of the vehicle and id , form xml , or just get the name ? ? Link to comment
Jacobob14 Posted June 5, 2014 Author Share Posted June 5, 2014 I want to get this part of xml owner="raul15" Link to comment
Max+ Posted June 5, 2014 Share Posted June 5, 2014 you Can , Use this , xmlNodeGetName Link to comment
Moderators Citizen Posted June 5, 2014 Moderators Share Posted June 5, 2014 Are you using a resource to save the vehicles in that xml ? If yes then give the link of that resource to us. Because we need to see where the owner is stored on the element when this resource loads the vehicles. If it's a script that someone made for you, please paste the loading function (that loads and create the cars from the xml). I'm pretty sure the owner is stored as an element data so you maybe can try to get it like this: local ownerName = getElementData(theVehicle, "owner") or "null" And hmmm about your comment on this line: local owner = getElementID(theVehicle) -- only give the id : ( Of course ! getElementID returns the id of the element ... Why would you get the owner with that function too ?! Seriously ... EDIT: @Max+, your are going the wrong way, this pretty obvious that he is using a script he got somewhere to save and load the vehicles into and from an xml file that he pasted a piece of in his first post. So I'm pretty sure that this script is setting the owner name as an element data of that vehicle at load time. So there is no need to read the xml file again. Link to comment
pepsi18 Posted June 5, 2014 Share Posted June 5, 2014 (edited) use xmlNodeGetAttribute Edited June 5, 2014 by Guest Link to comment
Max+ Posted June 5, 2014 Share Posted June 5, 2014 Ok , but xmlNodeGetName won't work ? because in the wiki written , Gets the tag name of the specified XML node. Link to comment
Moderators Citizen Posted June 5, 2014 Moderators Share Posted June 5, 2014 No it won't work with xmlNodeGetName but with xmlNodeGetAttribute instead. But you first need to open the file, find the vehicle node that has the same id (using xmlNodeGetAttribute) then use xmlNodeGetAttribute again to get the owner name, then unload the xml file. It a pure waste of processor time because I'm sure at 99% that this owner data is already stored somewhere on the vehicle element (surely an element data). Let's see who is right Link to comment
Max+ Posted June 5, 2014 Share Posted June 5, 2014 Yeah , it's an Element , so with Element, use getElementData, and with xml , use xmlNodeGetAttribute , He posted the script , then He deleted , it So you win , Link to comment
Moderators Citizen Posted June 5, 2014 Moderators Share Posted June 5, 2014 He posted the script Did he post the function that loads the vehicles ?! then He deleted , it So you win , So was this correct ?! local ownerName = getElementData(theVehicle, "owner") or "null" Link to comment
Cadu12 Posted June 6, 2014 Share Posted June 6, 2014 Citizen is right. So try use what citizen said. 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