• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

{pedido} Script boots recarga

exanime

I´m learning Lua
Joined
Oct 24, 2011
Messages
40
Reaction score
3
Location
Bogota, Colombia
Hola, quisera pedir una ayuda urgente por favor, he tratado de hacer un script donde me recargue cierto porcentaje de mana y sangre cada cierto tiempo peor no lo he logrado hacer, (el porcentaje va variando de acuerdo al maximo helath y sangre de cada porcentaje).

aqui va lo que ando haciendo, pero no me funciona, no da errores pero no funciona, no se en que ando mal, se los agradeceria unos consejos para temrinarlo, gracias.

Code:
   local exhausted_seconds = 2000
   local exhausted_storagevalue = 0
   local mana = getCreatureMaxMana(cid)
   
local sangre = getCreatureMaxHealth(cid)


local porcentaje_mana = math.random((mana * (getCreatureMana(cid)/100)), (mana * (getCreatureMana(cid)/100))) 
local porcentaje_sangre = math.random((sangre * (getCreatureHealth(cid)/100)), (sangre * (getCreatureHealth(cid)/100))) 

function onEquip(cid, item, slot)

      if(item.type >= 1) then
         if(os.time() > getPlayerStorageValue(cid, exhausted_storagevalue)) then
            if(isPlayer(cid) == 1) then
doSendMagicEffect(topos,12)
doCreatureAddHealth(cid,porcentaje_sangre)
doPlayerAddMana(cid,porcentaje_mana)
doPlayerSay(cid,"me recupere",1)
               setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
               doChangeTypeItem(item.uid, item.type - 1)
            else
               doSendMagicEffect(frompos, CONST_ME_POFF)
               doPlayerSendCancel(cid, "You are exchausted.")
            end
         else
            doSendMagicEffect(frompos, CONST_ME_POFF)
            doPlayerSendCancel(cid, "You are exhausted.")
         end
      else
         if(os.time() < getPlayerStorageValue(cid, exhausted_storagevalue)) then
            doSendMagicEffect(frompos, CONST_ME_POFF)
            doPlayerSendCancel(cid, "You are exhausted.")
         else
            if(isPlayer(cid) == 1) then
doSendMagicEffect(topos,12)
               doPlayerAddMana(cid, porcentaje_mana)
                                        doPlayerAddHealth(cid, porcentaje_sangre*1.5)
doPlayerSay(cid,"I feel the best",1)
               setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
               doRemoveItem(item.uid, 1)
            else
               doSendMagicEffect(frompos, CONST_ME_POFF)
               doPlayerSendCancel(cid, "You are exchausted.")
            end
         end
      end

   return 1
end
function onDeEquip(cid, item, slot)
local pos = getPlayerPosition(cid)
doSendMagicEffect(pos, 13)
doSendAnimatedText(pos, "Botas quitadas", 65)
end

Espero Su ayuda, Gracias
 

Similar threads

Back
Top