Ir para conteúdo
Banner com Efeitos

Featured Replies

Postado

Essa mod abaixo é de um double EXP potion, preciso de uma alteração pra ser utilizada apenas uma vez por dia:

 

<?xml version="1.0" encoding="UTF-8"?>
<mod name="AdvancedExpPotionBloodSystem" enabled="yes" author="MatheusMkalo" forum="XTibia.com">


<!-- Configs and Functions -->
<config name="PotionExpBloodConfigs"><![CDATA[


------ CONFIGURE SEU SCRIPT ------ TRUE ou FALSE
configs = {
time = 30, ---- TIME IN MINUTES
addrate = 100, -- Exp que vai adicionar em %
removeonuse = yes
}


function getTime(s)
    local n = math.floor(s / 60)
    s = s - (60 * n)
    return n, s
end


CreatureEventChecker = function(event, ...) -- Colex
    if isCreature(arg[1]) then
        event(unpack(arg))
    end
end


creatureEvent = function(event, delay, ...) -- Colex
    addEvent(CreatureEventChecker, delay, event, unpack(arg))
end


function getPlayerExtraExpRate(cid) -- By MatheusMkalo
    return (getPlayerRates(cid)[8]-1)*100
end
]]></config>


<!-- exppotionblood.lua -->
<action itemid="12702" event="script"><![CDATA[
domodlib('PotionExpBloodConfigs')
if getPlayerStorageValue(cid, 43891) > os.time() then
    return doPlayerSendCancel(cid, "Voce ja esta sob efeito da potion.")
end


if configs.removeonuse == yes then
    doRemoveItem(item.uid, 1)
end


for i = configs.time*60, 1, -1 do
local a = math.floor(i/60) .. ":" .. i - (60 * math.floor(i/60))
if #a < 4 then
a = string.sub(a,1,2) .. "0" .. string.sub(a, 3)
end
if i == configs.time*60 then
creatureEvent(doPlayerSendCancel, configs.time*60*1000, cid, "O efeito da exp potion acabou.")
end
creatureEvent(doPlayerSendCancel, (configs.time*60-i)*1000, cid, "O efeito da exp potion termina em "..a..".")
end


doPlayerSetExperienceRate(cid, (1+(configs.addrate/100))+(getPlayerExtraExpRate(cid)/100))
creatureEvent(doPlayerSetExperienceRate, configs.time *60*1000, cid, 1+(getPlayerExtraExpRate(cid)/100-(configs.addrate/100)))
doPlayerSendTextMessage(cid, 25, "Voce vai receber o dobro de exp durante meia hora.")
doPlayerSetStorageValue(cid, 43891, os.time()+120)
setPlayerStorageValue(cid, 62165, os.time())
creatureEvent(setPlayerStorageValue, configs.time *60*1000, cid, 62165, 0)
return TRUE
]]></action>


<creaturescript type="login" name="ExpPotionBlood" event="script"><![CDATA[
domodlib('PotionExpBloodConfigs')
local time = configs.time
    if os.time()-getPlayerStorageValue(cid, 62165) < time *60 then
       doPlayerSetExperienceRate(cid, (1+(configs.addrate/100))+(getPlayerExtraExpRate(cid)/100))
       creatureEvent(doPlayerSetExperienceRate, (time*60-(os.time()-getPlayerStorageValue(cid, 62165))) * 1000, cid, 1+(getPlayerExtraExpRate(cid)/100-(configs.addrate/100)))
       creatureEvent(setPlayerStorageValue, (time*60-(os.time()-getPlayerStorageValue(cid, 62165))) * 1000 , cid, 62165, 0)


       for i = (time*60-(os.time()-getPlayerStorageValue(cid, 62165))), 1, -1 do
       local a = math.floor(i/60) .. ":" .. i - (60 * math.floor(i/60))
       if #a < 4 then
       a = string.sub(a,1,2) .. "0" .. string.sub(a, 3)
       end
       if i == (time*60-(os.time()-getPlayerStorageValue(cid, 62165))) then
       creatureEvent(doPlayerSendCancel, (time*60-(os.time()-getPlayerStorageValue(cid, 62165)))*1000, cid, "O efeito da exp potion acabou.")
       end
       creatureEvent(doPlayerSendCancel, ((time*60-(os.time()-getPlayerStorageValue(cid, 62165)))-i)*1000, cid, "O efeito da exp potion vai acabar em "..a..".")
       end
    end
return TRUE
]]></creaturescript>
</mod>

 

