Bom, existe uma maneira de fazer em lua porém não é aconselhável por ser um addEvent() que poderá lagar o servidor, além de bugs, mas mesmo assim é simples e uma boa idéia.
Vai na pasta data\creaturescripts\scripts e substitua o login.lua por este:
local function isPlayerMoving(cid, fromPos)
if (isPlayer(cid) == TRUE) then
toPos = getThingPos(cid)
if (fromPos.x == toPos.x) and (fromPos.y == toPos.y) and (fromPos.z == toPos.z) then
doSendMagicEffect(toPos, CONST_ME_SLEEP)
addEvent(isPlayerMoving, 10*1000, cid, toPos)
else
addEvent(isPlayerMoving, 30*1000, cid, toPos)
end
end
end
function onLogin(cid)
registerCreatureEvent(cid, "PlayerDeath")
addEvent(isPlayerMoving, 30*1000, cid, getThingPos(cid))
return TRUE
end
Espero ter ajudado! :positive:
Dokmos, o script esta certinho.
A questao do addevent gerar lag e bugs é bem simples de ser contornada.
Como o addevent eh uma funcao que realmente gera alguns lags ao invez de você executar todo o script dentro do evento voce pode usar o evento como um simples "timer". Ou seja... você tem a variavel timer=0, quando aciona o evento timer = 1, e no onLogin você tem if timer == 1 then.
Ficaria mais ou menos assim:
local timer = 0
local function isPlayerMoving(cid, fromPos)
timer = 1
end
function onLogin(cid)
registerCreatureEvent(cid, "PlayerDeath")
a = 1
addEvent(isPlayerMoving, 30*1000, cid, getThingPos(cid))
while a == 1 do
if timer = 1 then
if (isPlayer(cid) == TRUE) then
toPos = getThingPos(cid)
if (fromPos.x == toPos.x) and (fromPos.y == toPos.y) and (fromPos.z == toPos.z) then
doSendMagicEffect(toPos, CONST_ME_SLEEP)
timer = 0
addEvent(isPlayerMoving, 10*1000, cid, toPos)
else
timer = 0
addEvent(isPlayerMoving, 30*1000, cid, toPos)
end
end
end
end
return TRUE
end
não sei se esta totalmente certo, afinal estou meio enferrujado
.
Mas creio que funciona.
abraços
//skulls