Shoorkill
Active Member
- Joined
- Dec 17, 2018
- Messages
- 153
- Reaction score
- 25
Good morning friends, I'm using Nekiro's TFS 1.5 and I need this spell that causes it to prevent the opponent from healing or attacking, spells, runes for 3 seconds.
MY SCRIPT:
MY SCRIPT:
My error:local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_RED)
-- Definindo as condições de paralisia
local condition = createConditionObject(CONDITION_PARALYZE)
setConditionParam(condition, CONDITION_PARAM_TICKS, 3000) -- 3 segundos de paralisia
setConditionParam(condition, CONDITION_PARAM_SPEED, -300) -- Reduz a velocidade
-- Definindo a condição de exaustão
local exhaust = createConditionObject(CONDITION_EXHAUST_COMBAT)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 3000) -- 3 segundos de exaustão
local arr = {
{0, 1, 1, 1, 0},
{1, 1, 1, 1, 1},
{1, 1, 3, 1, 1},
{1, 1, 1, 1, 1},
{0, 1, 1, 1, 0}
}
local area = createCombatArea(arr)
setCombatArea(combat, area)
-- Função para aplicar as condições ao alvo
function onTargetCreature(cid, target)
-- Verifica se o alvo é uma criatura válida
if not target or not isCreature(target) then
return false -- Se não for uma criatura válida, retorna
end
-- Se for um jogador, aplica as condições
if isPlayer(target) then
local rand = math.random(1, 5)
local position = getCreaturePosition(target) -- Pega a posição do alvo
-- Envia texto animado "Silence!" para o alvo
Game.sendAnimatedText(position, "Silence!", 215)
-- Aplica a condição de exaustão
if rand == 1 then
doCombat(cid, combat, var) -- Aplica o combate com a condição
setPlayerStorageValue(target, exhausted_storagevalue, os.time() + exhausted_seconds)
setPlayerStorageValue(target, exhausted_storagevalue1, os.time() + exhausted_seconds1)
else
doCombat(cid, combat, var) -- Aplica o combate com a condição
setPlayerStorageValue(target, exhausted_storagevalue, os.time() + exhausted_seconds)
setPlayerStorageValue(target, exhausted_storagevalue1, os.time() + exhausted_seconds1)
end
end
end
setCombatCallback(combat, CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")
local function Cooldown(cid)
if isPlayer(cid) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, 'CD: Mais tempo')
end
end
local exhausted_seconds = 5 -- Tempo de cooldown (segundos)
local exhausted_storagevalue = 9432 -- Valor do Storage para o cooldown
-- Função chamada ao lançar o feitiço
function onCastSpell(cid, var)
if os.time() < getPlayerStorageValue(cid, exhausted_storagevalue) then
doPlayerSendCancel(cid, 'O cooldown não está pronto.')
return TRUE
end
local rand = math.random(1, 50)
if rand == 1 and isPlayer(cid) then
doPlayerSay(cid, "Stop Time!", 16)
-- Removendo o 'cid' do addEvent
addEvent(Cooldown, 15000, cid) -- 15 segundos de cooldown
setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
return doCombat(cid, combat, var)
elseif rand == 2 and isPlayer(cid) then
doPlayerSay(cid, "Stop Bitch!", 16)
-- Removendo o 'cid' do addEvent
addEvent(Cooldown, 15000, cid) -- 15 segundos de cooldown
setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
return doCombat(cid, combat, var)
else
-- Removendo o 'cid' do addEvent
addEvent(Cooldown, 15000, cid) -- 15 segundos de cooldown
setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
return doCombat(cid, combat, var)
end
end
Any help will be welcome, thank you in advance!Lua Script Error: [Spell Interface]
data/spells/scripts/stoptime.luanCastSpell
LuaScriptInterface::luaAddEvent(). Argument #3 is unsafe
stack traceback:
[C]: in function 'addEvent'
data/spells/scripts/stoptime.lua:88: in function <data/spells/scripts/stoptime.lua:66>
Lua Script Error: [Spell Interface]
in callback: data/spells/scripts/stoptime.luanTargetCreature
(Unknown scriptfile)