Nome: Life Fountain
Versão Testada: 8.54
Descrição: Você vai ganhando 'x' vida (sem poder se mover), quando sua vida chega no máximo o script para. Caso você logue, para evitar bugs, há um creature event que bloqueia que continue healando, e mude o storage.
Code:
Creature Scripts:
fonte.lua
function onLogout(cid) local storage = 9977 if getPlayerStorageValue(cid,storage) == 1 then doPlayerSetStorageValue(cid,storage,-1) doCreatureSetNoMove(cid,false) end return TRUE end
creaturescripts.xml
<event type="logout" name="Fountain" event="script" value="fonte.lua"/>
Actions:
fonte.lua
-- Life Fountain by sejameuamigo function onUse(cid, item, fromPosition, itemEx, toPosition) local pos = getCreaturePosition(cid) local storage = 9977 -- storage, se mudou aki mude no creaturescripts local health = 50 -- vida que vai healar por delay local Und = 1334 -- unique id do item local delay = 1 -- delay por heal(segundos) local effect = 12 -- efeito, ta naqueles brilhos azuis que e de heal msm function foder() if getCreatureHealth(cid) == getCreatureMaxHealth(cid) and getPlayerStorageValue(cid,storage) == 1 then doPlayerSendTextMessage(cid,4,"It ends now.") doPlayerSetStorageValue(cid,storage,-1) doCreatureSetNoMove(cid,false) elseif getCreatureHealth(cid) < getCreatureMaxHealth(cid) and getPlayerStorageValue(cid,storage) == 1 then doCreatureSetNoMove(cid,true) addEvent(doCreatureAddHealth,delay*1000,cid,health) addEvent(doSendMagicEffect,delay*1000,pos,12) addEvent(foder,1000) end end if getPlayerStorageValue(cid,storage) == 1 then doPlayerSendTextMessage(cid,4,"Machine is already working. Please wait.") elseif item.uid == Und and getCreatureHealth(cid) == getCreatureMaxHealth(cid) and getPlayerStorageValue(cid,storage) == -1 then doPlayerSendTextMessage(cid,4,"Your life is already full.") elseif item.uid == Und and getCreatureHealth(cid) < getCreatureMaxHealth(cid) and getPlayerStorageValue(cid,storage) == -1 then doPlayerSendTextMessage(cid,4,"Machine starts.") doPlayerSetStorageValue(cid,storage,1) addEvent(foder,100) end return TRUE end
actions.xml
<action uniqueid="1334" script="fonte.lua"/>
O 1334 é o unique id, tem que ser o mesmo do "local Und = xxx" do fonte.lua.
Observação: Se o player logar no meio do script, vai aparecer um erro no console que não conseguiu achar o player e healar ele. Não muda nada.
Gostou? Rep+
Não Gostou? Rep+