FE
erro

ajuda cancel da spell

Por FelipeXT, 28 de mai. de 2015 em Scripts

spell
script
4
957
FelipeXTF
28 de maio de 2015 às 22:26

bom fiz um script dentro da spell que so player com reset poderia usala e o seguinte

 

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
setCombatParam(combat, COMBAT_PARAM_EFFECT, 40)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 0, 1, 0,10)

local condition = createConditionObject(CONDITION_REGENERATION)
setConditionParam(condition, CONDITION_PARAM_TICKS, 20000)
setConditionParam(condition, CONDITION_PARAM_HEALTHGAIN, 6000)
setConditionParam(condition, CONDITION_PARAM_HEALTHTICKS, 2)
setCombatCondition(combat, condition)

local function Cooldown(cid)
if isPlayer(cid) == TRUE then
doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,'CD: Exeta Mas Regen')
end
end

local exhausted_seconds = 30 -- Segundos que o Player Poderá castar a spell novamente
local exhausted_storagevalue = 6784 -- Storage Value do Cool Down
local Resets = 1

function onCastSpell(cid, var)
if(os.time() < getPlayerStorageValue(cid, exhausted_storagevalue)) then
doPlayerSendCancel(cid,'O Cooldown não está pronto.')
else
if getResets(cid) >= Resets then
doPlayerSendCancel(cid,'Voce presisa de 1 reset para usala.')
return true
end
end






rand = math.random(1,1)
if rand == 1 and isPlayer(cid) == 1 then
doPlayerSay(cid,"Exeta mas regen",16)
addEvent(Cooldown, 1*30000,cid)
setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
return doCombat(cid, combat, var)
elseif rand == 2 and isPlayer(cid) == 1 then
doPlayerSay(cid,"Exeta mas regen!",16)
addEvent(Cooldown, 1*30000,cid)
setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
return doCombat(cid, combat, var)
else
addEvent(Cooldown, 1*30000,cid)
setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
return doCombat(cid, combat, var)
end
end

 

so que ainda continua pedindo resets mesmo eu tendo!

 

7.92

AdilsonHackerA
28 de maio de 2015 às 23:05
Melhor resposta
Tenta:



local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
setCombatParam(combat, COMBAT_PARAM_EFFECT, 40)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 0, 1, 0,10)

local condition = createConditionObject(CONDITION_REGENERATION)
setConditionParam(condition, CONDITION_PARAM_TICKS, 20000)
setConditionParam(condition, CONDITION_PARAM_HEALTHGAIN, 6000)
setConditionParam(condition, CONDITION_PARAM_HEALTHTICKS, 2)
setCombatCondition(combat, condition)

local function Cooldown(cid)
if isPlayer(cid) == TRUE then
doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,'CD: Exeta Mas Regen')
end
end

local exhausted_seconds = 30 -- Segundos que o Player Poderá castar a spell novamente
local exhausted_storagevalue = 6784 -- Storage Value do Cool Down
local Resets = 1

function onCastSpell(cid, var)
if(os.time() < getPlayerStorageValue(cid, exhausted_storagevalue)) then
doPlayerSendCancel(cid,'O Cooldown não está pronto.')
else
if getResets(cid) < Resets then
doPlayerSendCancel(cid,'Voce presisa de 1 reset para usala.')
return true
end
end





rand = math.random(1,1)
if rand == 1 and isPlayer(cid) == 1 then
doPlayerSay(cid,"Exeta mas regen",16)
addEvent(Cooldown, 1*30000,cid)
setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
return doCombat(cid, combat, var)
elseif rand == 2 and isPlayer(cid) == 1 then
doPlayerSay(cid,"Exeta mas regen!",16)
addEvent(Cooldown, 1*30000,cid)
setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
return doCombat(cid, combat, var)
else
addEvent(Cooldown, 1*30000,cid)
setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
return doCombat(cid, combat, var)
end
end


Editado Maio 28 por AdilsonTsunami

FelipeXTF
29 de maio de 2015 às 07:20

vlw man com base no que vc fez eu consegui fazer oque eu queria eu estava errando os simbolos! rep+

 

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
setCombatParam(combat, COMBAT_PARAM_EFFECT, 40)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 0, 1, 0,10)

local condition = createConditionObject(CONDITION_REGENERATION)
setConditionParam(condition, CONDITION_PARAM_TICKS, 20000)
setConditionParam(condition, CONDITION_PARAM_HEALTHGAIN, 6000)
setConditionParam(condition, CONDITION_PARAM_HEALTHTICKS, 2)
setCombatCondition(combat, condition)

local function Cooldown(cid)
if isPlayer(cid) == TRUE then
doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,'CD: Exeta Mas Regen')
end
end

local exhausted_seconds = 30 -- Segundos que o Player Poderá castar a spell novamente
local exhausted_storagevalue = 6784 -- Storage Value do Cool Down
local Resets = 1

function onCastSpell(cid, var)
if(os.time() < getPlayerStorageValue(cid, exhausted_storagevalue)) then
doPlayerSendCancel(cid,'O Cooldown não está pronto.')
return TRUE
else
if getResets(cid) < Resets then
doPlayerSendCancel(cid,'Voce presisa de 1 reset para usala.')
return TRUE
end
end








rand = math.random(1,1)
if rand == 1 and isPlayer(cid) == 1 then
doPlayerSay(cid,"Exeta mas regen",16)
addEvent(Cooldown, 1*30000,cid)
setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
return doCombat(cid, combat, var)
elseif rand == 2 and isPlayer(cid) == 1 then
doPlayerSay(cid,"Exeta mas regen!",16)
addEvent(Cooldown, 1*30000,cid)
setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
return doCombat(cid, combat, var)
else
addEvent(Cooldown, 1*30000,cid)
setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
return doCombat(cid, combat, var)
end
end

MudrockM
29 de maio de 2015 às 08:22

Duvida resolvida, movido