Ir para conteúdo

Pergunta

Olá galera tudo bem? Estou procurando uma forma de fazer, ou até mesmo inventar, tenho um sistema de reset muito bom meu servidor! Ele não usa storage segue-se abaixo o modelo do que estou usando.

--[[ <(Advanced Reset System 2.0)>

           Autor: MarcelloMkez. Contato: (marcello_dirt@[member=Hotmail].com)
           Versão: 2.0
           Testado em: 8.50 e 8.60
           TFS: 0.3.6 and 0.4.0
           Fórum: http://www.xtibia.com/forum/topic/142463-advanced-reset-system-20/

       -=[Características]=-
        ~( Versão 2.0 )~

       - Resets agora Armazenados na DataBase; (Sem Valor de Storage)
       - Instala o System e cria a Tabela de Resets com o comando "/installreset";
       - Resets no Look do jogador ex: 22:10 You see Marcello [Reset 2] (Level 8). He is an elder druid.;
       - [sTAGES] para "Premium Account" e "Free Account";  ]] 

--=[Functions]=--

-- installReset()'                    [instala o Sistema.]
-- tableResetInstall()'               [Verifica Se o Sistema ja foi instaladao.]
-- nowReseting()'                     [Verifica, retorna o erro ou reseta.]
-- getPlayerReset(cid)'               [Pega numero de resets do player.]
-- checLevelStageReset(cid)'          [Verifica o Level para Resetar.]
-- newReset(cid)'                     [Verifica todas as Condições de Reset.]
-- addValue(value)'                   [Adiciona numero de resets.]

--=[Comandos de Jogadores]=--
--  "/installreset"   -- Só será usado uma vez, para instalar o sistema.
--  "!resetar"        -- Para Resetar.

function onSay(cid, words, param)

            if words =="!resetar" then

--[ Condições de Reset ] --
local coNdConf = {

needPz = true,                  -- Precisa estar em Pz pra resetar?               [true, false]
needPa = false,                 -- Precisa ser Premium Account Pra resetar?       [true, false]
withe = false,                  -- Players com Pk Withe podem resetar?            [true, false]
red = false,                    -- Players com Pk Red pode resetar?               [true, false]
battle = false,                 -- Players precisão estar sem battle pra resetar? [true, false]
teleport = true,                -- Teleportar Player para o templo após resetar?  [true, false]
look = true,                   -- Aparecer Resets no Look do Player?             [true, false]
pid = getPlayerGUID(cid),       -- Não Mexer.


--[ Configurações do Reset ] --
resetConf = {

Level = 350,                    -- Level Necessário para Resetar.                         [Valor]
backLvl = 8,                    -- Level que voltará após o Reset.                        [Valor]
time = 5,                       -- Tempo para o Player deslogar ao resetar, em segundos.  [Valor]

  },
}
          --[[>> STAGES <<]]--
x=true;X=true -- Não Mexer.
local stage = {Abilitar = {x}, Desabilitar = {},     --<< Abilitar Stages?? >>--            [{x};{}]

--      [RESETS]    |  [PREMMY]  |   [FREE]
 stage1= {resets= 4,  premmy= 330, free= 350},
 stage2= {resets= 9,  premmy= 340, free= 355},     -- EXPLICANDO e Configurando stages. (Se estiver Abilitado [Abilitar = {x}])
 stage3= {resets= 14, premmy= 355, free= 360},     -- resets = Número de resets para o Stage;
 stage4= {resets= 19, premmy= 360, free= 365},     -- premmy = Level necessário para Premium Accounts;
 stage5= {resets= 24, premmy= 370, free= 380},     -- free    = Level necessário para Free Accounts;
 stage6= {resets= 29, premmy= 380, free= 390},       -- Coloque em Ordem...
 stage7= {resets= 35, premmy= 400, free= 410},     -- [OBS: MARQUE UM "X" PARA ABILITAR OU DESABILITAR OS STAGES]
 stage8= {resets= 40, premmy= 410, free= 440},     -- EX: para desabilitar mude: Abilitar = {}, Desabilitar = {x}
 stage9= {resets= 45, premmy= 450, free= 450},
 stage10={resets= 50, premmy= 465, free= 465},

}
        --[[>> FIM STAGES <<]]--

--=[Pega Valor de Resets]=--
function getPlayerReset(cid)
local qr = db.getResult("SELECT `reset` FROM `players` WHERE `id`= "..coNdConf.pid..";")
rss = qr:getDataInt("reset", coNdConf.pid)
if rss < 0 then
rss = 0
end
return rss
end

local success = "                   ~~ Sucesso! ~~ \nVocê tem agora "..(getPlayerReset(cid)+1).." resets. \nVocê será deslogado em "..coNdConf.resetConf.time.." segundos." ;err = doPlayerSendTextMessage
local qrt = db.getResult("SELECT `reset` FROM `players` WHERE `id`= "..coNdConf.pid..";");rss_db = qrt:getDataInt("reset", coNdConf.pid)
local lvl_query = "UPDATE `players` SET `level` = "..(coNdConf.resetConf.backLvl)..", `experience` = 0 WHERE `id`= " .. coNdConf.pid .. ";"
local reset_query = "UPDATE `players` SET `reset` = "..(getPlayerReset(cid)+(1)).." WHERE `id`= " .. coNdConf.pid .. ";"
local nolook_query = "UPDATE `players` SET `description` = '' WHERE `players`.`id`= " .. coNdConf.pid .. ";"
local look_query = "UPDATE `players` SET `description` = ' [Reset "..(getPlayerReset(cid)+(1)).."]' WHERE `players`.`id`= " .. coNdConf.pid .. ";"

--=[Reseta]=--
function addValue(value)
if coNdConf.look == false then
  doRemoveCreature(cid)
 db.executeQuery(lvl_query);db.executeQuery(reset_query);db.executeQuery(nolook_query)
else
  doRemoveCreature(cid)
   db.executeQuery(lvl_query);db.executeQuery(reset_query);db.executeQuery(look_query)
  return LUA_NO_ERROR
 end
end

function nowReseting()
if (getPlayerLevel(cid) < coNdConf.resetConf.Level) then
  doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "- Level Necessário Para o Reset ["..coNdConf.resetConf.Level.."]. Faltam "..coNdConf.resetConf.Level-getPlayerLevel(cid).." level's para você Resetar. -")
  return true
end
if getPlayerLevel(cid) >= coNdConf.resetConf.Level and (coNdConf.teleport == false) then
      doPlayerPopupFYI(cid, success)
      addEvent(addValue, coNdConf.resetConf.time*1000, value)
    else
      doPlayerPopupFYI(cid, success)
      addEvent(doTeleportThing, coNdConf.resetConf.time*900, cid, getTownTemplePosition(getPlayerTown(cid)))
      addEvent(addValue, coNdConf.resetConf.time*1000, value)
  return true
 end
end

--[sTAGES Nao mexer em nada.]--
function checkLevelStageReset(cid)

local stages = {
    {resets= stage.stage1.resets, premmy= stage.stage1.premmy, free= stage.stage1.free},
    {resets= stage.stage2.resets, premmy= stage.stage2.premmy, free= stage.stage2.free},
    {resets= stage.stage3.resets, premmy= stage.stage3.premmy, free= stage.stage3.free},
    {resets= stage.stage4.resets, premmy= stage.stage4.premmy, free= stage.stage4.free},
    {resets= stage.stage5.resets, premmy= stage.stage5.premmy, free= stage.stage5.free},
    {resets= stage.stage6.resets, premmy= stage.stage6.premmy, free= stage.stage6.free},
    {resets= stage.stage7.resets, premmy= stage.stage7.premmy, free= stage.stage7.free},
    {resets= stage.stage8.resets, premmy= stage.stage8.premmy, free= stage.stage8.free},
    {resets= stage.stage9.resets, premmy= stage.stage9.premmy, free= stage.stage9.free},
    {resets=stage.stage10.resets, premmy=stage.stage10.premmy, free=stage.stage10.free},
}
    local resets = getPlayerReset(cid)
        for i, tab in ipairs(stages) do
            if resets <= tab.resets then
                coNdConf.resetConf.Level = isPremium(cid) and tab.premmy or tab.free
                break
            end
        end
if (getPlayerLevel(cid) < coNdConf.resetConf.Level) then
err(cid, MESSAGE_STATUS_CONSOLE_BLUE, "- Level Necessário Para o Reset ["..coNdConf.resetConf.Level.."]. Faltam "..coNdConf.resetConf.Level-getPlayerLevel(cid).." level's para você Resetar. -")
return TRUE
end

  if getPlayerLevel(cid) >= coNdConf.resetConf.Level and (coNdConf.teleport == false) then
     doPlayerPopupFYI(cid, success)
     addEvent(addValue, coNdConf.resetConf.time*1000, value)
   else
   doPlayerPopupFYI(cid, success)
   addEvent(addValue, coNdConf.resetConf.time*1000, value)
   addEvent(doTeleportThing, coNdConf.resetConf.time*900, cid, getTownTemplePosition(getPlayerTown(cid)))
    return true
  end
