Postado Abril 16, 2017 8 anos Olá, gostaria de uma modificação se possível no script abaixo, caso o char deslogue ou morra, não perca o seu uso, no caso, ele continue recebendo a experiencia dobrada até o termino dos minutos. mod.xml <?xml version="1.0" encoding="UTF-8"?> <mod name="AdvancedExpPotionSystem" enabled="yes" author="MatheusMkalo" forum="XTibia.com"> <!-- Configs and Functions --> <config name="PotionExpConfigs"><![CDATA[ ------ CONFIGURE SEU SCRIPT ------ TRUE ou FALSE configs = { time = 30, ---- TIME IN MINUTES needpa = TRUE, needlvl = {TRUE, level = 1500}, costmana = {TRUE, mana = 500}, addrate = 100, -- Exp que vai adicionar em % removeonuse = TRUE } 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> <!-- exppotion.lua --> <action itemid="12328" event="script"><![CDATA[ domodlib('PotionExpConfigs') if getPlayerStorageValue(cid, 49016) >= 1 then return doPlayerSendCancel(cid, "Voce ja esta sobre efeito de uma double exp potion.") end if configs.needpa and not isPremium(cid) then return doPlayerSendCancel(cid, "Voce precisar ser premium para usar.") end if configs.needlvl[1] and getPlayerLevel(cid) < configs.needlvl.level then return doPlayerSendCancel(cid, "Voce precisa ser " .. configs.needlvl.level .. " para usar a double exp potion.") end if configs.costmana[1] then if getCreatureMana(cid) < configs.costmana.mana then return doPlayerSendCancel(cid, "Voce precisar ter " .. configs.costmana.mana .. " de mana para usar a double exp potion.") else doCreatureAddMana(cid, -configs.costmana.mana) end end if configs.removeonuse 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, "Efeito Final da double exp potion.") end creatureEvent(doPlayerSendCancel, (configs.time*60-i)*1000, cid, "O efeito da double exp potion vai acabar 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, 22, "Agora voce esta com a experiencia dobrada.") setPlayerStorageValue(cid, 49016, os.time()) creatureEvent(setPlayerStorageValue, configs.time *60*1000, cid, 49016, 0) return TRUE ]]></action> <creaturescript type="login" name="ExpPotion" event="script"><![CDATA[ domodlib('PotionExpConfigs') local time = configs.time if os.time()-getPlayerStorageValue(cid, 49016) < time *60 then doPlayerSetExperienceRate(cid, (1+(configs.addrate/100))+(getPlayerExtraExpRate(cid)/100)) creatureEvent(doPlayerSetExperienceRate, (time*60-(os.time()-getPlayerStorageValue(cid, 49016))) * 1000, cid, 1+(getPlayerExtraExpRate(cid)/100-(configs.addrate/100))) creatureEvent(setPlayerStorageValue, (time*60-(os.time()-getPlayerStorageValue(cid, 49016))) * 1000 , cid, 49016, 0) for i = (time*60-(os.time()-getPlayerStorageValue(cid, 49016))), 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, 49016))) then creatureEvent(doPlayerSendCancel, (time*60-(os.time()-getPlayerStorageValue(cid, 49016)))*1000, cid, "O efeito da double exp potion termina em.") end creatureEvent(doPlayerSendCancel, ((time*60-(os.time()-getPlayerStorageValue(cid, 49016)))-i)*1000, cid, "o efeito da double exp potion termina em "..a..".") end end return TRUE ]]></creaturescript> </mod> creaturescript.lua function onLogout(cid) local stor = 49016 local expfinal = 1 if getPlayerStorageValue(cid, stor) >= 1 then setPlayerStorageValue(cid, stor, 0) doPlayerSetExperienceRate(cid,expfinal) else end return true end creaturescripts/perderefeito.xml <event type="logout" name="perderefeito" event="script" value="perderefeito.lua"/> creaturescripts/login.lua registerCreatureEvent(cid, "perdereifeto") (1º) | [8.60] - Galaxy Server - Download (2º) | [8.60] - Glorious Server - Download (3º) | [8.60] - Epic Server - Download
Postado Abril 16, 2017 8 anos Solução Quando o playere desloga, o script logout entra em ação. Deleta esse creaturescript <event type="logout" name="perderefeito" event="script" value="perderefeito.lua"/> e o script referente a ele tbm, alem de tirar o registro do login.lua GitHub: https://github.com/s3kk Conteúdo: [SERVER] Heromassa[GESIOR] Gesior 2012 modificado por Sekk[GESIOR] Shop Addons & Mounts - TFS 1.x[GESIOR] Outfitter para Characters e Rank[SISTEMA] Castle 24h[TALKACTION] Multi Element Wand[ACTION] Multi Elemental Arrow & Shield[PROGRAMAÇÃO] Compilar TFS 0.4 no Linux[PROGRAMAÇÃO] Compilando TFS 0.4 no MSVC(x64 e x32) [INFRAESTRUTURA] Configuração COMPLETA Google VM + Tibia 11.x
Postado Abril 17, 2017 8 anos Autor Obrigado meu querido! (1º) | [8.60] - Galaxy Server - Download (2º) | [8.60] - Glorious Server - Download (3º) | [8.60] - Epic Server - Download
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.