will briggs Posted June 5, 2011 Share Posted June 5, 2011 Hi, Im having some trouble with creating a vehicle for a player and putting it them in it when you hit a marker. This is what i got so far local myMarker = createMarker(1552.33, -1605.37, 12.382, 'cylinder', 2.0, 255, 0, 0, 150 ) function MarkerHit( hitElement, matchingDimension ) if getElementType( hitElement ) == "player" then createVehicle ( 432, 1552.33, -1605.37, 12.382 ) elseif getElementType( hitElement ) == "vehicle" then end end addEventHandler( "onMarkerHit", myMarker, MarkerHit ) It doesnt seem to be working :\ Thanks Link to comment
Aibo Posted June 5, 2011 Share Posted June 5, 2011 well you're not putting the player into the vehicle. and it is best to name your markers and handler functions according to their purpose. what if you'll need another marker, you'll call it myMarker2? in the end it can get messy and hard to read even for yourself. local vehicleMarker = createMarker(1552.33, -1605.37, 12.382, 'cylinder', 2.0, 255, 0, 0, 150 ) function vehicleMarkerHit( hitElement, matchingDimension ) if getElementType( hitElement ) == "player" and not isPedInVehicle(hitElement) then local vehicle = createVehicle(432, 1552.33, -1605.37, 12.382) warpPedIntoVehicle(hitElement, vehicle) elseif getElementType( hitElement ) == "vehicle" then end end addEventHandler( "onMarkerHit", vehicleMarker, vehicleMarkerHit ) 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