E ai galera, esses dias eu estava tentando fazer um script que o pessoal procura muito que é o famoso sistema de saga, que consiste no seguinte, o player só pode atacar e ser atacado por uma devida criatura se possuir certa storage caso contrario a criatura não ira se mover, bom, consegui fazer quase tudo em lua, só que existe um pequeno problema, que é o seguinte, esse problema está na parte que retorna a speed da criatura, a speed não retorna, tudo funciona corretamente exceto essa parte, peça a ajuda de vocês e agradeço desde já, script:
local name, storage = 'fire devil', 11112local sto = 800000local speedchange = 0function onAttack(cid, target)if isMonster(cid) and getCreatureName(cid):lower() == name and isPlayer(target) and getCreatureStorage(target, storage) < 0 thensetPlayerStorageValue(cid, sto, getCreatureSpeed(cid))doChangeSpeed(cid, -getCreatureSpeed(cid))doChangeSpeed(cid, speedchange)return falseendif isMonster(cid) and getCreatureName(cid):lower() == name and isPlayer(target) and getCreatureStorage(target, storage) > 1 then -- O ERRO PERTENCE A ESSA PARTEdoChangeSpeed(cid, -getCreatureSpeed(cid))local oldspeed = getPlayerStorageValue(cid, sto) == -1 and getCreatureBaseSpeed(cid) or getPlayerStorageValue(cid, sto)doChangeSpeed(cid, oldspeed)return false -- O PROBLEMA ESTA AQUIendreturn trueendfunction onCombat(cid, target)if isPlayer(cid) and getCreatureStorage(cid, storage) < 0 and isMonster(target) and getCreatureName(target):lower() == name thendoPlayerSendCancel(cid, 'You cannot attack this monster.')return falseend if isMonster(cid) and getCreatureName(cid):lower() == name and isPlayer(target) and getCreatureStorage(target, storage) < 0 thenreturn falseendreturn trueendfunction onKill(cid, target, lastHit)if isMonster(target) and getCreatureName(target):lower() == name and isPlayer(cid) and getCreatureStorage(cid, storage) > 0 thendoCreatureSetStorage(cid, storage, -1)endreturn trueend