Miika Posted July 11, 2015 Share Posted July 11, 2015 (edited) Hi, I have another problem with ipairs tables: onMarkerHit works only, if i hit second marker from table. No any errors in debugscrpit. [server] jobmarkers = { {-2108.77734375, 144.54998779297, 35.134094238281}; {1642.7379150391, 2354.4382324219, 10.812967300415}; {2452.5341796875, -2119.5114746094, 13.546875}; } for k, v in ipairs (jobmarkers) do local x, y, z = v[1], v[2], v[3] marker = createMarker(x, y, z - 1, "cylinder", 1.5, 255, 255, 0, 150) blip = createBlipAttachedTo(marker, 51) end addEventHandler("onMarkerHit", marker, function(thePlayer) triggerClientEvent(thePlayer, "onTruckerGuiOpen", thePlayer) end ) Edited July 11, 2015 by Guest Link to comment
manawydan Posted July 11, 2015 Share Posted July 11, 2015 try, no tested jobmarkers = { {-2108.77734375, 144.54998779297, 35.134094238281}; {1642.7379150391, 2354.4382324219, 10.812967300415}; {2452.5341796875, -2119.5114746094, 13.546875}; } for i=1,#jobmarkers do local x,y,z = jobmarkers[i][1],jobmarkers[i][2],jobmarkers[i][3] marker = createMarker(x, y, z - 1, "cylinder", 1.5, 255, 255, 0, 150) blip = createBlipAttachedTo(marker, 51) addEventHandler("onMarkerHit", marker,hitMarker) end function hitMarker(thePlayer) triggerClientEvent(thePlayer, "onTruckerGuiOpen", thePlayer) end Link to comment
iMr.Dawix~# Posted July 11, 2015 Share Posted July 11, 2015 jobmarkers = { {-2108.77734375, 144.54998779297, 35.134094238281}, {1642.7379150391, 2354.4382324219, 10.812967300415}, {2452.5341796875, -2119.5114746094, 13.546875}, } for k, v in ipairs (jobmarkers) do local x, y, z = v[1], v[2], v[3] marker = createMarker(x, y, z - 1, "cylinder", 1.5, 255, 255, 0, 150) blip = createBlipAttachedTo(marker, 51) end addEventHandler("onMarkerHit",resourceRoot, function(thePlayer) triggerClientEvent(thePlayer, "onTruckerGuiOpen", thePlayer) end ) Link to comment
Miika Posted July 11, 2015 Author Share Posted July 11, 2015 jobmarkers = { {-2108.77734375, 144.54998779297, 35.134094238281}, {1642.7379150391, 2354.4382324219, 10.812967300415}, {2452.5341796875, -2119.5114746094, 13.546875}, } for k, v in ipairs (jobmarkers) do local x, y, z = v[1], v[2], v[3] marker = createMarker(x, y, z - 1, "cylinder", 1.5, 255, 255, 0, 150) blip = createBlipAttachedTo(marker, 51) end addEventHandler("onMarkerHit",resourceRoot, function(thePlayer) triggerClientEvent(thePlayer, "onTruckerGuiOpen", thePlayer) end ) It works! Thx. Link to comment
iMr.Dawix~# Posted July 11, 2015 Share Posted July 11, 2015 It works! Thx. you're welcome 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