Jump to content

help pliz :(


Recommended Posts

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
  • Moderators

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
  • Moderators

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 8)

Link to comment
  • Moderators
He posted the script

Did he post the function that loads the vehicles ?!

then He deleted , it So you win , :D

So was this correct ?!

local ownerName = getElementData(theVehicle, "owner") or "null" 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...