function crearPuntoEntrega(tabla)
local RADIO_ENTREGA = 1
local X = tabla[1].x
local Y = tabla[1].y
local Z = tabla[1].z
local zonaEntrega = createMarker(X, Y, Z, 'checkpoint', RADIO_ENTREGA, 255, 0, 0, 255, player)
local zonaEntregaIcono = createBlip(X, Y, 0, player)
addEventHandler('onMarkerHit', zonaEntrega, function()
destroyElement(zonaEntrega)
destroyElement(zonaEntregaIcono)
table.remove(tabla, 1)
local next = next
if next(tabla) == nil then
recargarPizzas()
else
crearPuntoEntrega(tabla)
end
end)
end
As you can see, "crearPuntoEntrega" gets a table with coordinates, then it creates checkpoints according to those coordinates. If the table is empty, the script triggers "recargarPizzas". I don't know if this is correct, I've done some improvisation using my previous knowledge about languages.
Of course, here you go:
function crearPuntoEntrega(tabla)
local RADIO_ENTREGA = 1
local X = tabla[1].x
local Y = tabla[1].y
local Z = tabla[1].z
local zonaEntrega = createMarker(X, Y, Z, 'checkpoint', RADIO_ENTREGA, 255, 0, 0, 255, player)
local zonaEntregaIcono = createBlip(X, Y, 0, player)
addEventHandler('onMarkerHit', zonaEntrega, function()
destroyElement(zonaEntrega)
destroyElement(zonaEntregaIcono)
table.remove(tabla, 1)
local next = next
if next(tabla) == nil then
recargarPizzas()
else
crearPuntoEntrega(tabla)
end
end)
end
And here you have an example:
After hitting that marker, it triggers "crearPuntoEntrega()" that it has the event "onMarkerHit".