Marcus15 Posted November 12, 2017 Share Posted November 12, 2017 How can i make marker that can only be hit by object (not player on foot, and not vehicle!) Link to comment
WorthlessCynomys Posted November 12, 2017 Share Posted November 12, 2017 onMarkerHit returns the hitElement. Get it's type with getElementType 1 Link to comment
Marcus15 Posted November 12, 2017 Author Share Posted November 12, 2017 please write example because i'm tried it once Link to comment
WorthlessCynomys Posted November 12, 2017 Share Posted November 12, 2017 addEventHandler("onMarkerHit", marker, function(hitElement) if (getElementType(hitElement) == "object") then -- TODO here end end ) 1 Link to comment
Marcus15 Posted November 12, 2017 Author Share Posted November 12, 2017 This is the script nut is mot working function localRoot () if isPedInVehicle ( source ) then local vehicle = getPedOccupiedVehicle(source) local x, y, z = getElementPosition ( vehicle ) local radar = createMarker (0+x, 0+y, 0+z, "cylinder", 2.0, 255, 0, 0, 150) local check = radar attachElements(check, vehicle, 0, 5, -0.1) outputChatBox ( "A szkript lefutott!") end end addEventHandler ( "onPlayerVehicleEnter", getRootElement(), localRoot ) function VehicleHit(hitElement,matchingDimension) if getElementType(hitElement)=="vehicle" then outputChatBox ( "A marker jó!") end end addEventHandler("onMarkerHit",radar,VehicleHit) create marker and if the the vehicle hit then outputChatBox ( "A marker jó!") but Bad Argument in addEventHandler 2 element got nil Link to comment
WorthlessCynomys Posted November 12, 2017 Share Posted November 12, 2017 The problem is that in function localRoot the radar is local which means the addEventHandler doesn't "see" it. Remove the local and it should work. Btw I sent you a message, you can write if you need help. 1 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