Tenta ai. Só criar um arquivo .lua no creaturescripts e por isso:
local hospitalpos = {
[1] = {x = 1006, y = 1010, z = 7}, -- posições pra onde o player será teleportado ao morrer
[2] = {x = 1006, y = 1015, z = 7},
[3] = {x = 1006, y = 1020, z = 7},
}
local str = "MT" --storage para controlar se o player foi morto ou nao
function onDeath(cid, position)
registerCreatureEvent(cid, "DeathPlayerHospital_L")
if isPlayer(cid) then
setPlayerStorageValue(cid, str, 1)
end
return true
end
function onLogin(cid)
registerCreatureEvent(cid, "DeathPlayerHospital")
if isPlayer(cid) then
if getPlayerStorageValue(cid, str) == 1 then
setPlayerStorageValue(cid, str, -1)
doTeleportThing(cid, hospitalpos[math.random(#hospitalpos)], true)
end
end
return true
end
TAG:
<event type="login" name="DeathPlayerHospital_L" event="script" value="arquivo.lua"/>
<event type="death" name="DeathPlayerHospital" event="script" value="arquivo.lua"/>
Se quiser por mais posições só adicionar conforme o script. Daria pra fazer também um fromPosition e toPosition , assim o jogador se teleportaria pra qualquer lugar dentro das área configurada. Mas recomendo usar dessa maneira que te mandei.
╔══════════════════════════ҳ̸Ҳ̸ҳஜ۩۞۩ஜҳ̸Ҳ̸ҳ══════════════════════════╗
ALGUNS DOS MEUS TRABALHOS:

Te Ajudei? Rep + e ficamos Quits

Precisando de ajuda?
Discord: Yan Liima #3702
Programador Júnior de LUA, PHP e JavaScript
Juntos somos lendas, separados somos Mitos!
╚══════════════════════════ҳ̸Ҳ̸ҳஜ۩۞۩ஜҳ̸Ҳ̸ҳ═════════════════════════════╝