JuniorMelo Posted March 12, 2016 Posted March 12, 2016 (edited) hello, I have a bug in this function, not creating this marker in the city that the player is. Citys = {} markerPizza = createMarker( 2485.0024414063, 2022.3449707031, 9.8203125, "cylinder", 1.5, 255, 180, 0, 100) blipPizza = createBlipAttachedTo( markerPizza, 14, 2, 255, 255, 0, 255 ) Citys["Los Santos"] = { {x=2382.4638671875, y=-1891.9400634766, z=13.38914680481}, } Citys["San Fierro"] = { {x=-2686.283203125, y=270.83374023438, z=4.3359375}, } Citys["Las Venturas"] = { {x=2445.8454589844, y=2020.6320800781, z=10.8203125}, } function onPizzaMarkerHit(hitPlayer) Citys[i] = { x=x, y=y, z=z } local xx, yy, zz = getElementPosition ( localPlayer ) local city = getZoneName(xx, yy, zz, true) local x, y, z = Citys[city].x, Citys[city].y, Citys[city].z local marker = createMarker(x, y, z, "cylinder", 2, 255, 188, 0) local blip = createBlip(x, y, z, 24, 1) if isElement(markerPizza) then destroyElement(markerPizza) end if isElement(blipPizza) then destroyElement(blipPizza) end addEventHandler("onClientMarkerHit", marker, function() fadeCamera(false) setTimer(fadeCamera, 2000, 1, true) triggerServerEvent("EndJob", localPlayer, localPlayer, elements) end) end addEventHandler("onClientMarkerHit", markerPizza, onPizzaMarkerHit) Edited March 12, 2016 by Guest
Anubhav Posted March 12, 2016 Posted March 12, 2016 Citys = {} markerPizza = createMarker( 2485.0024414063, 2022.3449707031, 9.8203125, "cylinder", 1.5, 255, 180, 0, 100) blipPizza = createBlipAttachedTo( markerPizza, 14, 2, 255, 255, 0, 255 ) Citys["Los Santos"] = { {x=2382.4638671875, y=-1891.9400634766, z=13.38914680481}, } Citys["San Fierro"] = { {x=-2686.283203125, y=270.83374023438, z=4.3359375}, } Citys["Las Venturas"] = { {x=2445.8454589844, y=2020.6320800781, z=10.8203125}, } function onPizzaMarkerHit(hitPlayer) local xx, yy, zz = getElementPosition ( localPlayer ) local city = getZoneName(xx, yy, zz, true) local x, y, z = Citys[city].x, Cityw[city].y, Citys[city].z local marker = createMarker(x, y, z, "cylinder", 2, 255, 188, 0) local blip = createBlip(x, y, z, 24, 1) if isElement(markerPizza) then destroyElement(markerPizza) end if isElement(blipPizza) then destroyElement(blipPizza) end addEventHandler("onClientMarkerHit", marker, function() fadeCamera(false) setTimer(fadeCamera, 2000, 1, true) triggerServerEvent("EndJob", localPlayer, localPlayer, elements) end) end addEventHandler("onClientMarkerHit", markerPizza, onPizzaMarkerHit)
JuniorMelo Posted March 12, 2016 Author Posted March 12, 2016 Citys = {} markerPizza = createMarker( 2485.0024414063, 2022.3449707031, 9.8203125, "cylinder", 1.5, 255, 180, 0, 100) blipPizza = createBlipAttachedTo( markerPizza, 14, 2, 255, 255, 0, 255 ) Citys["Los Santos"] = { {x=2382.4638671875, y=-1891.9400634766, z=13.38914680481}, } Citys["San Fierro"] = { {x=-2686.283203125, y=270.83374023438, z=4.3359375}, } Citys["Las Venturas"] = { {x=2445.8454589844, y=2020.6320800781, z=10.8203125}, } function onPizzaMarkerHit(hitPlayer) local xx, yy, zz = getElementPosition ( localPlayer ) local city = getZoneName(xx, yy, zz, true) local x, y, z = Citys[city].x, Cityw[city].y, Citys[city].z local marker = createMarker(x, y, z, "cylinder", 2, 255, 188, 0) local blip = createBlip(x, y, z, 24, 1) if isElement(markerPizza) then destroyElement(markerPizza) end if isElement(blipPizza) then destroyElement(blipPizza) end addEventHandler("onClientMarkerHit", marker, function() fadeCamera(false) setTimer(fadeCamera, 2000, 1, true) triggerServerEvent("EndJob", localPlayer, localPlayer, elements) end) end addEventHandler("onClientMarkerHit", markerPizza, onPizzaMarkerHit)
JuniorMelo Posted March 12, 2016 Author Posted March 12, 2016 It works this way. thx thx local ran = math.random(#Citys[city]) local x, y, z = Citys[city][ran].x, Citys[city][ran].y, Citys[city][ran].z
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