Jump to content

SOLVED


Bean666

Recommended Posts

Posted

Try that not tested

local spots = { 
    { 2490.173828125, -1670.1630859375, 12.3 }, 
    { 2492.6298828125, -1675.1650390625, 12.3 } 
} 
  
for k,v in ipairs( spots ) do 
        marker = createMarker ( v[1],v[2],v[3], "Cylinder", 1, 255, 255, 255, 100 ) 
end 
  
function MarkerHit ( hitPlayer, matchingDimension ) 
if (hitPlayer == localPlayer) then 
if isPedInVehicle(hitPlayer) then return; end 
guiSetVisible(window, true) 
showCursor(true) 
    setElementData( localPlayer, 'm', { source_ = source, pos = {getElementPosition (source) } } ) 
    end 
end 
addEventHandler ( "onClientMarkerHit", marker, MarkerHit ) 

 

 

Posted
for k,v in ipairs( spots ) do 
        marker = createMarker ( v[1],v[2],v[3], "Cylinder", 1, 255, 255, 255, 100 ) 
        addEventHandler ("onClientMarkerHit", marker, MarkerHit ) 
end 

"If debugging is the process of removing software bugs, then programming must be the process of putting them in."

Posted
Try that not tested
local spots = { 
    { 2490.173828125, -1670.1630859375, 12.3 }, 
    { 2492.6298828125, -1675.1650390625, 12.3 } 
} 
  
for k,v in ipairs( spots ) do 
        marker = createMarker ( v[1],v[2],v[3], "Cylinder", 1, 255, 255, 255, 100 ) 
end 
  
function MarkerHit ( hitPlayer, matchingDimension ) 
if (hitPlayer == localPlayer) then 
if isPedInVehicle(hitPlayer) then return; end 
guiSetVisible(window, true) 
showCursor(true) 
    setElementData( localPlayer, 'm', { source_ = source, pos = {getElementPosition (source) } } ) 
    end 
end 
addEventHandler ( "onClientMarkerHit", marker, MarkerHit ) 

This won't work since the event would only be attached to the last marker, the variable 'marker' gets overwritten every iteration.

"If debugging is the process of removing software bugs, then programming must be the process of putting them in."

Posted
for k,v in ipairs( spots ) do 
        marker = createMarker ( v[1],v[2],v[3], "Cylinder", 1, 255, 255, 255, 100 ) 
        addEventHandler ("onClientMarkerHit", marker, MarkerHit ) 
end 

i did this all over before, but it only works in the first marker of the table. all i want is the MarkerHit function will only work in the "spots" table markers.

Aftermath

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...