local Hospitals = {2034.9428710938,-1403.2003173828, 18,
-2655.3991699219 ,638.16137695313, 15,
-1514.6713867188 ,2522.4748535156, 56,
1607.62890625 , 1818.9958496094 , 11,
-2198.5632324219, -2306.6220703125, 31,
}
function spawnNearHospital()
for _, v in ipairs(Hospitals) do
local x, y, z = getElementPosition(source)
if getDistanceBetweenPoints3D(x, y, z, v[1], v[2], v[3]) < getDistanceBetweenPoints3D(x, y, z, v[4], v[5] , v[6]) < getDistanceBetweenPoints3D(x, y, z, v[7], v[8] , v[9]) < getDistanceBetweenPoints3D(x, y, z, v[10], v[11], v[12]) < getDistanceBetweenPoints3D(x, y, z, v[13], v[14], v[15]) then
spawnPlayer(source, v[1], v[2], v[3])
end
end
end
addEventHandler("onPlayerWasted", root, spawnNearHospital)
something like this