Jump to content

Spawn point according to the location


dener189

Recommended Posts

6 minutes ago, Dimos7 said:

Bem, primeiro crie uma tabela com todos os locais do hospital, em seguida, leva a localização do jogador morreu e use para chegar onde está mais perto fazer um loop para todos os hospitais e colocar> para verificar o que está mais perto



 

could you give an example with a simple one-track script?

Link to comment
1 minute ago, Dimos7 said:

as i tell you need a table with all hospital location that all

Hospital_LS" posX="2034.9428710938" posY="-1403.2003173828" posZ="18"
Hospital_SF" posX="-2655.3991699219" posY="638.16137695313" posZ="15"
Hospital_El_Quebrados" posX="-1514.6713867188" posY="2522.4748535156" posZ="56"
Hospital_LV" posX="1607.62890625" posY="1818.9958496094" posZ="11"
Hospital_Angel_Pine" posX="-2198.5632324219" posY="-2306.6220703125" posZ="31"

All Spawns 

Link to comment
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

Edited by Dimos7
  • Thanks 1
Link to comment
1 minute ago, Dimos7 said:

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], [v2], v[3]) < getDistanceBetweenPoints3D(x, y, z, v[4], [v5] , 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

thank you very much ❤️❤️❤️ 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...