C3l1n Posted Friday at 21:05 Share Posted Friday at 21:05 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) Link to comment
noonbr Posted Sunday at 14:54 Share Posted Sunday at 14:54 Você primeiro precisa obter o ID da skin que o jogador estava quando morreu, pra isso você usuará getElementModel. Você usará esse ID para redefinir no jogador quando utiizar a função spawnPlayer - no sexto argumento. --// obter o ID da skin quando o jogador morreu. local previousSkinID = getElementModel(source) setTimer(function(player) local x, y, z = unpack(position) local rotation = 0 spawnPlayer(source, x, y, z, rotation, previousSkinID) end, 5000, 1, source) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now