noonbr Posted October 19, 2019 Share Posted October 19, 2019 (edited) When the usage is the same as the vehicle is teleported along with me, the isPedInVehicle is false. local tp1 = createMarker(1530.607421875,-1685.4215087891,13.3828125, "cylinder", 1, 255,255,255,100) function msg(hitElement) if (isPedInVehicle(hitElement) == false) then outputChatBox("Hello World!", hitElement) setElementPosition(hitElement, 1522.2706298828,-1687.1689453125,13.546875, true) end end addEventHandler("onMarkerHit", tp1, msg) Even if I use a car in the marker it is teleported but the other functions do not occur, just the setElementPosition. Edited October 19, 2019 by GM_Goulart Link to comment
Addlibs Posted October 19, 2019 Share Posted October 19, 2019 (edited) I don't understand what you mean, however, I'd like to point out your code will trigger on any marker instead of only on tp1, because of propagation of events. You need to add a false right aft er the function in the event handler to only bind it on the specified element and not its parents. In other words, you should be using addEventHandler("onMarkerHit", tp1, msg, false) Also, please, use a proper, more helpful, topic title next time. Just putting in [HELP] doesn't inform us what the problem is, and therefore people are unlikely to click your topic if they don't know the problem relates to their expertise. Edited October 19, 2019 by MrTasty Link to comment
noonbr Posted October 20, 2019 Author Share Posted October 20, 2019 Thank you. The title exited so because I clicked very fast and I did not think. I'm from Brazilian and don't not know speak english, sorry Link to comment
#\_oskar_/# Posted October 20, 2019 Share Posted October 20, 2019 use getElementType -- 'vehicle' 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