Postado Julho 13, 2015 10 anos Solução Ainda continua do msm jeito que eu falei ai em cima Logo após: function onCastSpell(cid, var) Adicione: if getPlayerStorageValue(cid, cooldownStorage) > os.time() then doPlayerSendCancel(cid, "You are exhausted.") return true else setPlayerStorageValue(cid, cooldownStorage, (os.time()+cooldownSeconds)) end E no começo to arquivo, no começo mesmo, de dois enter, e atrás dos dois enter, adicione isso: local cooldownSeconds = 5 local cooldownStorage = 6541 Nisso /\, você configura o tempo de cooldown que a spell irá dar: 5 segundos que está configurado. E a storage do cooldown, caso queira um cooldown diferente para cada magia, mude o cooldownStorage para outro valor sempre para cada magia. Não testei: local cooldownSeconds = 5 local cooldownStorage = 6541 local tempo = 30 local effect = {175} local health = 1000 local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0) local condition = createConditionObject(CONDITION_REGENERATION) setConditionParam(condition, CONDITION_PARAM_SUBID, 1) setConditionParam(condition, CONDITION_PARAM_BUFF, true) setConditionParam(condition, CONDITION_PARAM_TICKS, tempo*1000) setConditionParam(condition, CONDITION_PARAM_HEALTHGAIN, health) setConditionParam(condition, CONDITION_PARAM_HEALTHTICKS, 1000) setCombatCondition(combat, condition) function magicEffect10(tempo2,tempo3,cid) if (isCreature(cid)) then if getPlayerStorageValue(cid, 102053) > 0 and getCreatureCondition(cid, CONDITION_REGENERATION, 1) then for i=1, #effect do local position = {x=getPlayerPosition(cid).x+1, y=getPlayerPosition(cid).y, z=getPlayerPosition(cid).z} doSendMagicEffect(position, effect[i]) end end end end function onCastSpell(cid, var) if getPlayerStorageValue(cid, cooldownStorage) > os.time() then doPlayerSendCancel(cid, "You are exhausted.") return true else setPlayerStorageValue(cid, cooldownStorage, (os.time()+cooldownSeconds)) end if getPlayerStorageValue(cid, 102053) ~= 1 or getCreatureCondition(cid, CONDITION_REGENERATION, 1) == false then doCombat(cid, combat, var) tempo2 = 0 while (tempo2 ~= (tempo*1000)) do addEvent(magicEffect10, tempo2, tempo2, tempo*1000, cid) tempo2 = tempo2 + 300 end setPlayerStorageValue(cid, 102053,1) else doPlayerSendCancel(cid, "A magia está sendo usada!") end end _ .-'` `} _./) / } .'o \ | } '.___.'`.\ {` /`\_/ , `. } ME DA UMA NOZ! \=' .-' _`\ { `'`;/ `, } _\ @ ; } /__`;-...'--' Cluck!
Postado Julho 13, 2015 10 anos tenta ai, nao mude nada, só tente assim local tempo = 30 local effect = {175} local health = 1000 local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0) local condition = createConditionObject(CONDITION_REGENERATION) setConditionParam(condition, CONDITION_PARAM_SUBID, 1) setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE) setConditionParam(condition, CONDITION_PARAM_TICKS, tempo*1000) setConditionParam(condition, CONDITION_PARAM_HEALTHGAIN, health) setConditionParam(condition, CONDITION_PARAM_HEALTHTICKS, 1000) setCombatCondition(combat, condition) function magicEffect10(tempo2,tempo3,cid) if (isCreature(cid)) then if getPlayerStorageValue(cid, 102053) > 0 and getCreatureCondition(cid, CONDITION_REGENERATION, 1) then for i=1, #effect do local position = {x=getPlayerPosition(cid).x+1, y=getPlayerPosition(cid).y, z=getPlayerPosition(cid).z} doSendMagicEffect(position, effect) end end end end function onCastSpell(cid, var) if exhaustion.check(cid, 23006) == false thenexhaustion.set(cid, 23006, 20)elsedoPlayerSendCancel(cid, "Cooldown[" ..exhaustion.get(cid, 23006).."]")return falseend if getPlayerStorageValue(cid, 102053) ~= 1 or getCreatureCondition(cid, CONDITION_REGENERATION, 1) == false then doCombat(cid, combat, var) tempo2 = 0 while (tempo2 ~= (tempo*1000)) do addEvent(magicEffect10, tempo2, tempo2, tempo*1000, cid) tempo2 = tempo2 + 300 end setPlayerStorageValue(cid, 102053,1) else doPlayerSendCancel(cid, "O magia está sendo usado!.") end end Editado Julho 13, 2015 10 anos por Duuhzera (veja o histórico de edições)
Postado Julho 13, 2015 10 anos Autor o do amigo Snowsz funcionou so queria coloca a mensagem pra fica aparecendo. " falta 24 segundos " falta 10 segundos " faltam 1 segundos ". desse modo. REp Por os 3, Vlw -- Editr -- eu coloquei contagem na mensagem do coldown. local cooldownSeconds = 60 local cooldownStorage = 65412 local tempo = 30 local effect = {175} local health = 1000 local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0) local condition = createConditionObject(CONDITION_REGENERATION) setConditionParam(condition, CONDITION_PARAM_SUBID, 1) setConditionParam(condition, CONDITION_PARAM_BUFF, true) setConditionParam(condition, CONDITION_PARAM_TICKS, tempo*1000) setConditionParam(condition, CONDITION_PARAM_HEALTHGAIN, health) setConditionParam(condition, CONDITION_PARAM_HEALTHTICKS, 1000) setCombatCondition(combat, condition) function magicEffect10(tempo2,tempo3,cid) if (isCreature(cid)) then if getPlayerStorageValue(cid, 102053) > 0 and getCreatureCondition(cid, CONDITION_REGENERATION, 1) then for i=1, #effect do local position = {x=getPlayerPosition(cid).x+1, y=getPlayerPosition(cid).y, z=getPlayerPosition(cid).z} doSendMagicEffect(position, effect) end end end end function onCastSpell(cid, var) if getPlayerStorageValue(cid, cooldownStorage) > os.time() then doPlayerSendCancel(cid, "Você tem que espera "..(cooldownSeconds - (os.time() - getPlayerStorageValue(cid, cooldownStorage))).." seconds, Para pode usa o magia novamente") return true else setPlayerStorageValue(cid, cooldownStorage, (os.time()+cooldownSeconds)) end if getPlayerStorageValue(cid, 102053) ~= 1 or getCreatureCondition(cid, CONDITION_REGENERATION, 1) == false then doCombat(cid, combat, var) tempo2 = 0 while (tempo2 ~= (tempo*1000)) do addEvent(magicEffect10, tempo2, tempo2, tempo*1000, cid) tempo2 = tempo2 + 300 end setPlayerStorageValue(cid, 102053,1) else doPlayerSendCancel(cid, "A magia está sendo usada!") end end mas so que começa do 120 e terminar no 60. eu queria que começa-se no 60 e termina-se no 0. Editado Julho 14, 2015 10 anos por Admnwso (veja o histórico de edições)
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.