end
    function newReset(cid)
    if(coNdConf.needPz == true) and (getTilePzInfo(getCreaturePosition(cid)) == LUA_ERROR) then
     err(cid,MESSAGE_STATUS_CONSOLE_BLUE,"- Você Precisa estar em Protection Zone Para Resetar. -") return TRUE end
    if(coNdConf.needPa == true) and not isPremium(cid) then
     err(cid,MESSAGE_STATUS_CONSOLE_BLUE,"- Você Precisa ser Premium Account para Resetar. -") return TRUE end
    if(coNdConf.withe == false) and (getCreatureSkullType(cid) == 3) then
     err(cid,MESSAGE_STATUS_CONSOLE_BLUE,"- Você não pode resetar em condições de PK Withe. -") return TRUE end
    if(coNdConf.red == false) and (getCreatureSkullType(cid) == 4) then
     err(cid,MESSAGE_STATUS_CONSOLE_BLUE,"- Você não pode resetar em condições de PK Red. -") return TRUE end
    if(coNdConf.battle == true) and (getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE) then
     err(cid,MESSAGE_STATUS_CONSOLE_BLUE,"- Você Precisa estar sem Battle para Resetar. -") return TRUE end

local xy = {true,false}
table.insert(stage.Abilitar, false)
table.insert(stage.Desabilitar, false)
if stage.Abilitar[1] == xy[1] and stage.Desabilitar[1] == xy[2] then
checkLevelStageReset(cid)
elseif stage.Abilitar[1] == xy[2] and stage.Desabilitar[1] == xy[1] then
nowReseting()
else
doPlayerPopupFYI(cid, "LUA_ERROR; Configure corretamente o Sistema de STAGES!")
end
return true
end
    function tableResetInstall()
     print(not rss_db  and LUA_ERROR or "Tabela de Resets: Instalada ... [success] ")
     addEvent(newReset, 1000, cid)
     return false
     end
    if tableResetInstall() then
  end
end
    --=[install System]=--
       function installReset()
        if db.executeQuery("ALTER TABLE `players` ADD reset INT(11) NOT NULL DEFAULT 0;") then
                print("[MarcelloMkez] -= Advanced Reset System 2.0 por DataBase =- Instalado com sucesso!")
                return TRUE
        end
        print('[Advanced Reset System/MarcelloMkez] Não foi possível instalar o Sistema.')
        return FALSE
     end
        local tt = {
           "Preparando Instalação...",
           "Instalando: TableReset Db...",
           "Instalando: getPlayerReset()...",
           "Instalando: addValue()...",
           "Instalando: checkLevelStageReset()...",
           "Instalando: newReset() and nowReseting()...",
           "Finalizando Instalação...",
           "...",
           success = {
           "Iniciando...",
           "function: TableReset Db...    [success]",
           "function: getPlayerReset()...    [success]",
           "function: addValue(value)...       [success]",
           "function: checkLevelStageReset()... [success]",
           "function: newReset() and nowReseting()...     [success]",
           "Fim da Instalação.  ",
           "by: ~~ MarcelloMkez ~~              \nContato: marcello_dirt@[member=Hotmail].com",
           inst = {"MarcelloMkez","Advanced Reset System 2.0 por DataBase"

           },

         },

        }
     if words == "/installreset" and getPlayerAccess(cid) >= 3 then
            function install()
            if installReset() then
                print(""..tt.success[7].."")
                   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,""..tt.success[8].."")
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "["..tt.success.inst[1].."] -="..tt.success.inst[2].."=- Instalado com sucesso!")
           else
                print("["..tt.success.inst[1].."]  FALHA NA INSTALAÇÃO! [O sistema ja foi instalado].")
                  doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "["..tt.success.inst[1].."] FALHA NA INSTALAÇÃO! [O sistema ja foi instalado].")
            end
            return 1
        end
          function concl(cid)
            local typetx = MESSAGE_STATUS_CONSOLE_BLUE
                print(""..tt.success[7].."")
                 print(""..tt[8].."")
                doPlayerSendTextMessage(cid, typetx,""..tt.success[7].."")
                doPlayerSendTextMessage(cid, typetx,""..tt[8].."")
                addEvent(install, 1000,cid)
            end
            function finall(cid)
                local typetx = MESSAGE_STATUS_CONSOLE_BLUE
                print(""..tt.success[6].."")
                print(""..tt[7].."")
                doPlayerSendTextMessage(cid, typetx,""..tt.success[6].."")
                doPlayerSendTextMessage(cid, typetx,""..tt[7].."")
                addEvent(concl, 3000,cid)
            end
             function installDd(cid)
               local typetx = MESSAGE_STATUS_CONSOLE_BLUE
                print(""..tt.success[5].."")
                print(""..tt[6].."")
                doPlayerSendTextMessage(cid, typetx,""..tt.success[5].."")
                doPlayerSendTextMessage(cid, typetx,""..tt[6].."")
                addEvent(finall, 1000,cid)
            end
            function installCc(cid)
               local typetx = MESSAGE_STATUS_CONSOLE_BLUE
                print(""..tt.success[4].."")
                print(""..tt[5].."")
                doPlayerSendTextMessage(cid, typetx,""..tt.success[4].."")
                doPlayerSendTextMessage(cid, typetx,""..tt[5].."")
              addEvent(installDd, 1000,cid)
            end
            function installBb(cid)
               local typetx = MESSAGE_STATUS_CONSOLE_BLUE
                print(""..tt.success[3].."")
                print(""..tt[4].."")
                doPlayerSendTextMessage(cid, typetx,""..tt.success[3].."")
              doPlayerSendTextMessage(cid, typetx,""..tt[4].."")
            addEvent(installCc, 1000,cid)
            end
            function installAa(cid)
              local typetx = MESSAGE_STATUS_CONSOLE_BLUE
                print(""..tt.success[2].."")
                print(""..tt[3].."")
                doPlayerSendTextMessage(cid, typetx,""..tt.success[2].."")
                doPlayerSendTextMessage(cid, typetx,""..tt[3].."")
                addEvent(installBb, 1000,cid)
            end
            function toInstall()
              local typetx = MESSAGE_STATUS_CONSOLE_BLUE
                print(""..tt.success[1].."")
                print(""..tt[2].."")
                doPlayerSendTextMessage(cid, typetx,""..tt.success[1].."")
                doPlayerSendTextMessage(cid, typetx,""..tt[2].."")
               addEvent(installAa, 1000,cid)
              end
            function preparation()
              local typetx = MESSAGE_STATUS_CONSOLE_BLUE
               print(""..tt[1].."")
             doPlayerSendTextMessage(cid, typetx,""..tt[1].."")
            addEvent(toInstall, 3000,cid)
        end
            if preparation() then
            end
        end
return 1
end
--=[by: MarcelloMkez]=-- 

Nesse caso queria sabe se é possível fazer para que player. Use apenas uma Spell se caso ele tenha 1 reset ou mais. Pois meus conhecimentos não são amplos para inventar algo assim :/ ( Já testei alguns outros comandos mais não deram certo.)

Link para o comentário
https://xtibia.com/forum/topic/238333-magia-por-x-resets/
Compartilhar em outros sites

14 respostass a esta questão

Posts Recomendados

  • 0


-- Areas/Combat for 0ms

function getPlayerReset(cid)

local qr = db.getResult("SELECT `reset` FROM `players` WHERE `id`= ".. getPlayerGUID(cid).. ";") <--

rss = qr:getDataInt("reset", cid)

if rss < 0 then

rss = 0

end

return rss

end

 

 

local combat0_Brush = createCombatObject()

setCombatParam(combat0_Brush, COMBAT_PARAM_EFFECT, CONST_ME_LOSEENERGY)

setCombatParam(combat0_Brush, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE)

setCombatParam(combat0_Brush, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)

setCombatArea(combat0_Brush,createCombatArea({{2}}))

function getDmg_Brush(cid, level, maglevel)

return (80)*-1,(180)*-10

end

