Olá galerinha Xtibiana! A partir de um pedido, fiz esse sistema que "para o tempo" para os players que estiverem a vista do caster.
Vamos ao script.
Talkactions.xml:
<talkaction words="stop time" event="script" filter="word-spaced" value="stoptime.lua"/>
stoptime.lua:
-- Script by LuckOake
function onSay(cid, words, param)
local waittime = 10 -- Tempo de exhaustion
local storage = 6853
ppos = getCreaturePosition(cid)
parea1 = {x=ppos.x-7, y=ppos.y-5, z=ppos.z}
parea2 = {x=ppos.x+7, y=ppos.y+5, z=ppos.z}
level = 100 -- Level que o player necessita para usar a talk
if getPlayerLevel(cid) < level then
doPlayerSendCancel(cid, "Você precisa de level "..level.." para usar essa magia.")
return true
end
if exhaustion.check(cid, storage) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Aguarde " .. exhaustion.get(cid, storage) .. " segundos para usar a spell novamente.")
return true
end
for _, pid in ipairs(getPlayersOnline()) do
if isInArea(getCreaturePosition(pid), parea1, parea2) then
if getPlayerAccess(pid) <= 2 then
doCreatureSetNoMove(pid, true)
doSendMagicEffect(getCreaturePosition(pid), 30)
setPlayerStorageValue(pid, 1634, 1)
addEvent(setPlayerStorageValue, 10000, pid, 1634, -1)
doCreatureSay(pid, "*time stopped*", TALKTYPE_MONSTER)
addEvent(doCreatureSay, 10000, pid, "*time is back to normal*", TALKTYPE_MONSTER)
addEvent(doCreatureSetNoMove, 10000, pid, false)
else
end
end
end
doCreatureSetNoMove(cid, false)
exhaustion.set(cid, storage, waittime)
doCreatureSay(cid, "stop time", TALKTYPE_MONSTER)
return true
end
Creaturescripts.xml:
<event type="logout" name="StopTime" event="script" value="stoptime.lua"/>
stoptime.lua:
local storage = 1634
function onLogout(cid)
if (getCreatureStorage(cid, storage) == 1) then
doPlayerSendCancel(cid, "You can not log out while the time is stopped.")
return false
end
return true
end
Obrigado, até.