Jump to content

[HELP]onMarkerHit


Recommended Posts

local marker1 = createMarker ( 1253.0999755859, -1399, 12, 'cylinder', 11, 222, 222, 1, 225 ) 
local gate1 = createObject ( 980, 1252.8000488281, -1399.0999755859, 14.800000190735, 0, 0, 90 ) 
  
function movingObject ( hitElement, matchingDimension ) 
    if getElementType ( hitElement ) == "player" then 
        moveObject ( gate1, 3000, 1252.8000488281, -1413, 14.800000190735 ) 
    end 
end 
function moveObjectBack () 
    if getElementType ( hitElement ) == "player" then 
        moveObject ( gate1, 3000, 1252.8000488281, -1399.0999755859, 14.800000190735 ) 
    end 
end 
addEventHandler ( "onMarkerHit", marker1 , movingObject ) 
addEventHandler ( "onMarkerLeave", marker1, moveObjectBack ) 

what is wrong?

Link to comment

You didn't add hitElement as an argument for moveObjectBack function.

local marker1 = createMarker ( 1253.0999755859, -1399, 12, 'cylinder', 11, 222, 222, 1, 225 ) 
local gate1 = createObject ( 980, 1252.8000488281, -1399.0999755859, 14.800000190735, 0, 0, 90 ) 
  
function movingObject ( hitElement, matchingDimension ) 
    if getElementType ( hitElement ) == "player" then 
        moveObject ( gate1, 3000, 1252.8000488281, -1413, 14.800000190735 ) 
    end 
end 
function moveObjectBack (hitElement) 
    if getElementType ( hitElement ) == "player" then 
        moveObject ( gate1, 3000, 1252.8000488281, -1399.0999755859, 14.800000190735 ) 
    end 
end 
addEventHandler ( "onMarkerHit", marker1 , movingObject ) 
addEventHandler ( "onMarkerLeave", marker1, moveObjectBack ) 

Link to comment
You didn't add hitElement as an argument for moveObjectBack function.
local marker1 = createMarker ( 1253.0999755859, -1399, 12, 'cylinder', 11, 222, 222, 1, 225 ) 
local gate1 = createObject ( 980, 1252.8000488281, -1399.0999755859, 14.800000190735, 0, 0, 90 ) 
  
function movingObject ( hitElement, matchingDimension ) 
    if getElementType ( hitElement ) == "player" then 
        moveObject ( gate1, 3000, 1252.8000488281, -1413, 14.800000190735 ) 
    end 
end 
function moveObjectBack (hitElement) 
    if getElementType ( hitElement ) == "player" then 
        moveObject ( gate1, 3000, 1252.8000488281, -1399.0999755859, 14.800000190735 ) 
    end 
end 
addEventHandler ( "onMarkerHit", marker1 , movingObject ) 
addEventHandler ( "onMarkerLeave", marker1, moveObjectBack ) 

thnx

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...