setCombatCallback(combat0_Brush, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush")

local dfcombat0_Brush = {CONST_ANI_SMALLICE}local combat0_Brush_2 = createCombatObject()

setCombatParam(combat0_Brush_2, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)

setCombatParam(combat0_Brush_2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

setCombatArea(combat0_Brush_2,createCombatArea({{2}}))

function getDmg_Brush_2(cid, level, maglevel)

return (80)*-1,(180)*-12

end

setCombatCallback(combat0_Brush_2, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_2")local combat0_Brush_3 = createCombatObject()

setCombatParam(combat0_Brush_3, COMBAT_PARAM_EFFECT, CONST_ME_STUN)

setCombatParam(combat0_Brush_3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

setCombatArea(combat0_Brush_3,createCombatArea({{1, 0, 0, 0, 1},

{0, 1, 2, 1, 0},

{1, 0, 0, 0, 1}}))

function getDmg_Brush_3(cid, level, maglevel)

return (86)*-1,(200)*-10

end

setCombatCallback(combat0_Brush_3, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_3")local combat0_Brush_2 = createCombatObject()

setCombatParam(combat0_Brush_2, COMBAT_PARAM_EFFECT, CONST_ME_GROUNDSHAKER)

setCombatParam(combat0_Brush_2, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_WHIRLWINDCLUB)

setCombatParam(combat0_Brush_2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

setCombatArea(combat0_Brush_2,createCombatArea({{2}}))

function getDmg_Brush_2(cid, level, maglevel)

return (80)*-1,(200)*-10

end

setCombatCallback(combat0_Brush_2, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_2")

local dfcombat0_Brush_2 = {CONST_ANI_WHIRLWINDCLUB}local combat0_Brush = createCombatObject()

setCombatParam(combat0_Brush, COMBAT_PARAM_EFFECT, CONST_ME_SMALLCLOUDS)

setCombatParam(combat0_Brush, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_THROWINGKNIFE)

setCombatParam(combat0_Brush, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

setCombatArea(combat0_Brush,createCombatArea({{2}}))

function getDmg_Brush(cid, level, maglevel)

return (95)*-1,(210)*-10

end

setCombatCallback(combat0_Brush, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush")

local dfcombat0_Brush = {CONST_ANI_SMALLEARTH}local combat0_Brush_6 = createCombatObject()

setCombatParam(combat0_Brush_6, COMBAT_PARAM_EFFECT, CONST_ME_SMALLPLANTS)

setCombatParam(combat0_Brush_6, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

setCombatArea(combat0_Brush_6,createCombatArea({{0, 1, 1, 1, 0},

{1, 0, 2, 0, 1},

{0, 1, 1, 1, 0}}))

function getDmg_Brush_6(cid, level, maglevel)

return (100)*-1,(290)*-10

end

setCombatCallback(combat0_Brush_6, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_6")

 

 

-- Areas/Combat for 900ms

local combat9_Brush_6 = createCombatObject()

setCombatParam(combat9_Brush_6, COMBAT_PARAM_EFFECT, CONST_ME_SMALLPLANTS)

setCombatParam(combat9_Brush_6, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

setCombatArea(combat9_Brush_6,createCombatArea({{1, 0, 0, 0, 0, 0, 0, 0, 1},

{1, 0, 0, 0, 0, 0, 0, 0, 1},

{1, 0, 0, 0, 2, 0, 0, 0, 1},

{1, 0, 0, 0, 0, 0, 0, 0, 1},

{1, 0, 0, 0, 0, 0, 0, 0, 1}}))

function getDmg_Brush_6(cid, level, maglevel)

return (100)*-1,(290)*-11

end

setCombatCallback(combat9_Brush_6, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_6")local combat9_Brush_3 = createCombatObject()

setCombatParam(combat9_Brush_3, COMBAT_PARAM_EFFECT, CONST_ME_STUN)

setCombatParam(combat9_Brush_3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

setCombatArea(combat9_Brush_3,createCombatArea({{1, 0, 0, 0, 0, 0, 0, 0, 1},

{0, 0, 0, 0, 0, 0, 0, 0, 0},

{0, 0, 1, 0, 0, 0, 1, 0, 0},

{0, 0, 0, 1, 2, 1, 0, 0, 0},

{0, 0, 1, 0, 0, 0, 1, 0, 0},

{0, 0, 0, 0, 0, 0, 0, 0, 0},

{1, 0, 0, 0, 0, 0, 0, 0, 1}}))

function getDmg_Brush_3(cid, level, maglevel)

return (86)*-1,(200)*-10

end

setCombatCallback(combat9_Brush_3, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_3")

 

 

-- Areas/Combat for 400ms

local combat4_Brush_6 = createCombatObject()

setCombatParam(combat4_Brush_6, COMBAT_PARAM_EFFECT, CONST_ME_SMALLPLANTS)

setCombatParam(combat4_Brush_6, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

setCombatArea(combat4_Brush_6,createCombatArea({{0, 1, 1, 1, 1, 1, 0},

{1, 0, 0, 0, 0, 0, 1},

{1, 0, 0, 2, 0, 0, 1},

{1, 0, 0, 0, 0, 0, 1},

{0, 1, 1, 1, 1, 1, 0}}))

function getDmg_Brush_6(cid, level, maglevel)

return (100)*-1,(290)*-10

end

setCombatCallback(combat4_Brush_6, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_6")local combat4_Brush_3 = createCombatObject()

setCombatParam(combat4_Brush_3, COMBAT_PARAM_EFFECT, CONST_ME_STUN)

setCombatParam(combat4_Brush_3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

setCombatArea(combat4_Brush_3,createCombatArea({{1, 0, 0, 0, 0, 0, 1},

{0, 0, 0, 0, 0, 0, 0},

{0, 0, 0, 2, 0, 0, 0},

{0, 0, 0, 0, 0, 0, 0},

{1, 0, 0, 0, 0, 0, 1}}))

function getDmg_Brush_3(cid, level, maglevel)

return (86)*-1,(200)*-7

end

setCombatCallback(combat4_Brush_3, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_3")

 

 

-- =============== CORE FUNCTIONS ===============

local function RunPart(c,cid,var,dirList,dirEmitPos) -- Part

if (isCreature(cid)) then

doCombat(cid, c, var)

if (dirList ~= nil) then -- Emit distance effects

local i = 2;

while (i < #dirList) do

doSendDistanceShoot(dirEmitPos,{x=dirEmitPos.x-dirList,y=dirEmitPos.y-dirList[i+1],z=dirEmitPos.z},dirList[1])

i = i + 2

end

end

end

end

 

 

function onCastSpell(cid, var)

if getPlayerReset(cid) < 1 then

doPlayerSendCancel(cid, "You can't cast this spell.")

return true

end

local startPos = getCreaturePosition(cid)

RunPart(combat0_Brush,cid,var,dfcombat0_Brush,startPos)

RunPart(combat0_Brush_2,cid,var)

RunPart(combat0_Brush_3,cid,var)

RunPart(combat0_Brush_2,cid,var,dfcombat0_Brush_2,startPos)

RunPart(combat0_Brush,cid,var,dfcombat0_Brush,startPos)

RunPart(combat0_Brush_6,cid,var)

addEvent(RunPart,900,combat9_Brush_6,cid,var)

addEvent(RunPart,900,combat9_Brush_3,cid,var)

addEvent(RunPart,400,combat4_Brush_6,cid,var)

addEvent(RunPart,400,combat4_Brush_3,cid,var)

return true

end

 

Editado por Kemix
Link para o comentário
https://xtibia.com/forum/topic/238333-magia-por-x-resets/#findComment-1678363
Compartilhar em outros sites

  • 0
No código da spell, abaixo de:
function onCastSpell(cid, var)
coloque:
if getPlayerReset(cid) < 1 then
    doPlayerSendCancel(cid, "You can't cast this spell.")
    return true
end

 

Editado por zipter98
Link para o comentário
https://xtibia.com/forum/topic/238333-magia-por-x-resets/#findComment-1678290
Compartilhar em outros sites

  • 0

 

No código da spell, abaixo de:
function onCastSpell(cid, var)
coloque:
if getPlayerReset(cid) < 1 then
    doPlayerSendCancel(cid, "You can't cast this spell.")
    return true
end

 

 

Aparece o seguinte erro

post-334468-0-37913600-1450224591_thumb.png

 

 

Magia que queria usar era essa, acho que coloquei certinho no script!

 

-- Areas/Combat for 0ms
local combat0_Brush = createCombatObject()
setCombatParam(combat0_Brush, COMBAT_PARAM_EFFECT, CONST_ME_LOSEENERGY)
setCombatParam(combat0_Brush, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE)
setCombatParam(combat0_Brush, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatArea(combat0_Brush,createCombatArea({{2}}))
function getDmg_Brush(cid, level, maglevel)
	return (80)*-1,(180)*-10 
end
setCombatCallback(combat0_Brush, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush")
local dfcombat0_Brush = {CONST_ANI_SMALLICE}local combat0_Brush_2 = createCombatObject()
setCombatParam(combat0_Brush_2, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
setCombatParam(combat0_Brush_2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat0_Brush_2,createCombatArea({{2}}))
function getDmg_Brush_2(cid, level, maglevel)
	return (80)*-1,(180)*-12 
end
setCombatCallback(combat0_Brush_2, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_2")local combat0_Brush_3 = createCombatObject()
setCombatParam(combat0_Brush_3, COMBAT_PARAM_EFFECT, CONST_ME_STUN)
setCombatParam(combat0_Brush_3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat0_Brush_3,createCombatArea({{1, 0, 0, 0, 1},
{0, 1, 2, 1, 0},
{1, 0, 0, 0, 1}}))
function getDmg_Brush_3(cid, level, maglevel)
	return (86)*-1,(200)*-10 
end
setCombatCallback(combat0_Brush_3, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_3")local combat0_Brush_2 = createCombatObject()
setCombatParam(combat0_Brush_2, COMBAT_PARAM_EFFECT, CONST_ME_GROUNDSHAKER)
setCombatParam(combat0_Brush_2, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_WHIRLWINDCLUB)
setCombatParam(combat0_Brush_2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat0_Brush_2,createCombatArea({{2}}))
function getDmg_Brush_2(cid, level, maglevel)
	return (80)*-1,(200)*-10 
end
setCombatCallback(combat0_Brush_2, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_2")
local dfcombat0_Brush_2 = {CONST_ANI_WHIRLWINDCLUB}local combat0_Brush = createCombatObject()
setCombatParam(combat0_Brush, COMBAT_PARAM_EFFECT, CONST_ME_SMALLCLOUDS)
setCombatParam(combat0_Brush, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_THROWINGKNIFE)
setCombatParam(combat0_Brush, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat0_Brush,createCombatArea({{2}}))
function getDmg_Brush(cid, level, maglevel)
	return (95)*-1,(210)*-10 
end
setCombatCallback(combat0_Brush, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush")
local dfcombat0_Brush = {CONST_ANI_SMALLEARTH}local combat0_Brush_6 = createCombatObject()
setCombatParam(combat0_Brush_6, COMBAT_PARAM_EFFECT, CONST_ME_SMALLPLANTS)
setCombatParam(combat0_Brush_6, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat0_Brush_6,createCombatArea({{0, 1, 1, 1, 0},
{1, 0, 2, 0, 1},
{0, 1, 1, 1, 0}}))
function getDmg_Brush_6(cid, level, maglevel)
	return (100)*-1,(290)*-10 
end
setCombatCallback(combat0_Brush_6, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_6")

-- Areas/Combat for 900ms
local combat9_Brush_6 = createCombatObject()
setCombatParam(combat9_Brush_6, COMBAT_PARAM_EFFECT, CONST_ME_SMALLPLANTS)
setCombatParam(combat9_Brush_6, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat9_Brush_6,createCombatArea({{1, 0, 0, 0, 0, 0, 0, 0, 1},
{1, 0, 0, 0, 0, 0, 0, 0, 1},
{1, 0, 0, 0, 2, 0, 0, 0, 1},
{1, 0, 0, 0, 0, 0, 0, 0, 1},
{1, 0, 0, 0, 0, 0, 0, 0, 1}}))
function getDmg_Brush_6(cid, level, maglevel)
	return (100)*-1,(290)*-11 
end
setCombatCallback(combat9_Brush_6, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_6")local combat9_Brush_3 = createCombatObject()
setCombatParam(combat9_Brush_3, COMBAT_PARAM_EFFECT, CONST_ME_STUN)
setCombatParam(combat9_Brush_3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat9_Brush_3,createCombatArea({{1, 0, 0, 0, 0, 0, 0, 0, 1},
{0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 1, 0, 0, 0, 1, 0, 0},
{0, 0, 0, 1, 2, 1, 0, 0, 0},
{0, 0, 1, 0, 0, 0, 1, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0},
{1, 0, 0, 0, 0, 0, 0, 0, 1}}))
function getDmg_Brush_3(cid, level, maglevel)
	return (86)*-1,(200)*-10
end
setCombatCallback(combat9_Brush_3, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_3")

-- Areas/Combat for 400ms
local combat4_Brush_6 = createCombatObject()
setCombatParam(combat4_Brush_6, COMBAT_PARAM_EFFECT, CONST_ME_SMALLPLANTS)
setCombatParam(combat4_Brush_6, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat4_Brush_6,createCombatArea({{0, 1, 1, 1, 1, 1, 0},
{1, 0, 0, 0, 0, 0, 1},
{1, 0, 0, 2, 0, 0, 1},
{1, 0, 0, 0, 0, 0, 1},
{0, 1, 1, 1, 1, 1, 0}}))
function getDmg_Brush_6(cid, level, maglevel)
	return (100)*-1,(290)*-10 
end
setCombatCallback(combat4_Brush_6, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_6")local combat4_Brush_3 = createCombatObject()
setCombatParam(combat4_Brush_3, COMBAT_PARAM_EFFECT, CONST_ME_STUN)
setCombatParam(combat4_Brush_3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat4_Brush_3,createCombatArea({{1, 0, 0, 0, 0, 0, 1},
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 2, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
{1, 0, 0, 0, 0, 0, 1}}))
function getDmg_Brush_3(cid, level, maglevel)
	return (86)*-1,(200)*-7 
end
setCombatCallback(combat4_Brush_3, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_3")

-- =============== CORE FUNCTIONS ===============
local function RunPart(c,cid,var,dirList,dirEmitPos) -- Part
	if (isCreature(cid)) then
		doCombat(cid, c, var)
		if (dirList ~= nil) then -- Emit distance effects
			local i = 2;
			while (i < #dirList) do
				doSendDistanceShoot(dirEmitPos,{x=dirEmitPos.x-dirList[i],y=dirEmitPos.y-dirList[i+1],z=dirEmitPos.z},dirList[1])
				i = i + 2
			end		
		end
	end
end

function onCastSpell(cid, var)
	if getPlayerReset(cid) < 1 then
    doPlayerSendCancel(cid, "You can't cast this spell.")
    return true
end
	local startPos = getCreaturePosition(cid)
	RunPart(combat0_Brush,cid,var,dfcombat0_Brush,startPos)
	RunPart(combat0_Brush_2,cid,var)
	RunPart(combat0_Brush_3,cid,var)
	RunPart(combat0_Brush_2,cid,var,dfcombat0_Brush_2,startPos)
	RunPart(combat0_Brush,cid,var,dfcombat0_Brush,startPos)
	RunPart(combat0_Brush_6,cid,var)
	addEvent(RunPart,900,combat9_Brush_6,cid,var)
	addEvent(RunPart,900,combat9_Brush_3,cid,var)
	addEvent(RunPart,400,combat4_Brush_6,cid,var)
	addEvent(RunPart,400,combat4_Brush_3,cid,var)
	return true
end
Editado por Nosifero
Link para o comentário
https://xtibia.com/forum/topic/238333-magia-por-x-resets/#findComment-1678326
Compartilhar em outros sites

  • 0

Você precisa declarar a função:

function getPlayerReset(cid)
local qr = db.getResult("SELECT `reset` FROM `players` WHERE `id`= "..coNdConf.pid..";")
rss = qr:getDataInt("reset", coNdConf.pid)
if rss < 0 then
rss = 0
end
return rss
end

no arquivo que deseja chamar a função getPlayerReset(cid). Aconselho a colocar no global.lua, assim não é necessário por em todos os arquivos desejados.

Link para o comentário
https://xtibia.com/forum/topic/238333-magia-por-x-resets/#findComment-1678330
Compartilhar em outros sites

  • 0

Você precisa declarar a função:

function getPlayerReset(cid)
local qr = db.getResult("SELECT `reset` FROM `players` WHERE `id`= "..coNdConf.pid..";")
rss = qr:getDataInt("reset", coNdConf.pid)
if rss < 0 then
rss = 0
end
return rss
end

no arquivo que deseja chamar a função getPlayerReset(cid). Aconselho a colocar no global.lua, assim não é necessário por em todos os arquivos desejados.

Não entendi muito, meu servidor não tem nenhum script chamado Global.lua :omg:

Link para o comentário
https://xtibia.com/forum/topic/238333-magia-por-x-resets/#findComment-1678348
Compartilhar em outros sites

  • 0


-- Areas/Combat for 0ms

function getPlayerReset(cid)

local qr = db.getResult("SELECT `reset` FROM `players` WHERE `id`= cid;")

rss = qr:getDataInt("reset", cid)

if rss < 0 then

rss = 0

end

return rss

end

 

local combat0_Brush = createCombatObject()

setCombatParam(combat0_Brush, COMBAT_PARAM_EFFECT, CONST_ME_LOSEENERGY)

setCombatParam(combat0_Brush, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE)

setCombatParam(combat0_Brush, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)

setCombatArea(combat0_Brush,createCombatArea({{2}}))

function getDmg_Brush(cid, level, maglevel)

return (80)*-1,(180)*-10

end

setCombatCallback(combat0_Brush, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush")

local dfcombat0_Brush = {CONST_ANI_SMALLICE}local combat0_Brush_2 = createCombatObject()

setCombatParam(combat0_Brush_2, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)

setCombatParam(combat0_Brush_2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

setCombatArea(combat0_Brush_2,createCombatArea({{2}}))

function getDmg_Brush_2(cid, level, maglevel)

return (80)*-1,(180)*-12

end

setCombatCallback(combat0_Brush_2, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_2")local combat0_Brush_3 = createCombatObject()

setCombatParam(combat0_Brush_3, COMBAT_PARAM_EFFECT, CONST_ME_STUN)

setCombatParam(combat0_Brush_3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

setCombatArea(combat0_Brush_3,createCombatArea({{1, 0, 0, 0, 1},

{0, 1, 2, 1, 0},

{1, 0, 0, 0, 1}}))

function getDmg_Brush_3(cid, level, maglevel)

return (86)*-1,(200)*-10

end

setCombatCallback(combat0_Brush_3, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_3")local combat0_Brush_2 = createCombatObject()

setCombatParam(combat0_Brush_2, COMBAT_PARAM_EFFECT, CONST_ME_GROUNDSHAKER)

setCombatParam(combat0_Brush_2, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_WHIRLWINDCLUB)

setCombatParam(combat0_Brush_2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

setCombatArea(combat0_Brush_2,createCombatArea({{2}}))

function getDmg_Brush_2(cid, level, maglevel)

return (80)*-1,(200)*-10

end

setCombatCallback(combat0_Brush_2, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_2")

local dfcombat0_Brush_2 = {CONST_ANI_WHIRLWINDCLUB}local combat0_Brush = createCombatObject()

setCombatParam(combat0_Brush, COMBAT_PARAM_EFFECT, CONST_ME_SMALLCLOUDS)

setCombatParam(combat0_Brush, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_THROWINGKNIFE)

setCombatParam(combat0_Brush, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

setCombatArea(combat0_Brush,createCombatArea({{2}}))

function getDmg_Brush(cid, level, maglevel)

return (95)*-1,(210)*-10

end

setCombatCallback(combat0_Brush, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush")

local dfcombat0_Brush = {CONST_ANI_SMALLEARTH}local combat0_Brush_6 = createCombatObject()

setCombatParam(combat0_Brush_6, COMBAT_PARAM_EFFECT, CONST_ME_SMALLPLANTS)

setCombatParam(combat0_Brush_6, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

setCombatArea(combat0_Brush_6,createCombatArea({{0, 1, 1, 1, 0},

{1, 0, 2, 0, 1},

{0, 1, 1, 1, 0}}))

function getDmg_Brush_6(cid, level, maglevel)

return (100)*-1,(290)*-10

end

setCombatCallback(combat0_Brush_6, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_6")

 

-- Areas/Combat for 900ms

local combat9_Brush_6 = createCombatObject()

setCombatParam(combat9_Brush_6, COMBAT_PARAM_EFFECT, CONST_ME_SMALLPLANTS)

setCombatParam(combat9_Brush_6, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

setCombatArea(combat9_Brush_6,createCombatArea({{1, 0, 0, 0, 0, 0, 0, 0, 1},

{1, 0, 0, 0, 0, 0, 0, 0, 1},

{1, 0, 0, 0, 2, 0, 0, 0, 1},

{1, 0, 0, 0, 0, 0, 0, 0, 1},

{1, 0, 0, 0, 0, 0, 0, 0, 1}}))

function getDmg_Brush_6(cid, level, maglevel)

return (100)*-1,(290)*-11

end

setCombatCallback(combat9_Brush_6, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_6")local combat9_Brush_3 = createCombatObject()

setCombatParam(combat9_Brush_3, COMBAT_PARAM_EFFECT, CONST_ME_STUN)

setCombatParam(combat9_Brush_3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

setCombatArea(combat9_Brush_3,createCombatArea({{1, 0, 0, 0, 0, 0, 0, 0, 1},

{0, 0, 0, 0, 0, 0, 0, 0, 0},

{0, 0, 1, 0, 0, 0, 1, 0, 0},

{0, 0, 0, 1, 2, 1, 0, 0, 0},

{0, 0, 1, 0, 0, 0, 1, 0, 0},

{0, 0, 0, 0, 0, 0, 0, 0, 0},

{1, 0, 0, 0, 0, 0, 0, 0, 1}}))

function getDmg_Brush_3(cid, level, maglevel)

return (86)*-1,(200)*-10

end

setCombatCallback(combat9_Brush_3, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_3")

 

-- Areas/Combat for 400ms

local combat4_Brush_6 = createCombatObject()

setCombatParam(combat4_Brush_6, COMBAT_PARAM_EFFECT, CONST_ME_SMALLPLANTS)

setCombatParam(combat4_Brush_6, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

setCombatArea(combat4_Brush_6,createCombatArea({{0, 1, 1, 1, 1, 1, 0},

{1, 0, 0, 0, 0, 0, 1},

{1, 0, 0, 2, 0, 0, 1},

{1, 0, 0, 0, 0, 0, 1},

{0, 1, 1, 1, 1, 1, 0}}))

function getDmg_Brush_6(cid, level, maglevel)

return (100)*-1,(290)*-10

end

setCombatCallback(combat4_Brush_6, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_6")local combat4_Brush_3 = createCombatObject()

setCombatParam(combat4_Brush_3, COMBAT_PARAM_EFFECT, CONST_ME_STUN)

setCombatParam(combat4_Brush_3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

setCombatArea(combat4_Brush_3,createCombatArea({{1, 0, 0, 0, 0, 0, 1},

{0, 0, 0, 0, 0, 0, 0},

{0, 0, 0, 2, 0, 0, 0},

{0, 0, 0, 0, 0, 0, 0},

{1, 0, 0, 0, 0, 0, 1}}))

function getDmg_Brush_3(cid, level, maglevel)

return (86)*-1,(200)*-7

end

setCombatCallback(combat4_Brush_3, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_3")

 

-- =============== CORE FUNCTIONS ===============

local function RunPart(c,cid,var,dirList,dirEmitPos) -- Part

if (isCreature(cid)) then

doCombat(cid, c, var)

if (dirList ~= nil) then -- Emit distance effects

local i = 2;

while (i < #dirList) do

doSendDistanceShoot(dirEmitPos,{x=dirEmitPos.x-dirList,y=dirEmitPos.y-dirList[i+1],z=dirEmitPos.z},dirList[1])

i = i + 2

end

end

end

end

 

function onCastSpell(cid, var)

if getPlayerReset(cid) < 1 then

doPlayerSendCancel(cid, "You can't cast this spell.")

return true

end

local startPos = getCreaturePosition(cid)

RunPart(combat0_Brush,cid,var,dfcombat0_Brush,startPos)

RunPart(combat0_Brush_2,cid,var)

RunPart(combat0_Brush_3,cid,var)

RunPart(combat0_Brush_2,cid,var,dfcombat0_Brush_2,startPos)

RunPart(combat0_Brush,cid,var,dfcombat0_Brush,startPos)

RunPart(combat0_Brush_6,cid,var)

addEvent(RunPart,900,combat9_Brush_6,cid,var)

addEvent(RunPart,900,combat9_Brush_3,cid,var)

addEvent(RunPart,400,combat4_Brush_6,cid,var)

addEvent(RunPart,400,combat4_Brush_3,cid,var)

return true

end

 

Link para o comentário
https://xtibia.com/forum/topic/238333-magia-por-x-resets/#findComment-1678356
Compartilhar em outros sites

  • 0

@@Nosifero, em que diretório está seu arquivo do reset?

ele fica em talkactions

-- Areas/Combat for 0ms
function getPlayerReset(cid)
local qr = db.getResult("SELECT `reset` FROM `players` WHERE `id`= cid;")
rss = qr:getDataInt("reset", cid)
if rss < 0 then
rss = 0
end
return rss
end

local combat0_Brush = createCombatObject()
setCombatParam(combat0_Brush, COMBAT_PARAM_EFFECT, CONST_ME_LOSEENERGY)
setCombatParam(combat0_Brush, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE)
setCombatParam(combat0_Brush, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatArea(combat0_Brush,createCombatArea({{2}}))
function getDmg_Brush(cid, level, maglevel)
	return (80)*-1,(180)*-10 
end
setCombatCallback(combat0_Brush, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush")
local dfcombat0_Brush = {CONST_ANI_SMALLICE}local combat0_Brush_2 = createCombatObject()
setCombatParam(combat0_Brush_2, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
setCombatParam(combat0_Brush_2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat0_Brush_2,createCombatArea({{2}}))
function getDmg_Brush_2(cid, level, maglevel)
	return (80)*-1,(180)*-12 
end
setCombatCallback(combat0_Brush_2, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_2")local combat0_Brush_3 = createCombatObject()
setCombatParam(combat0_Brush_3, COMBAT_PARAM_EFFECT, CONST_ME_STUN)
setCombatParam(combat0_Brush_3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat0_Brush_3,createCombatArea({{1, 0, 0, 0, 1},
{0, 1, 2, 1, 0},
{1, 0, 0, 0, 1}}))
function getDmg_Brush_3(cid, level, maglevel)
	return (86)*-1,(200)*-10 
end
setCombatCallback(combat0_Brush_3, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_3")local combat0_Brush_2 = createCombatObject()
setCombatParam(combat0_Brush_2, COMBAT_PARAM_EFFECT, CONST_ME_GROUNDSHAKER)
setCombatParam(combat0_Brush_2, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_WHIRLWINDCLUB)
setCombatParam(combat0_Brush_2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat0_Brush_2,createCombatArea({{2}}))
function getDmg_Brush_2(cid, level, maglevel)
	return (80)*-1,(200)*-10 
end
setCombatCallback(combat0_Brush_2, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_2")
local dfcombat0_Brush_2 = {CONST_ANI_WHIRLWINDCLUB}local combat0_Brush = createCombatObject()
setCombatParam(combat0_Brush, COMBAT_PARAM_EFFECT, CONST_ME_SMALLCLOUDS)
setCombatParam(combat0_Brush, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_THROWINGKNIFE)
setCombatParam(combat0_Brush, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat0_Brush,createCombatArea({{2}}))
function getDmg_Brush(cid, level, maglevel)
	return (95)*-1,(210)*-10 
end
setCombatCallback(combat0_Brush, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush")
local dfcombat0_Brush = {CONST_ANI_SMALLEARTH}local combat0_Brush_6 = createCombatObject()
setCombatParam(combat0_Brush_6, COMBAT_PARAM_EFFECT, CONST_ME_SMALLPLANTS)
setCombatParam(combat0_Brush_6, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat0_Brush_6,createCombatArea({{0, 1, 1, 1, 0},
{1, 0, 2, 0, 1},
{0, 1, 1, 1, 0}}))
function getDmg_Brush_6(cid, level, maglevel)
	return (100)*-1,(290)*-10 
end
setCombatCallback(combat0_Brush_6, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_6")

-- Areas/Combat for 900ms
local combat9_Brush_6 = createCombatObject()
setCombatParam(combat9_Brush_6, COMBAT_PARAM_EFFECT, CONST_ME_SMALLPLANTS)
setCombatParam(combat9_Brush_6, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat9_Brush_6,createCombatArea({{1, 0, 0, 0, 0, 0, 0, 0, 1},
{1, 0, 0, 0, 0, 0, 0, 0, 1},
{1, 0, 0, 0, 2, 0, 0, 0, 1},
{1, 0, 0, 0, 0, 0, 0, 0, 1},
{1, 0, 0, 0, 0, 0, 0, 0, 1}}))
function getDmg_Brush_6(cid, level, maglevel)
	return (100)*-1,(290)*-11 
end
setCombatCallback(combat9_Brush_6, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_6")local combat9_Brush_3 = createCombatObject()
setCombatParam(combat9_Brush_3, COMBAT_PARAM_EFFECT, CONST_ME_STUN)
setCombatParam(combat9_Brush_3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat9_Brush_3,createCombatArea({{1, 0, 0, 0, 0, 0, 0, 0, 1},
{0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 1, 0, 0, 0, 1, 0, 0},
{0, 0, 0, 1, 2, 1, 0, 0, 0},
{0, 0, 1, 0, 0, 0, 1, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0},
{1, 0, 0, 0, 0, 0, 0, 0, 1}}))
function getDmg_Brush_3(cid, level, maglevel)
	return (86)*-1,(200)*-10
end
setCombatCallback(combat9_Brush_3, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_3")

-- Areas/Combat for 400ms
local combat4_Brush_6 = createCombatObject()
setCombatParam(combat4_Brush_6, COMBAT_PARAM_EFFECT, CONST_ME_SMALLPLANTS)
setCombatParam(combat4_Brush_6, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat4_Brush_6,createCombatArea({{0, 1, 1, 1, 1, 1, 0},
{1, 0, 0, 0, 0, 0, 1},
{1, 0, 0, 2, 0, 0, 1},
{1, 0, 0, 0, 0, 0, 1},
{0, 1, 1, 1, 1, 1, 0}}))
function getDmg_Brush_6(cid, level, maglevel)
	return (100)*-1,(290)*-10 
end
setCombatCallback(combat4_Brush_6, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_6")local combat4_Brush_3 = createCombatObject()
setCombatParam(combat4_Brush_3, COMBAT_PARAM_EFFECT, CONST_ME_STUN)
setCombatParam(combat4_Brush_3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat4_Brush_3,createCombatArea({{1, 0, 0, 0, 0, 0, 1},
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 2, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
{1, 0, 0, 0, 0, 0, 1}}))
function getDmg_Brush_3(cid, level, maglevel)
	return (86)*-1,(200)*-7 
end
setCombatCallback(combat4_Brush_3, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_3")

-- =============== CORE FUNCTIONS ===============
local function RunPart(c,cid,var,dirList,dirEmitPos) -- Part
	if (isCreature(cid)) then
		doCombat(cid, c, var)
		if (dirList ~= nil) then -- Emit distance effects
			local i = 2;
			while (i < #dirList) do
				doSendDistanceShoot(dirEmitPos,{x=dirEmitPos.x-dirList[i],y=dirEmitPos.y-dirList[i+1],z=dirEmitPos.z},dirList[1])
				i = i + 2
			end		
		end
	end
end

function onCastSpell(cid, var)
if getPlayerReset(cid) < 1 then
    doPlayerSendCancel(cid, "You can't cast this spell.")
    return true
end
	local startPos = getCreaturePosition(cid)
	RunPart(combat0_Brush,cid,var,dfcombat0_Brush,startPos)
	RunPart(combat0_Brush_2,cid,var)
	RunPart(combat0_Brush_3,cid,var)
	RunPart(combat0_Brush_2,cid,var,dfcombat0_Brush_2,startPos)
	RunPart(combat0_Brush,cid,var,dfcombat0_Brush,startPos)
	RunPart(combat0_Brush_6,cid,var)
	addEvent(RunPart,900,combat9_Brush_6,cid,var)
	addEvent(RunPart,900,combat9_Brush_3,cid,var)
	addEvent(RunPart,400,combat4_Brush_6,cid,var)
	addEvent(RunPart,400,combat4_Brush_3,cid,var)
	return true
end

o que senhor mudo?

 

post-334468-0-32483000-1450278541_thumb.png

Editado por Nosifero
Link para o comentário
https://xtibia.com/forum/topic/238333-magia-por-x-resets/#findComment-1678359
Compartilhar em outros sites

  • 0


-- Areas/Combat for 0ms

function getPlayerReset(cid)

local qr = db.getResult("SELECT `reset` FROM `players` WHERE `id`= `cid`;") -- mudei isso

rss = qr:getDataInt("reset", cid)

if rss < 0 then

rss = 0

end

return rss

end

 

 

local combat0_Brush = createCombatObject()

setCombatParam(combat0_Brush, COMBAT_PARAM_EFFECT, CONST_ME_LOSEENERGY)

setCombatParam(combat0_Brush, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE)

setCombatParam(combat0_Brush, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)

setCombatArea(combat0_Brush,createCombatArea({{2}}))

function getDmg_Brush(cid, level, maglevel)

return (80)*-1,(180)*-10

end

setCombatCallback(combat0_Brush, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush")

local dfcombat0_Brush = {CONST_ANI_SMALLICE}local combat0_Brush_2 = createCombatObject()

setCombatParam(combat0_Brush_2, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)

setCombatParam(combat0_Brush_2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

setCombatArea(combat0_Brush_2,createCombatArea({{2}}))

function getDmg_Brush_2(cid, level, maglevel)

return (80)*-1,(180)*-12

end

setCombatCallback(combat0_Brush_2, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_2")local combat0_Brush_3 = createCombatObject()

setCombatParam(combat0_Brush_3, COMBAT_PARAM_EFFECT, CONST_ME_STUN)

setCombatParam(combat0_Brush_3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

setCombatArea(combat0_Brush_3,createCombatArea({{1, 0, 0, 0, 1},

{0, 1, 2, 1, 0},

{1, 0, 0, 0, 1}}))

function getDmg_Brush_3(cid, level, maglevel)

return (86)*-1,(200)*-10

end

setCombatCallback(combat0_Brush_3, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_3")local combat0_Brush_2 = createCombatObject()

setCombatParam(combat0_Brush_2, COMBAT_PARAM_EFFECT, CONST_ME_GROUNDSHAKER)

setCombatParam(combat0_Brush_2, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_WHIRLWINDCLUB)

setCombatParam(combat0_Brush_2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

setCombatArea(combat0_Brush_2,createCombatArea({{2}}))

function getDmg_Brush_2(cid, level, maglevel)

return (80)*-1,(200)*-10

end

setCombatCallback(combat0_Brush_2, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_2")

local dfcombat0_Brush_2 = {CONST_ANI_WHIRLWINDCLUB}local combat0_Brush = createCombatObject()

setCombatParam(combat0_Brush, COMBAT_PARAM_EFFECT, CONST_ME_SMALLCLOUDS)

setCombatParam(combat0_Brush, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_THROWINGKNIFE)

setCombatParam(combat0_Brush, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

setCombatArea(combat0_Brush,createCombatArea({{2}}))

function getDmg_Brush(cid, level, maglevel)

return (95)*-1,(210)*-10

end

setCombatCallback(combat0_Brush, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush")

local dfcombat0_Brush = {CONST_ANI_SMALLEARTH}local combat0_Brush_6 = createCombatObject()

setCombatParam(combat0_Brush_6, COMBAT_PARAM_EFFECT, CONST_ME_SMALLPLANTS)

setCombatParam(combat0_Brush_6, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

setCombatArea(combat0_Brush_6,createCombatArea({{0, 1, 1, 1, 0},

{1, 0, 2, 0, 1},

{0, 1, 1, 1, 0}}))

function getDmg_Brush_6(cid, level, maglevel)

return (100)*-1,(290)*-10

end

setCombatCallback(combat0_Brush_6, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_6")

 

 

-- Areas/Combat for 900ms

local combat9_Brush_6 = createCombatObject()

setCombatParam(combat9_Brush_6, COMBAT_PARAM_EFFECT, CONST_ME_SMALLPLANTS)

setCombatParam(combat9_Brush_6, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

setCombatArea(combat9_Brush_6,createCombatArea({{1, 0, 0, 0, 0, 0, 0, 0, 1},

{1, 0, 0, 0, 0, 0, 0, 0, 1},

{1, 0, 0, 0, 2, 0, 0, 0, 1},

{1, 0, 0, 0, 0, 0, 0, 0, 1},

{1, 0, 0, 0, 0, 0, 0, 0, 1}}))

function getDmg_Brush_6(cid, level, maglevel)

return (100)*-1,(290)*-11

end

setCombatCallback(combat9_Brush_6, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_6")local combat9_Brush_3 = createCombatObject()

setCombatParam(combat9_Brush_3, COMBAT_PARAM_EFFECT, CONST_ME_STUN)

setCombatParam(combat9_Brush_3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

setCombatArea(combat9_Brush_3,createCombatArea({{1, 0, 0, 0, 0, 0, 0, 0, 1},

{0, 0, 0, 0, 0, 0, 0, 0, 0},

{0, 0, 1, 0, 0, 0, 1, 0, 0},

{0, 0, 0, 1, 2, 1, 0, 0, 0},

{0, 0, 1, 0, 0, 0, 1, 0, 0},

{0, 0, 0, 0, 0, 0, 0, 0, 0},

{1, 0, 0, 0, 0, 0, 0, 0, 1}}))

function getDmg_Brush_3(cid, level, maglevel)

return (86)*-1,(200)*-10

end

setCombatCallback(combat9_Brush_3, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_3")

 

 

-- Areas/Combat for 400ms

local combat4_Brush_6 = createCombatObject()

setCombatParam(combat4_Brush_6, COMBAT_PARAM_EFFECT, CONST_ME_SMALLPLANTS)

setCombatParam(combat4_Brush_6, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

setCombatArea(combat4_Brush_6,createCombatArea({{0, 1, 1, 1, 1, 1, 0},

{1, 0, 0, 0, 0, 0, 1},

{1, 0, 0, 2, 0, 0, 1},

{1, 0, 0, 0, 0, 0, 1},

{0, 1, 1, 1, 1, 1, 0}}))

function getDmg_Brush_6(cid, level, maglevel)

return (100)*-1,(290)*-10

end

setCombatCallback(combat4_Brush_6, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_6")local combat4_Brush_3 = createCombatObject()

setCombatParam(combat4_Brush_3, COMBAT_PARAM_EFFECT, CONST_ME_STUN)

setCombatParam(combat4_Brush_3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

setCombatArea(combat4_Brush_3,createCombatArea({{1, 0, 0, 0, 0, 0, 1},

{0, 0, 0, 0, 0, 0, 0},

{0, 0, 0, 2, 0, 0, 0},

{0, 0, 0, 0, 0, 0, 0},

{1, 0, 0, 0, 0, 0, 1}}))

function getDmg_Brush_3(cid, level, maglevel)

return (86)*-1,(200)*-7

end

setCombatCallback(combat4_Brush_3, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_3")

 

 

-- =============== CORE FUNCTIONS ===============

local function RunPart(c,cid,var,dirList,dirEmitPos) -- Part

if (isCreature(cid)) then

doCombat(cid, c, var)

if (dirList ~= nil) then -- Emit distance effects

local i = 2;

while (i < #dirList) do

doSendDistanceShoot(dirEmitPos,{x=dirEmitPos.x-dirList,y=dirEmitPos.y-dirList[i+1],z=dirEmitPos.z},dirList[1])

i = i + 2

end

end

end

end

 

 

function onCastSpell(cid, var)

if getPlayerReset(cid) < 1 then

doPlayerSendCancel(cid, "You can't cast this spell.")

return true

end

local startPos = getCreaturePosition(cid)

RunPart(combat0_Brush,cid,var,dfcombat0_Brush,startPos)

RunPart(combat0_Brush_2,cid,var)

RunPart(combat0_Brush_3,cid,var)

RunPart(combat0_Brush_2,cid,var,dfcombat0_Brush_2,startPos)

RunPart(combat0_Brush,cid,var,dfcombat0_Brush,startPos)

RunPart(combat0_Brush_6,cid,var)

addEvent(RunPart,900,combat9_Brush_6,cid,var)

addEvent(RunPart,900,combat9_Brush_3,cid,var)

addEvent(RunPart,400,combat4_Brush_6,cid,var)

addEvent(RunPart,400,combat4_Brush_3,cid,var)

return true

end

Editado por Kemix
Link para o comentário
https://xtibia.com/forum/topic/238333-magia-por-x-resets/#findComment-1678361
Compartilhar em outros sites

  • 0
-- Areas/Combat for 0ms
function getPlayerReset(cid)
local qr = db.getResult("SELECT `reset` FROM `players` WHERE `id`= ".. getPlayerGUID(cid).. ";") <--
rss = qr:getDataInt("reset", cid)
if rss < 0 then
rss = 0
end
return rss
end


local combat0_Brush = createCombatObject()
setCombatParam(combat0_Brush, COMBAT_PARAM_EFFECT, CONST_ME_LOSEENERGY)
setCombatParam(combat0_Brush, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE)
setCombatParam(combat0_Brush, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatArea(combat0_Brush,createCombatArea({{2}}))
function getDmg_Brush(cid, level, maglevel)
return (80)*-1,(180)*-10 
end
setCombatCallback(combat0_Brush, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush")
local dfcombat0_Brush = {CONST_ANI_SMALLICE}local combat0_Brush_2 = createCombatObject()
setCombatParam(combat0_Brush_2, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
setCombatParam(combat0_Brush_2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat0_Brush_2,createCombatArea({{2}}))
function getDmg_Brush_2(cid, level, maglevel)
return (80)*-1,(180)*-12 
end
setCombatCallback(combat0_Brush_2, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_2")local combat0_Brush_3 = createCombatObject()
setCombatParam(combat0_Brush_3, COMBAT_PARAM_EFFECT, CONST_ME_STUN)
setCombatParam(combat0_Brush_3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat0_Brush_3,createCombatArea({{1, 0, 0, 0, 1},
{0, 1, 2, 1, 0},
{1, 0, 0, 0, 1}}))
function getDmg_Brush_3(cid, level, maglevel)
return (86)*-1,(200)*-10 
end
setCombatCallback(combat0_Brush_3, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_3")local combat0_Brush_2 = createCombatObject()
setCombatParam(combat0_Brush_2, COMBAT_PARAM_EFFECT, CONST_ME_GROUNDSHAKER)
setCombatParam(combat0_Brush_2, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_WHIRLWINDCLUB)
setCombatParam(combat0_Brush_2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat0_Brush_2,createCombatArea({{2}}))
function getDmg_Brush_2(cid, level, maglevel)
return (80)*-1,(200)*-10 
end
setCombatCallback(combat0_Brush_2, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_2")
local dfcombat0_Brush_2 = {CONST_ANI_WHIRLWINDCLUB}local combat0_Brush = createCombatObject()
setCombatParam(combat0_Brush, COMBAT_PARAM_EFFECT, CONST_ME_SMALLCLOUDS)
setCombatParam(combat0_Brush, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_THROWINGKNIFE)
setCombatParam(combat0_Brush, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat0_Brush,createCombatArea({{2}}))
function getDmg_Brush(cid, level, maglevel)
return (95)*-1,(210)*-10 
end
setCombatCallback(combat0_Brush, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush")
local dfcombat0_Brush = {CONST_ANI_SMALLEARTH}local combat0_Brush_6 = createCombatObject()
setCombatParam(combat0_Brush_6, COMBAT_PARAM_EFFECT, CONST_ME_SMALLPLANTS)
setCombatParam(combat0_Brush_6, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat0_Brush_6,createCombatArea({{0, 1, 1, 1, 0},
{1, 0, 2, 0, 1},
{0, 1, 1, 1, 0}}))
function getDmg_Brush_6(cid, level, maglevel)
return (100)*-1,(290)*-10 
end
setCombatCallback(combat0_Brush_6, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_6")


-- Areas/Combat for 900ms
local combat9_Brush_6 = createCombatObject()
setCombatParam(combat9_Brush_6, COMBAT_PARAM_EFFECT, CONST_ME_SMALLPLANTS)
setCombatParam(combat9_Brush_6, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat9_Brush_6,createCombatArea({{1, 0, 0, 0, 0, 0, 0, 0, 1},
{1, 0, 0, 0, 0, 0, 0, 0, 1},
{1, 0, 0, 0, 2, 0, 0, 0, 1},
{1, 0, 0, 0, 0, 0, 0, 0, 1},
{1, 0, 0, 0, 0, 0, 0, 0, 1}}))
function getDmg_Brush_6(cid, level, maglevel)
return (100)*-1,(290)*-11 
end
setCombatCallback(combat9_Brush_6, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_6")local combat9_Brush_3 = createCombatObject()
setCombatParam(combat9_Brush_3, COMBAT_PARAM_EFFECT, CONST_ME_STUN)
setCombatParam(combat9_Brush_3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat9_Brush_3,createCombatArea({{1, 0, 0, 0, 0, 0, 0, 0, 1},
{0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 1, 0, 0, 0, 1, 0, 0},
{0, 0, 0, 1, 2, 1, 0, 0, 0},
{0, 0, 1, 0, 0, 0, 1, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0},
{1, 0, 0, 0, 0, 0, 0, 0, 1}}))
function getDmg_Brush_3(cid, level, maglevel)
return (86)*-1,(200)*-10
end
setCombatCallback(combat9_Brush_3, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_3")


-- Areas/Combat for 400ms
local combat4_Brush_6 = createCombatObject()
setCombatParam(combat4_Brush_6, COMBAT_PARAM_EFFECT, CONST_ME_SMALLPLANTS)
setCombatParam(combat4_Brush_6, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat4_Brush_6,createCombatArea({{0, 1, 1, 1, 1, 1, 0},
{1, 0, 0, 0, 0, 0, 1},
{1, 0, 0, 2, 0, 0, 1},
{1, 0, 0, 0, 0, 0, 1},
{0, 1, 1, 1, 1, 1, 0}}))
function getDmg_Brush_6(cid, level, maglevel)
return (100)*-1,(290)*-10 
end
setCombatCallback(combat4_Brush_6, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_6")local combat4_Brush_3 = createCombatObject()
setCombatParam(combat4_Brush_3, COMBAT_PARAM_EFFECT, CONST_ME_STUN)
setCombatParam(combat4_Brush_3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat4_Brush_3,createCombatArea({{1, 0, 0, 0, 0, 0, 1},
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 2, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
{1, 0, 0, 0, 0, 0, 1}}))
function getDmg_Brush_3(cid, level, maglevel)
return (86)*-1,(200)*-7 
end
setCombatCallback(combat4_Brush_3, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_3")


-- =============== CORE FUNCTIONS ===============
local function RunPart(c,cid,var,dirList,dirEmitPos) -- Part
if (isCreature(cid)) then
doCombat(cid, c, var)
if (dirList ~= nil) then -- Emit distance effects
local i = 2;
while (i < #dirList) do
doSendDistanceShoot(dirEmitPos,{x=dirEmitPos.x-dirList[i],y=dirEmitPos.y-dirList[i+1],z=dirEmitPos.z},dirList[1])
i = i + 2
end 
end
end
end


function onCastSpell(cid, var)
if getPlayerReset(cid) < 1 then
    doPlayerSendCancel(cid, "You can't cast this spell.")
    return true
end
local startPos = getCreaturePosition(cid)
RunPart(combat0_Brush,cid,var,dfcombat0_Brush,startPos)
RunPart(combat0_Brush_2,cid,var)
RunPart(combat0_Brush_3,cid,var)
RunPart(combat0_Brush_2,cid,var,dfcombat0_Brush_2,startPos)
RunPart(combat0_Brush,cid,var,dfcombat0_Brush,startPos)
RunPart(combat0_Brush_6,cid,var)
addEvent(RunPart,900,combat9_Brush_6,cid,var)
addEvent(RunPart,900,combat9_Brush_3,cid,var)
addEvent(RunPart,400,combat4_Brush_6,cid,var)
addEvent(RunPart,400,combat4_Brush_3,cid,var)
return true
end

Funciono, porem existe pequeno errinho, pois o player que não tem reset acaba falando o spell e gastando a mana kkkkkk ( A spell não sai, não da nado nem animações, mais teoricamente ele pode fica treinado ml dai.. kkkk

 

 

-- Areas/Combat for 0ms
function getPlayerReset(cid)
local qr = db.getResult("SELECT `reset` FROM `players` WHERE `id`= ".. getPlayerGUID(cid).. ";")
rss = qr:getDataInt("reset", cid)
if rss < 0 then
rss = 0
end
return rss
end

foi preciso remover o <--

Link para o comentário
https://xtibia.com/forum/topic/238333-magia-por-x-resets/#findComment-1678365
Compartilhar em outros sites

  • 0

Mude:

function onCastSpell(cid, var)
if getPlayerReset(cid) < 1 then
    doPlayerSendCancel(cid, "You can't cast this spell.")
    return true
end

Para:

function onCastSpell(cid, var)
if getPlayerReset(cid) < 1 then
    doPlayerSendCancel(cid, "You can't cast this spell.")
    return false
end
Link para o comentário
https://xtibia.com/forum/topic/238333-magia-por-x-resets/#findComment-1678366
Compartilhar em outros sites

  • 0

Já aproveitando o topico pessoal, saberiam dizer por que diabos, meu evento WOE não sumona os guardinhas? Aparece o seguinte erro

 

post-334468-0-50093800-1450293863_thumb.png

Erro está em alguma coisa aqui sera pessoal?

dofile("./_woe.lua")

local delays = 60

local guards_price = 30000	--30k

function onUse(cid, item, fromPosition, itemEx, toPosition)
	Woe.getInfo()
	if item.actionid == Castle.banderas then
		if Woe.isTime() then
			if Woe.isStarted() then
				if infoLua[2] == getPlayerGuildId(cid) then
					doTeleportThing(cid, Castle.guildEntry, false)
				else
					doPlayerSendCancel(cid, "You are not member of ".. Woe.guildName() ..".")
				end
			end
		else
			if infoLua[2] == getPlayerGuildId(cid) then
				doTeleportThing(cid, Castle.guildEntry, false)
			else
				doPlayerSendCancel(cid, "You are not member of ".. Woe.guildName() ..".")
			end
		end
	elseif (item.uid == 3134) then
		if not Woe.isStarted() or (infoLua[2] ~= getPlayerGuildId(cid)) or (getPlayerGuildLevel(cid) ~= GUILDLEVEL_LEADER) then
			return true
		end
		if (getPlayerMoney(cid) < guards_price) then
			return doPlayerSendCancel(cid, "Not enough money.")
		end
		local varDelay = getGlobalStorageValue(24503)
		if (varDelay < 0) or ((os.time() - varDelay) >= delays) then
			if Woe.check() then
				Woe.summon()
				doPlayerRemoveMoney(cid, guards_price)
			else
				doPlayerSendCancel(cid, "There are still guards alive.")
			end
		else
			doPlayerSendCancel(cid, "Delay no listo.")
		end
	end
	return true
end

 

Mude:

function onCastSpell(cid, var)
if getPlayerReset(cid) < 1 then
    doPlayerSendCancel(cid, "You can't cast this spell.")
    return true
end

Para:

function onCastSpell(cid, var)
if getPlayerReset(cid) < 1 then
    doPlayerSendCancel(cid, "You can't cast this spell.")
    return false
end

Perfeito amigo!

Link para o comentário
https://xtibia.com/forum/topic/238333-magia-por-x-resets/#findComment-1678376
Compartilhar em outros sites

  • 0

Tópico Movido
Este tópico foi movido de "OTServSuporte OTServSuporte Scripting"
para "OTServSuporte OTServSuporte ScriptingPedidos e dúvidas resolvidos - Scripting".

 

 

Link para o comentário
https://xtibia.com/forum/topic/238333-magia-por-x-resets/#findComment-1678630
Compartilhar em outros sites

×
×
  • Criar Novo...