local spawnLocation = {
["Los Santos"] =
{
{2032.30676 , -1404.76147 ,17.25112},
{1173.74976 ,-1321.97998, 15.19531}
},
["Las Venturas"] =
{
{ 1584.93396, 1747.93079, 10.82800}
},
["San Fierro"] =
{
{-2660.65576, 636.20300,14.45313}
}
}
function spawn ()
local location = getElementZoneName ( source, true )
print (location)
local resultado = nil
local position = nil
for name,data in pairs(spawnLocation[location])do
local x,y,z = getElementPosition(source)
local posx,posy,posz = data[1] , data[2] , data[ 3]
local distancia = getDistanceBetweenPoints3D(x , y ,z, posx,posy,posz)
if not resultado then
resultado = distancia
position = { posx , posy,posz}
else
if distancia < resultado then
resultado = distancia
position = { posx , posy,posz}
end
end
end
if resultado then
setTimer(spawnPlayer,5000,1,source ,unpack(position))
setTimer ( function(source)
takePlayerMoney(source, 50)
outputChatBox ( "#00FFFF[HOSPITAL]Para curar seus ferimentos o hospital cobrou 50$ de Você",source, 255, 255, 255, true )
end, 5000, 1, source )
end
end
addEventHandler("onPlayerWasted", getRootElement(), spawn)