Resolvido por Qwizer

Ir para solução
  • Respostas 6
  • Visualizações 519
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • <?xml version="1.0" encoding="UTF-8"?> <mod name="AdvancedExpPotionBloodSystem" enabled="yes" author="MatheusMkalo" forum="XTibia.com"> <!-- Configs and Functions --> <config

  • obg, VLW

Postado

Resolvido.

YDmXTU2.png

 

Entenda tudo sobre VPS, DEDICADOS & HOSPEDAGENS. => Clique aqui

Global Full Download 10.9x - TFS 1.2/FERUMBRAS/KRAILOS. => Clique aqui

 

Muitos querem aquilo que você tem, 
mas vão desistir quando souberem o preço que você pagou.

 

skype-favicon.png lu.lukinha

message-16.png [email protected]

Postado
  • Autor
[21:0:56.856] [Error - Test Interface]
[21:0:56.857] domodlib('PotionExpBloodConfigs')
[21:0:56.858] if getPlayerStorageValue(cid, 43891) > os.time() then
[21:0:56.858]     return doPlayerSendCancel(cid, "Voce ja esta sob efeito da pot
ion.")
[21:0:56.859] end
[21:0:56.860] function onUse(cid, item, fromPosition, itemEx, toPosition)
[21:0:56.861]   local cfg = {}
[21:0:56.861]   cfg.refuel = 42 * 60 * 1000
[21:0:56.862]   local config = {
[21:0:56.863]           storage = 43891,
[21:0:56.863]           hours = 24
[21:0:56.864]   }
[21:0:56.865]   if getPlayerStorageValue(cid, config.storage) >= os.time() then
[21:0:56.866]           return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,
"Sorry, but you have wait "..os.date("%d %B %Y %X ", getPlayerStorageValue(cid,c
onfig.storage)).."to use exp potion again.")
[21:0:56.866]   end
[21:0:56.867]   if(getPlayerStamina(cid) >= cfg.refuel) then
[21:0:56.867]           doPlayerSendCancel(cid, "Voce ja esta sob efeito da poti
on.")
[21:0:56.868]   else
[21:0:56.869]           doPlayerSetStamina(cid, cfg.refuel)
[21:0:56.870]           doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORAN
GE, "Voce usou a pot.")
[21:0:56.870]           setPlayerStorageValue(cid, config.storage, os.time()+con
fig.hours*3600)
[21:0:56.871]   end
[21:0:56.871]   return true
[21:0:56.872] end




[21:0:56.873] if configs.removeonuse == yes then
[21:0:56.874]     doRemoveItem(item.uid, 1)
[21:0:56.874] end




