• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Solved Need time on this spell

Joined
Apr 11, 2015
Messages
106
Reaction score
6
Hello guys, i need a time on this spell, after 30 sec, all the creatures die

function onCastSpell(cid, var)
if #getCreatureSummons(cid) < 1 then
for x = 1, 1 do
m = doSummonCreature("Demon", getThingPos(cid))
doConvinceCreature(cid, m)
end
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
else
doPlayerSendCancel(cid, "You already summoned monsters.")
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
return false
end
return true
end
 
Hello guys, i need a time on this spell, after 30 sec, all the creatures die

function onCastSpell(cid, var)
if #getCreatureSummons(cid) < 1 then
for x = 1, 1 do
m = doSummonCreature("Demon", getThingPos(cid))
doConvinceCreature(cid, m)
end
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
else
doPlayerSendCancel(cid, "You already summoned monsters.")
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
return false
end
return true
end
Give this a try, let me know if there's any issues.
Code:
local function removeSummons(cid,summons)
    if isCreature(cid) then
        if #summons > 0 then
            for i, v in ipairs(summons) do
                doRemoveCreature(v)
            end  
        end      
    end
end

function onCastSpell(cid, var)
local summons = getCreatureSummons(cid)
    if #summons < 1 then
        for x = 1, 1 do
        m = doSummonCreature("Demon", getThingPos(cid))
            doConvinceCreature(cid, m)
        end
        doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
        addEvent(removeSummons, 30000, cid, summons)
    else
        doPlayerSendCancel(cid, "You already summoned monsters.")
        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
    return false
    end
return true
end
 
This should work @Matheus Vieira
Code:
local function removeSummons(cid)
local summons = getCreatureSummons(cid)
    if #summons > 0 then
        for i, v in ipairs(summons) do
            doRemoveCreature(v)
        end 
    end     
end

function onCastSpell(cid, var)
    if #getCreatureSummons(cid) < 1 then
        addEvent(removeSummons, 30000, cid)
        for x = 1, 1 do
        m = doSummonCreature("Demon", getThingPos(cid))
            doConvinceCreature(cid, m)
        end
        doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
    else
        doPlayerSendCancel(cid, "You already summoned monsters.")
        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
    return false
    end
return true
end
 
when remove, sry
Code:
local function removeSummons(cid)
local summons = getCreatureSummons(cid)
    if #summons > 0 then
        for i, v in ipairs(summons) do
            doRemoveCreature(v)
            doSendMagicEffect(getCreaturePosition(v), 66)
        end
    end    
end

function onCastSpell(cid, var)
    if #getCreatureSummons(cid) < 1 then
        addEvent(removeSummons, 30000, cid)
        for x = 1, 1 do
        m = doSummonCreature("Demon", getThingPos(cid))
            doConvinceCreature(cid, m)
        end
        doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
    else
        doPlayerSendCancel(cid, "You already summoned monsters.")
        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
    return false
    end
return true
end
 
Back
Top