Hi, I tried add exhaust (like cooldown) here but I can still cast spell every 3s (as it set in spells.xml).
after say "spelll XXX" I have 3s exhaust (spells.xml) then I couln't cast this for 27 seconds but I can) :<
OTX 2.X.S
after say "spelll XXX" I have 3s exhaust (spells.xml) then I couln't cast this for 27 seconds but I can) :<
OTX 2.X.S
Lua:
--SCRIPT BY CHAVOZ
local duration = 30 -- how long this spell exist (in seconds)
local sece = 2 -- every how much seconds will the red effect appear
function onCastSpell(cid, var)
if exhaustion.get(cid, 3544) and exhaustion.get(cid, 3544) > 0 then
doPlayerSendTextMessage(cid,27,"Spell cooldown: "..exhaustion.get(cid,3544).." seconds")
return true
end
local function finish(cid)
if not isCreature(cid) then return true end
setPlayerStorageValue(cid,99, -1)
end
addEvent(finish,duration*1000,cid)
local function sendEff(cid)
if not isCreature(cid) then return true end
if getPlayerStorageValue(cid,99)==1 then
doSendMagicEffect(getCre aturePosition(cid), CONST_ME_MAGIC_RED)
addEvent(sendEff,sece*1000,cid)
end
end
sendEff(cid)
setPlayerStorageValue(cid,99,1)
exhaustion.set(cid, 3544, 30)
return true
end