[21:0:56.875] for i = configs.time*60, 1, -1 do
[21:0:56.876] local a = math.floor(i/60) .. ":" .. i - (60 * math.floor(i/60))
[21:0:56.877] if #a < 4 then
[21:0:56.877] a = string.sub(a,1,2) .. "0" .. string.sub(a, 3)
[21:0:56.878] end
[21:0:56.878] if i == configs.time*60 then
[21:0:56.879] creatureEvent(doPlayerSendCancel, configs.time*60*1000, cid, "O ef
eito da exp potion acabou.")
[21:0:56.880] end
[21:0:56.880] creatureEvent(doPlayerSendCancel, (configs.time*60-i)*1000, cid, "
O efeito da exp potion termina em "..a..".")
[21:0:56.881] end




[21:0:56.882] doPlayerSetExperienceRate(cid, (1+(configs.addrate/100))+(getPlaye
rExtraExpRate(cid)/100))
[21:0:56.882] creatureEvent(doPlayerSetExperienceRate, configs.time *60*1000, ci
d, 1+(getPlayerExtraExpRate(cid)/100-(configs.addrate/100)))
[21:0:56.883] doPlayerSendTextMessage(cid, 25, "Voce vai receber o dobro de exp
durante meia hora.")
[21:0:56.883] doPlayerSetStorageValue(cid, 43891, os.time()+120)
[21:0:56.884] setPlayerStorageValue(cid, 62165, os.time())
[21:0:56.885] creatureEvent(setPlayerStorageValue, configs.time *60*1000, cid, 6
2165, 0)
[21:0:56.885] return TRUE


[21:0:56.887] Description:
[21:0:56.890] (luaGetCreatureStorage) Creature not found


[21:0:56.891] [Error - Test Interface]
[21:0:56.892] domodlib('PotionExpBloodConfigs')
[21:0:56.893] if getPlayerStorageValue(cid, 43891) > os.time() then
[21:0:56.893]     return doPlayerSendCancel(cid, "Voce ja esta sob efeito da pot
ion.")
[21:0:56.894] end
[21:0:56.895] function onUse(cid, item, fromPosition, itemEx, toPosition)
[21:0:56.896]   local cfg = {}
[21:0:56.897]   cfg.refuel = 42 * 60 * 1000
[21:0:56.897]   local config = {
[21:0:56.898]           storage = 43891,
[21:0:56.899]           hours = 24
[21:0:56.899]   }
[21:0:56.900]   if getPlayerStorageValue(cid, config.storage) >= os.time() then
[21:0:56.900]           return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,
"Sorry, but you have wait "..os.date("%d %B %Y %X ", getPlayerStorageValue(cid,c
onfig.storage)).."to use exp potion again.")
[21:0:56.901]   end
[21:0:56.902]   if(getPlayerStamina(cid) >= cfg.refuel) then
[21:0:56.902]           doPlayerSendCancel(cid, "Voce ja esta sob efeito da poti
on.")
[21:0:56.903]   else
[21:0:56.904]           doPlayerSetStamina(cid, cfg.refuel)
[21:0:56.904]           doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORAN
GE, "Voce usou a pot.")
[21:0:56.905]           setPlayerStorageValue(cid, config.storage, os.time()+con
fig.hours*3600)
[21:0:56.905]   end
[21:0:56.906]   return true
[21:0:56.906] end




[21:0:56.908] if configs.removeonuse == yes then
[21:0:56.909]     doRemoveItem(item.uid, 1)
[21:0:56.910] end




[21:0:56.911] for i = configs.time*60, 1, -1 do
[21:0:56.912] local a = math.floor(i/60) .. ":" .. i - (60 * math.floor(i/60))
[21:0:56.913] if #a < 4 then
[21:0:56.913] a = string.sub(a,1,2) .. "0" .. string.sub(a, 3)
[21:0:56.914] end
[21:0:56.915] if i == configs.time*60 then
[21:0:56.915] creatureEvent(doPlayerSendCancel, configs.time*60*1000, cid, "O ef
eito da exp potion acabou.")
[21:0:56.916] end
[21:0:56.917] creatureEvent(doPlayerSendCancel, (configs.time*60-i)*1000, cid, "
O efeito da exp potion termina em "..a..".")
[21:0:56.918] end




[21:0:56.919] doPlayerSetExperienceRate(cid, (1+(configs.addrate/100))+(getPlaye
rExtraExpRate(cid)/100))
[21:0:56.920] creatureEvent(doPlayerSetExperienceRate, configs.time *60*1000, ci
d, 1+(getPlayerExtraExpRate(cid)/100-(configs.addrate/100)))
[21:0:56.921] doPlayerSendTextMessage(cid, 25, "Voce vai receber o dobro de exp
durante meia hora.")
[21:0:56.922] doPlayerSetStorageValue(cid, 43891, os.time()+120)
[21:0:56.922] setPlayerStorageValue(cid, 62165, os.time())
[21:0:56.923] creatureEvent(setPlayerStorageValue, configs.time *60*1000, cid, 6
2165, 0)
[21:0:56.924] return TRUE


[21:0:56.925] Description:
[21:0:56.926] [string "LuaInterface::loadBuffer"]:2: attempt to compare number w
ith boolean
[21:0:56.927] [Error - Event::checkScript] Cannot load script (domodlib('PotionE
xpBloodConfigs')
[21:0:56.927] if getPlayerStorageValue(cid, 43891) > os.time() then
[21:0:56.928]     return doPlayerSendCancel(cid, "Voce ja esta sob efeito da pot
ion.")
[21:0:56.929] end
[21:0:56.930] function onUse(cid, item, fromPosition, itemEx, toPosition)
[21:0:56.930]   local cfg = {}
[21:0:56.931]   cfg.refuel = 42 * 60 * 1000
[21:0:56.932]   local config = {
[21:0:56.932]           storage = 43891,
[21:0:56.933]           hours = 24
[21:0:56.934]   }
[21:0:56.935]   if getPlayerStorageValue(cid, config.storage) >= os.time() then
[21:0:56.935]           return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,
"Sorry, but you have wait "..os.date("%d %B %Y %X ", getPlayerStorageValue(cid,c
onfig.storage)).."to use exp potion again.")
[21:0:56.936]   end
[21:0:56.937]   if(getPlayerStamina(cid) >= cfg.refuel) then
[21:0:56.938]           doPlayerSendCancel(cid, "Voce ja esta sob efeito da poti
on.")
[21:0:56.938]   else
[21:0:56.939]           doPlayerSetStamina(cid, cfg.refuel)
[21:0:56.940]           doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORAN
GE, "Voce usou a pot.")
[21:0:56.940]           setPlayerStorageValue(cid, config.storage, os.time()+con
fig.hours*3600)
[21:0:56.941]   end
[21:0:56.942]   return true
[21:0:56.942] end




[21:0:56.944] if configs.removeonuse == yes then
[21:0:56.944]     doRemoveItem(item.uid, 1)
[21:0:56.945] end




[21:0:56.946] for i = configs.time*60, 1, -1 do
[21:0:56.947] local a = math.floor(i/60) .. ":" .. i - (60 * math.floor(i/60))
[21:0:56.948] if #a < 4 then
[21:0:56.949] a = string.sub(a,1,2) .. "0" .. string.sub(a, 3)
[21:0:56.949] end
[21:0:56.950] if i == configs.time*60 then
[21:0:56.951] creatureEvent(doPlayerSendCancel, configs.time*60*1000, cid, "O ef
eito da exp potion acabou.")
[21:0:56.953] end
[21:0:56.954] creatureEvent(doPlayerSendCancel, (configs.time*60-i)*1000, cid, "
O efeito da exp potion termina em "..a..".")
[21:0:56.954] end




[21:0:56.956] doPlayerSetExperienceRate(cid, (1+(configs.addrate/100))+(getPlaye
rExtraExpRate(cid)/100))
[21:0:56.957] creatureEvent(doPlayerSetExperienceRate, configs.time *60*1000, ci
d, 1+(getPlayerExtraExpRate(cid)/100-(configs.addrate/100)))
[21:0:56.958] doPlayerSendTextMessage(cid, 25, "Voce vai receber o dobro de exp
durante meia hora.")
[21:0:56.959] doPlayerSetStorageValue(cid, 43891, os.time()+120)
[21:0:56.960] setPlayerStorageValue(cid, 62165, os.time())
[21:0:56.960] creatureEvent(setPlayerStorageValue, configs.time *60*1000, cid, 6
2165, 0)
Postado
  • Solução
<?xml version="1.0" encoding="UTF-8"?>
<mod name="AdvancedExpPotionBloodSystem" enabled="yes" author="MatheusMkalo" forum="XTibia.com">




<!-- Configs and Functions -->
<config name="PotionExpBloodConfigs"><![CDATA[




------ CONFIGURE SEU SCRIPT ------ TRUE ou FALSE
configs = {
time = 30, ---- TIME IN MINUTES
addrate = 100, -- Exp que vai adicionar em %
removeonuse = yes
}




function getTime(s)
    local n = math.floor(s / 60)
    s = s - (60 * n)
    return n, s
end




CreatureEventChecker = function(event, ...) -- Colex
    if isCreature(arg[1]) then
        event(unpack(arg))
    end
end




creatureEvent = function(event, delay, ...) -- Colex
    addEvent(CreatureEventChecker, delay, event, unpack(arg))
end




function getPlayerExtraExpRate(cid) -- By MatheusMkalo
    return (getPlayerRates(cid)[8]-1)*100
end
]]></config>




<!-- exppotionblood.lua -->
<action itemid="12702" event="script"><![CDATA[
domodlib('PotionExpBloodConfigs')


if getPlayerStorageValue(cid, 43891) > os.time() then
    return doPlayerSendCancel(cid, "Voce ja esta sob efeito da potion.")
elseif getPlayerStorageValue(cid, 55489) - os.time() > 0 then
    return doPlayerSendCancel(cid, "Voce so pode usar novamente depois de 24 horas.")
end




if configs.removeonuse == yes then
    doRemoveItem(item.uid, 1)
end




for i = configs.time*60, 1, -1 do
local a = math.floor(i/60) .. ":" .. i - (60 * math.floor(i/60))
if #a < 4 then
a = string.sub(a,1,2) .. "0" .. string.sub(a, 3)
end
if i == configs.time*60 then
creatureEvent(doPlayerSendCancel, configs.time*60*1000, cid, "O efeito da exp potion acabou.")
end
creatureEvent(doPlayerSendCancel, (configs.time*60-i)*1000, cid, "O efeito da exp potion termina em "..a..".")
end




doPlayerSetExperienceRate(cid, (1+(configs.addrate/100))+(getPlayerExtraExpRate(cid)/100))
creatureEvent(doPlayerSetExperienceRate, configs.time *60*1000, cid, 1+(getPlayerExtraExpRate(cid)/100-(configs.addrate/100)))
doPlayerSendTextMessage(cid, 25, "Voce vai receber o dobro de exp durante meia hora.")
doPlayerSetStorageValue(cid, 43891, os.time()+120)
setPlayerStorageValue(cid, 55489, os.time() + (1*24*60*60))
setPlayerStorageValue(cid, 62165, os.time())
creatureEvent(setPlayerStorageValue, configs.time *60*1000, cid, 62165, 0)
return TRUE
]]></action>




<creaturescript type="login" name="ExpPotionBlood" event="script"><![CDATA[
domodlib('PotionExpBloodConfigs')
local time = configs.time
    if os.time()-getPlayerStorageValue(cid, 62165) < time *60 then
       doPlayerSetExperienceRate(cid, (1+(configs.addrate/100))+(getPlayerExtraExpRate(cid)/100))
       creatureEvent(doPlayerSetExperienceRate, (time*60-(os.time()-getPlayerStorageValue(cid, 62165))) * 1000, cid, 1+(getPlayerExtraExpRate(cid)/100-(configs.addrate/100)))
       creatureEvent(setPlayerStorageValue, (time*60-(os.time()-getPlayerStorageValue(cid, 62165))) * 1000 , cid, 62165, 0)




       for i = (time*60-(os.time()-getPlayerStorageValue(cid, 62165))), 1, -1 do
       local a = math.floor(i/60) .. ":" .. i - (60 * math.floor(i/60))
       if #a < 4 then
       a = string.sub(a,1,2) .. "0" .. string.sub(a, 3)
       end
       if i == (time*60-(os.time()-getPlayerStorageValue(cid, 62165))) then
       creatureEvent(doPlayerSendCancel, (time*60-(os.time()-getPlayerStorageValue(cid, 62165)))*1000, cid, "O efeito da exp potion acabou.")
       end
       creatureEvent(doPlayerSendCancel, ((time*60-(os.time()-getPlayerStorageValue(cid, 62165)))-i)*1000, cid, "O efeito da exp potion vai acabar em "..a..".")
       end
    end
return TRUE
]]></creaturescript>
</mod>

Editado por AnaPaula (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.

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.6k

Informação Importante

Confirmação de Termo