• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Exhaust (cooldown) on this spell

dex93

New Member
Joined
May 31, 2015
Messages
57
Reaction score
3
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

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
 
Solution
try this.
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
   if exhaustion.check(cid, 3544) then
       doPlayerSendTextMessage(cid, 27, "Spell cooldown: "..exhaustion.get(cid, 3544).." seconds")
       -- return true
       return false
   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...
try this.
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
   if exhaustion.check(cid, 3544) then
       doPlayerSendTextMessage(cid, 27, "Spell cooldown: "..exhaustion.get(cid, 3544).." seconds")
       -- return true
       return false
   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(getCreaturePosition(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
 
Solution
Back
Top