Ir para conteúdo

Featured Replies

Postado

Está dando esse erro no distro de onthink desse script, e também quando esta em uso, não ganha xp...

 

creaturescript.lua

 

--[[
    Gems System By Maxwell Denisson(MaXwEllDeN)
    V 1.0
    --]]
    
function onThink(cid)         
      local gemid = getPlayerStorageValue(cid, 71473)
      
      if (getPlayerStorageValue(cid, 45783) > 0) and (checkGemTimeFinish(cid, gemid)) then
         deAtiveGem(cid, gemid)
         doRemoveCondition(cid, CONDITION_ATTRIBUTES)         
      end      
      return true
end

function onLogin(cid)
   local gemid = getPlayerStorageValue(cid, 71473)
   
   if (getPlayerStorageValue(cid, 45783) > 0) and (checkGemTimeFinish(cid, gemid)) then
      deAtiveGem(cid, gemid)
   end
   
   if (gemid > 0) and (not checkGemTimeFinish(cid, gemid)) then
      local pedra = pedras_add[gemid]

      if not (pedra) then
         return true  
      end
  
      local skills = pedra.skills
      doAddCondition(cid, pedras_add_c[gemid])      
      doPlayerSendTextMessage(cid, 27, "O efeito da gema mágica foi retomado.")
 
      doPlayerSetExperienceRate(cid, pedra.xp)
      
      registerCreatureEvent(cid, "EffectCheck")      
      sendGemEffect(cid, gemid)
   end   
   
   registerCreatureEvent(cid, "EffectDeath")
   return true
end

 

 

lib.lua

 

--[[
    Gems System By Maxwell Denisson(MaXwEllDeN)
    V 1.0
    --]]

function getPrefixGEMs(val) -- By MaXwEllDeN
   return (val > 1) and "s" or ""
end

pedras_add = {

      [8299] = { -- Pedra Preta
              skills = {
                     [0] = 15, -- Fist Fighting
                     [1] = 15, -- Club Fighting
                     [2] = 15, -- Sword Fighting
                     [3] = 15, -- Axe Fighting
                     [4] = 0, -- Distance Fighting
                     [5] = 15, -- Shielding
                     [6] = 0, -- Magic Level
              },
              xp = 0, -- Ex, 2 x o Xp do serv
              time = 30,
              color = {50, 50, 50, 50},
              },
      [8303] = { -- Pedra Rosa
              skills = {
                     [0] = 0, -- Fist Fighting
                     [1] = 0, -- Club Fighting
                     [2] = 0, -- Sword Fighting
                     [3] = 0, -- Axe Fighting
                     [4] = 15, -- Distance Fighting
                     [5] = 15, -- Shielding
                     [6] = 0, -- Magic Level
              },
              xp = 0, -- Ex, 2 x o Xp do serv
              time = 30,
              color = {180, 180, 180},
              },
      [8301] = { -- Pedra Amarela
              skills = {
                     [0] = 0, -- Fist Fighting
                     [1] = 0, -- Club Fighting
                     [2] = 0, -- Sword Fighting
                     [3] = 0, -- Axe Fighting
                     [4] = 0, -- Distance Fighting
                     [5] = 15, -- Shielding
                     [6] = 15, -- Magic Level
              },
              xp = 0, -- Ex, 2 x o Xp do serv
              time = 30,
              color = {210, 210, 210},
              },
      [8302] = { -- Pedra Azul
              skills = {
                     [0] = 0, -- Fist Fighting
                     [1] = 0, -- Club Fighting
                     [2] = 0, -- Sword Fighting
                     [3] = 0, -- Axe Fighting
                     [4] = 0, -- Distance Fighting
                     [5] = 15, -- Shielding
                     [6] = 15, -- Magic Level
              },
              xp = 0, -- Ex, 2 x o Xp do serv
              time = 30,
              color = {35, 35, 35, 35},
              },

}

pedras_add_c = {
             [8299] = createConditionObject(CONDITION_ATTRIBUTES),
             [8303] = createConditionObject(CONDITION_ATTRIBUTES),
             [8301] = createConditionObject(CONDITION_ATTRIBUTES),
             [8302] = createConditionObject(CONDITION_ATTRIBUTES)

}

local conditions = {CONDITION_PARAM_SKILL_FIST, CONDITION_PARAM_SKILL_CLUB, CONDITION_PARAM_SKILL_SWORD,CONDITION_PARAM_SKILL_AXE, CONDITION_PARAM_SKILL_DISTANCE, CONDITION_PARAM_SKILL_SHIELD, CONDITION_PARAM_STAT_MAGICPOINTS}

