function setMarker(type, x, y, z, radius, color)
local checkpoint = {addBlipForCoord(x, y, z), createCheckpoint(type, x, y, z, 1, 1, 1, radius)}
changeBlipColour(checkpoint[1], color)
addEventHandler("onScriptTerminate", function(script)
if (script == thisScript()) then
removeBlip(checkpoint[1])
deleteCheckpoint(checkpoint[2])
end
end)
lua_thread.create(function()
repeat
wait(0)
local x1, y1, z1 = getCharCoordinates(PLAYER_PED)
until (getDistanceBetweenCoords3d(x, y, z, x1, y1, z1) < radius) or not doesBlipExist(checkpoint[1])
removeBlip(checkpoint[1])
deleteCheckpoint(checkpoint[2])
addOneOffSound(0, 0, 0, 1149)
end)
end