Jump to content

Ajuda respawn


Recommended Posts

Posted

Olá,

Então galera no meu script quando o player loga no servidor ele nasce na base do team dele, ai quando ele morre  ele nasce na base do team denovo, eu queria uma dica de como faço para ele quando morrer nascer em um hospital,    no caso cada team nasce em um hospital diferente quando morrer

function spawner()
	setTimer(function(source)
	local teamCoords = coords[getTeamName(getPlayerTeam(source))]
	local rndN = 0
	if teamCoords then
		rndN = math.random(1,#teamCoords)
		setElementPosition(source, teamCoords[rndN][1], teamCoords[rndN][2], teamCoords[rndN][3])
	else
		rndN = math.random(1,#novato)
		setElementPosition(source, novato[rndN][1], novato[rndN][2], novato[rndN][3])
	end
	end,1000,1,source)
end
addEventHandler("onPlayerSpawn",getRootElement(),spawner)
------
------
function getSpawnSede (thePlayer)
	if (thePlayer) then
		if (getPlayerTeam(thePlayer)) then
			if (coords[getTeamName(getPlayerTeam(thePlayer))][1]) then
				return coords[getTeamName(getPlayerTeam(thePlayer))][1], coords[getTeamName(getPlayerTeam(thePlayer))][2], coords[getTeamName(getPlayerTeam(thePlayer))][3] 
			end
		end
	end
end


setOcclusionsEnabled( false )

 

  • Moderators
Posted

Troque seu onPlayerSpawn pra onPlayerLogin para fazer o jogador aparecer na base ao logar.

Use onPlayerSpawn para fazer ele ir pro hospital ao spawnar.

Eu te ajudei ou achou meu comentário útil? Não esqueça de deixar um Thanksspacer.png

Minhas contribuições para a comunidade: LordHenry - MTA Wiki Profile
Inscreva-se no meu canal do YouTube: Lord Henry - Entertainment
Discord Oficial do MTA: https://mtasa.com/discord
Blacklist e Whitelist de Scripters: Planilha

Por favor, não me envie mensagens privadas solicitando suporte. Crie um tópico no fórum em vez disso.

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...