JA
pedido

Player morre e é teleportado para o templo

Por jackfan, 12 de fev. de 2013 em Scripts

tibia
otserv
25
5.1k
murilo103M
12 de fevereiro de 2013 às 11:29

assim eu to fazendo um poketibia so que nao sei como fazer isso quero que o player quando morre ele é teleportado para o templo e nao perde os itens so xp mesmo quem ajudar vai ganhar meu rep++

Para seu personagem não perder skills, level, loot etc...

Coloque em Creturescripts/scripts/levelprotection.lua

 

function onDeath(cid, corpse, deathList)

 

local config = {

onlypremium = false, -- se precisa ser premium para não perder nada

exp = false, -- se ao morrer o jogador irá perder exp

skills = false, -- se ao morrer vai perder skills

magic = false, -- se vai perder magic level

loot = false, -- se ao morrer o jogador irá perder o loot

level = 70 -- até que level irá proteger o player

}

if isPlayer(cid) and getPlayerLevel(cid) <= config.level then

if config.onlypremium == true and not isPremium(cid) then return TRUE end

if config.loot == false then doCreatureSetDropLoot(cid, false) end

if config.magic == false then doPlayerSetLossPercent(cid, PLAYERLOSS_MANA, 0) end

if config.skills == false then doPlayerSetLossPercent(cid, PLAYERLOSS_SKILLS, 0) end

if config.exp == false then doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, 0) end

return TRUE end return TRUE end

 

Coloque em Creturescripts/scripts/login.lua

 

registerCreatureEvent(cid, "ProtectLevel")

 

e em Creaturescripts.xml coloque:

 

<event type="death" name="ProtectLevel" event="script" value="levelprotection.lua"/>

 

Espero ter ajudado :)

 

--- EDITEI UM ERRO QUE TINHA --

 

JACKFAN COPIE E COLE NOVAMENTE O SCRIPT EU ERREI EM UMA PARADA :p

Editado Fevereiro 12 por murilo103

jackfanJ
12 de fevereiro de 2013 às 11:34

Testando Ja editor o Topico se resultar e resolver o problema ganhara meu Rep++

murilo103M
12 de fevereiro de 2013 às 11:52

 

function onDeath(cid, corpse, deathList)

 

local config = {

onlypremium = false, -- se precisa ser premium para não perder nada

skills = false, -- se ao morrer vai perder skills

magic = false, -- se vai perder magic level

loot = false, -- se ao morrer o jogador irá perder o loot

level = 300 -- até que level irá proteger o player

}

if isPlayer(cid) and getPlayerLevel(cid) <= config.level then

if config.onlypremium == true and not isPremium(cid) then return TRUE end

if config.loot == false then doCreatureSetDropLoot(cid, false) end

if config.magic == false then doPlayerSetLossPercent(cid, false) end

if config.skills == false then doPlayerSetLossPercent(cid, false) end

return TRUE end return TRUE end

 

Pronto este está funcionando 100% testei agora!

Daniel BighouseD
12 de fevereiro de 2013 às 11:55

Só uma duvida:

É para criar o arquivo? levelprotection.lua

jackfanJ
12 de fevereiro de 2013 às 11:59

Obrigado cara ganhou meu Rep+++ nao fecha o topico ainda vamos testar ja editor e falo se fecha ou se o problema nao foi resolvido

murilo103M
12 de fevereiro de 2013 às 11:59

Só uma duvida:

É para criar o arquivo? levelprotection.lua

 

É sim, em Creaturescripts\scripts.

jackfanJ
12 de fevereiro de 2013 às 12:05

cara funciono ganhou meu rep++ e do daniel ajudou bastante vlw

Daniel BighouseD
12 de fevereiro de 2013 às 12:13

Só tem dois erros acontecendo quando um player morre

[Error - CreatureScript Interface]
data/creaturescripts/levelprotetion.lua onDeath
Description:
<luaDoPlayerSetLossPercent> Player not found

pode ajudar?

StigalS
12 de fevereiro de 2013 às 12:14

Duvida Sanada, Topico Movido!

Daniel BighouseD
12 de fevereiro de 2013 às 12:16

Duvida Sanada, Topico Movido!

 

Sanada não ainda tem um erro pode parar!

Deixa resolver tudo ph34r.png

 

 

Edit: resolvido!

 

Só deixei o script assim:

function onDeath(cid, corpse, deathList)

local config = {
onlypremium = false, -- se precisa ser premium para não perder nada
loot = false, -- se ao morrer o jogador irá perder o loot
level = 1000 -- até que level irá proteger o player
}
if isPlayer(cid) and getPlayerLevel(cid) <= config.level then
if config.onlypremium == true and not isPremium(cid) then return TRUE end
if config.loot == false then doCreatureSetDropLoot(cid, false) end
return TRUE end return TRUE end

Editado Fevereiro 12 por DanielBadhu