for a, b in pairs(pedras_add_c) do
   setConditionParam(pedras_add_c[a], CONDITION_PARAM_TICKS, pedras_add[a].time*60*1000)
   for c = 0, 6 do
      setConditionParam(pedras_add_c[a], conditions[c + 1], pedras_add[a].skills[c])
   end
end

function sendGemEffect(uid, itemid)
   if (isCreature(uid)) then
      local pedra = pedras_add[itemid]
      local msgs = {"´ .    ,", ".    ´ ,", "`  .  ,", ",    ` ."}
      if (getPlayerStorageValue(uid, 45783) > 0) then
         addEvent(sendGemEffect, 575, uid, itemid)
         doSendAnimatedText(getThingPos(uid), msgs[math.random(#msgs)], pedra.color[math.random(#pedra.color)])
      end
   end
   return true
end


function isGemActivated(cid)
  return (getPlayerStorageValue(cid, gems.storage[getPlayerVocation(cid)]) > 0) and true or false
end

function checkGemTimeFinish(uid, gemid)
   local timpo = (getPlayerStorageValue(uid, 45783)-os.time())*(-1)
   return (timpo >= pedras_add[gemid].time*60) and true or false
end

function deAtiveGem(uid, gemid)
   local pedra = pedras_add[gemid]
   local skills = pedra.skills

   for a = 0, #skills-1 do
       doPlayerAddSkill(uid, a, -skills[a])
   end

   doRemoveCondition(uid, pedras_add_c[gemid])
   doPlayerSetExperienceRate(uid, 1)
   setPlayerStorageValue(uid, 45783, -1)
   setPlayerStorageValue(uid, 71473, -1)
   doPlayerSendTextMessage(uid, 27, "O efeito da sua gema acabou.")
   return true
end

function AtiveGem(uid, item)
   local pedra = pedras_add[item.itemid]

   if not (pedra) then
      return false
   end

   local skills = pedra.skills
   doAddCondition(uid, pedras_add_c[item.itemid])
   doPlayerSendTextMessage(uid, 27, "Você está sob o efeito da gema mágica, e o efeito dela durará por ".. pedra.time .. " minuto".. getPrefixGEMs(pedra.time) .. ".")
   setPlayerStorageValue(uid, 71473, item.itemid)
   setPlayerStorageValue(uid, 45783, os.time())

   sendGemEffect(uid, item.itemid)
   doPlayerSetExperienceRate(uid, pedra.xp)

   registerCreatureEvent(uid, "EffectCheck")
   doRemoveItem(item.uid, 1)
   return true
end

 

errogem.png

Editado por jNo (veja o histórico de edições)

(1º) | [8.60] - Galaxy Server - Download

(2º) | [8.60] - Glorious Server - Download

(3º) | [8.60] - Epic Server - Download

Resolvido por Vodkart

Ir para solução
  • Respostas 5
  • Visualizações 472
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • --[[ Gems System By Maxwell Denisson(MaXwEllDeN) V 1.0 --]] function onThink(cid) if not isCreature(cid) then return LUA_ERROR end local gemid = getPlayerStorageValue(

  • é pq a exp está tudo configurada como 0 na lib 

Posted Images

Postado
  • Solução
--[[
    Gems System By Maxwell Denisson(MaXwEllDeN)
    V 1.0
    --]]
    
function onThink(cid) 
	if not isCreature(cid) then return LUA_ERROR end        
      local gemid = getPlayerStorageValue(cid, 71473)
      if (getPlayerStorageValue(cid, 45783) > 0) and (checkGemTimeFinish(cid, gemid)) then
         deAtiveGem(cid, gemid)
         doRemoveCondition(cid, CONDITION_ATTRIBUTES)         
      end      
      return true
end

function onLogin(cid)
   local gemid = getPlayerStorageValue(cid, 71473)
   
   if (getPlayerStorageValue(cid, 45783) > 0) and (checkGemTimeFinish(cid, gemid)) then
      deAtiveGem(cid, gemid)
   end
   
   if (gemid > 0) and (not checkGemTimeFinish(cid, gemid)) then
      local pedra = pedras_add[gemid]

      if not (pedra) then
         return true  
      end
  
      local skills = pedra.skills
      doAddCondition(cid, pedras_add_c[gemid])      
      doPlayerSendTextMessage(cid, 27, "O efeito da gema mágica foi retomado.")
 
      doPlayerSetExperienceRate(cid, pedra.xp)
      
      registerCreatureEvent(cid, "EffectCheck")      
      sendGemEffect(cid, gemid)
   end   
   
   registerCreatureEvent(cid, "EffectDeath")
   return true
end

 

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

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.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.8k

Informação Importante

Confirmação de Termo