H!tman Posted November 7, 2011 Posted November 7, 2011 marker = createMarker(0, 0, -10, "cylinder", 1, 255, 0, 0, 255) function markerHit() outputChatBox("hit") end addEventHandler("onClientMarkerHit", getRootElement(), markerHit) when i go to this position: x= 0 , y= 0 , z= 3 the event happen at same position except Z position. is this MTA bug or the marked like that?
myonlake Posted November 8, 2011 Posted November 8, 2011 (edited) You forgot the name. You had getRootElement(), it also seems that you had some weird invincible character there. local marker = createMarker(-1657, 1214, 8, "cylinder", 1, 255, 0, 0, 255) function onMarkerHit(hitPlayer, matchingDimension) if hitPlayer then outputChatBox("hit") end end addEventHandler("onClientMarkerHit", marker, onMarkerHit) Tested. Edited November 8, 2011 by Guest
myonlake Posted November 8, 2011 Posted November 8, 2011 (edited) Edited. Are you sure you're doing this all on client-side? Because this is a client-side script, otherwise you should use onMarkerHit instead of onClientMarkerHit. Edited November 8, 2011 by Guest
^Dev-PoinT^ Posted November 8, 2011 Posted November 8, 2011 Try This local marker = createMarker(-1657, 1214, 8, "cylinder", 1, 255, 0, 0, 255) function MarkerHit( hitElement, matchingDimension )-- define MarkerHit function for the handler local elementType = getElementType( hitElement )-- get the hit element's type outputChatBox( elementType.." Hit", getRootElement(), 255, 255, 0 )-- attach the element's type with the text, and output it end addEventHandler( "onMarkerHit", marker, MarkerHit )-- attach onMarkerHit event to MarkerHit function
myonlake Posted November 8, 2011 Posted November 8, 2011 (edited) Try This local marker = createMarker(-1657, 1214, 8, "cylinder", 1, 255, 0, 0, 255) function MarkerHit( hitElement, matchingDimension )-- define MarkerHit function for the handler local elementType = getElementType( hitElement )-- get the hit element's type outputChatBox( elementType.." Hit", getRootElement(), 255, 255, 0 )-- attach the element's type with the text, and output it end addEventHandler( "onMarkerHit", marker, MarkerHit )-- attach onMarkerHit event to MarkerHit function He is trying to make it client-side, he did not ask any graphics on his chat message and there is no need for that long script to find out is the element a player. And you just copied it (https://wiki.multitheftauto.com/wiki/OnMarkerHit). Man, please, I know you want to help, but copying straight from the wiki isn't a way to help - tho', it depends on script. EDIT: It seems like I misunderstood your problem, H!itman. Yes, it's a Multi Theft Auto bug in my opinion, I've got a self-made toll script and it's annoying, always when you go fly over it like in 100 meters, it does the same. Edited November 8, 2011 by Guest
H!tman Posted November 8, 2011 Author Posted November 8, 2011 so is there any solution? don't tell me to use collision shape functions
Charlie_Jefferson Posted November 8, 2011 Posted November 8, 2011 USE COLLISION SHAPE FUNCTIONS! No. local marker = createMarker(-1657, 1214, 8, "cylinder", 1, 255, 0, 0, 255) function onMarkerHit(hitPlayer, matchingDimension) if hitPlayer then outputChatBox("hit") end end addEventHandler("onMarkerHit", marker, onMarkerHit) This is myonlake's post. It should work.
H!tman Posted November 8, 2011 Author Posted November 8, 2011 it works but if i was in same x and y except z (if my z position was 100 or -100) the function works too that's the problem like myonlake said.
Charlie_Jefferson Posted November 8, 2011 Posted November 8, 2011 Hm. That's pretty strange. Edit: Your better off using collision shapes to be honest.
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