Lloyd Logan Posted January 16, 2014 Posted January 16, 2014 Is there anyway to link a marker with a vehicle? I mean, if i were to enter a marker, it would tell me 'something' of a certain vehicle? Example : Player steps into the marker, and gets details of a certain car? If you need an Intermediate scripter feel free to PM me as I will accept "almost" any job, STATUS: UNAVAILABLE SCOTLAND, my hometown, and the Home of GTA!
Castillo Posted January 16, 2014 Posted January 16, 2014 local markers = { } -- Define a table. local vehicle = createVehicle ( ) -- Create a vehicle. local marker = createMarker ( ) -- Create a marker. markers [ marker ] = vehicle -- Add marker to the table with the value of the vehicle element. addEventHandler ( "onMarkerHit", root, function ( ) local vehicle = markers [ source ] -- Get the vehicle element using the marker as index for the table. if ( vehicle ) then -- If there is a vehicle... -- Do your thing here end end ) Is that what you meant? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Lloyd Logan Posted January 16, 2014 Author Posted January 16, 2014 Well, because I don't fully understand your code, I cant say for sure, but from looking, i think it's right! If you need an Intermediate scripter feel free to PM me as I will accept "almost" any job, STATUS: UNAVAILABLE SCOTLAND, my hometown, and the Home of GTA!
Castillo Posted January 16, 2014 Posted January 16, 2014 I edited the code to add comments so you may understand it better. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
myonlake Posted January 16, 2014 Posted January 16, 2014 You can also set the marker a parent of the vehicle, or the other way around. This way you can just get the child or parent and have the vehicle. If I helped you, please click the like button on the right Thanks!
Lloyd Logan Posted January 16, 2014 Author Posted January 16, 2014 Quote You can also set the marker a parent of the vehicle, or the other way around. This way you can just get the child or parent and have the vehicle. That's what I was kinda looking for! So if I were to enter a marker, to get the name of a vehicle, would I set the parent vehicle to a marker other vice versa? If you need an Intermediate scripter feel free to PM me as I will accept "almost" any job, STATUS: UNAVAILABLE SCOTLAND, my hometown, and the Home of GTA!
myonlake Posted January 16, 2014 Posted January 16, 2014 That's what I was kinda looking for! So if I were to enter a marker, to get the name of a vehicle, would I set the parent vehicle to a marker other vice versa? It's easier to fetch if you set the vehicle the marker's parent. This way you can just call getElementParent -function to get the vehicle, the rest is obvious. If I helped you, please click the like button on the right Thanks!
Lloyd Logan Posted January 16, 2014 Author Posted January 16, 2014 Thanks! If you need an Intermediate scripter feel free to PM me as I will accept "almost" any job, STATUS: UNAVAILABLE SCOTLAND, my hometown, and the Home of GTA!
Lloyd Logan Posted January 16, 2014 Author Posted January 16, 2014 Solidsnake14 said: I edited the code to add comments so you may understand it better. Actually thanks for that! Because of myonlake post I never saw yours! This also helped, thanks! If you need an Intermediate scripter feel free to PM me as I will accept "almost" any job, STATUS: UNAVAILABLE SCOTLAND, my hometown, and the Home of GTA!
myonlake Posted January 16, 2014 Posted January 16, 2014 You're welcome. If I helped you, please click the like button on the right Thanks!
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