Fiz um script de emprego de ifood mas quando eu finalizo a rota ele não reaparece o marker inicial.
OBS: (sei que destruí o elemento mas não sei como volta-lo no final)
local MarkerIniciar = createMarker(1198.36206, -1454.21411, 13,"cylinder",1.2,255,255,255,100)
local MarkerFinalizar = createMarker(1197.54395, -1437.23108, 13,"cylinder",1.2,255,255,255,100)
veiculo = {}
function inicio(player)
local quantidade = exports["[HS]Inventory_system_2"]:getItem(player, 'cafe')
if quantidade == 14 then
exports["[HS]Notify_System"]:notify(player, 'Você não tem pizzas suficientes', 'error') return end
if veiculo[player] and isElement(veiculo[player]) then destroyElement(veiculo[player])
veiculo[player] = nil
end
veiculo[player] = createVehicle(521, 1216.10876, -1478.08972, 13.54688)
warpPedIntoVehicle(player, veiculo[player])
setElementVisibleTo(Marker1, player, true)
setElementVisibleTo(Blip1, player, true)
if veiculo[player] and isElement(veiculo[player]) then destroyElement(MarkerIniciar)
exports["[HS]Notify_System"]:notify(player, 'Vá até o local marcado em seu mapa para fazer sua primeira entrega', 'info')
end
end
addEventHandler("onMarkerHit", MarkerIniciar, inicio)
function fim(player)
if veiculo[player] and isElement(veiculo[player]) then
createElement(MarkerIniciar)
destroyElement(veiculo[player])
setElementVisibleTo(BlipFinalizar , player, false)
setElementVisibleTo(MarkerFinalizar , player, false)
exports["[HS]Notify_System"]:notify(player, 'Você guardou a moto com sucesso e finalizou seu expediente', 'success')
end
end
addEventHandler("onMarkerHit", MarkerFinalizar, fim)