Ir para conteúdo
  • Cadastre-se

(Resolvido)como coloco pra nao usar esse item na PZ?


Ir para solução Resolvido por Storm,

Posts Recomendados

Diga em poucas palavras a base utilizada (Nome do servidor ou nome do website).

TFS 0.4

Base: 

Queria colocar esse script de exp potion pra NAO usar na protection zone, alguem sabe colocar? grato

<?xml version="1.0" encoding="UTF-8"?>
<mod name="AdvancedExpPotionSystem" enabled="yes" author="MatheusMkalo" forum="TibiaKing.com">
<!-- Configs and Functions -->
<config name="PotionExpConfigs50"><![CDATA[
------ CONFIGURE SEU SCRIPT ------ TRUE ou FALSE
configs = {
time = 30, ---- TIME IN MINUTES
needpa = FALSE,
needlvl = {TRUE, level = 1},
costmana = {FALSE, mana = 10},
addrate = 25, -- 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="6544" event="script"><![CDATA[
domodlib('PotionExpConfigs50')
if getPlayerStorageValue(cid, 49015) >= 1 then
doSendMagicEffect(getPlayerPosition(cid), 2)
    return doCreatureSay(cid, "[Error] So pode usar 1 EXP POT por vez.", TALKTYPE_ORANGE_1)
end
if configs.needpa and not isPremium(cid) then
    return doPlayerSendCancel(cid, "You need to be a premmium account to use this item.")
end
if configs.needlvl[1] and getPlayerLevel(cid) < configs.needlvl.level then
    return doPlayerSendCancel(cid, "You need to be level " .. configs.needlvl.level .. " to use this item.")
end
if configs.costmana[1] then
if getCreatureMana(cid) < configs.costmana.mana then
    return doPlayerSendCancel(cid, "You need " .. configs.costmana.mana .. " mana to use this item.")
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, "The effect of the exp potion end.")
end
creatureEvent(doPlayerSendCancel, (configs.time*60-i)*1000, cid, "[Exp +25%], o efeito acabara 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)))
doCreatureSay(cid, "EXP POTION Ativada, voce ganhou um bonus de EXP [+25%] por 30 minutos.", TALKTYPE_ORANGE_1)
doSendMagicEffect(getPlayerPosition(cid), 21)
setPlayerStorageValue(cid, 49015, os.time())
creatureEvent(setPlayerStorageValue, configs.time *60*1000, cid, 49015, 0)
return TRUE
]]></action>
<creaturescript type="login" name="ExpPotion" event="script"><![CDATA[
domodlib('PotionExpConfigs50')
local time = configs.time
    if os.time()-getPlayerStorageValue(cid, 49015) < time *60 then
	   doPlayerSetExperienceRate(cid, (1+(configs.addrate/100))+(getPlayerExtraExpRate(cid)/100))
	   creatureEvent(doPlayerSetExperienceRate, (time*60-(os.time()-getPlayerStorageValue(cid, 49015))) * 1000, cid, 1+(getPlayerExtraExpRate(cid)/100-(configs.addrate/100)))
	   creatureEvent(setPlayerStorageValue, (time*60-(os.time()-getPlayerStorageValue(cid, 49015))) * 1000 , cid, 49015, 0)
	   for i = (time*60-(os.time()-getPlayerStorageValue(cid, 49015))), 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, 49015))) then
	   creatureEvent(doPlayerSendCancel, (time*60-(os.time()-getPlayerStorageValue(cid, 49015)))*1000, cid, "The effect of the exp potion end.")
	   end
	   creatureEvent(doPlayerSendCancel, ((time*60-(os.time()-getPlayerStorageValue(cid, 49015)))-i)*1000, cid, "+25% de experiencia!, o efeito acabara em "..a..".")
	   end
    end
return TRUE
]]></creaturescript>
</mod>

 

Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui.

Link para o post
Compartilhar em outros sites
  • Solução
<?xml version="1.0" encoding="UTF-8"?>
<mod name="AdvancedExpPotionSystem" enabled="yes" author="MatheusMkalo" forum="TibiaKing.com">
<!-- Configs and Functions -->
<config name="PotionExpConfigs50"><![CDATA[
------ CONFIGURE SEU SCRIPT ------ TRUE ou FALSE
configs = {
time = 30, ---- TIME IN MINUTES
needpa = FALSE,
needlvl = {TRUE, level = 1},
costmana = {FALSE, mana = 10},
addrate = 25, -- 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="6544" event="script"><![CDATA[
domodlib('PotionExpConfigs50')

if getTilePzInfo(getCreaturePosition(cid)) then
doSendMagicEffect(getPlayerPosition(cid), 2)
return doCreatureSay(cid, "[Error] nao pode usar em pz", TALKTYPE_ORANGE_1)
end
if getPlayerStorageValue(cid, 49015) >= 1 then
doSendMagicEffect(getPlayerPosition(cid), 2)
    return doCreatureSay(cid, "[Error] So pode usar 1 EXP POT por vez.", TALKTYPE_ORANGE_1)
end
if configs.needpa and not isPremium(cid) then
    return doPlayerSendCancel(cid, "You need to be a premmium account to use this item.")
end
if configs.needlvl[1] and getPlayerLevel(cid) < configs.needlvl.level then
    return doPlayerSendCancel(cid, "You need to be level " .. configs.needlvl.level .. " to use this item.")
end
if configs.costmana[1] then
if getCreatureMana(cid) < configs.costmana.mana then
    return doPlayerSendCancel(cid, "You need " .. configs.costmana.mana .. " mana to use this item.")
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, "The effect of the exp potion end.")
end
creatureEvent(doPlayerSendCancel, (configs.time*60-i)*1000, cid, "[Exp +25%], o efeito acabara 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)))
doCreatureSay(cid, "EXP POTION Ativada, voce ganhou um bonus de EXP [+25%] por 30 minutos.", TALKTYPE_ORANGE_1)
doSendMagicEffect(getPlayerPosition(cid), 21)
setPlayerStorageValue(cid, 49015, os.time())
creatureEvent(setPlayerStorageValue, configs.time *60*1000, cid, 49015, 0)
return TRUE
]]></action>
<creaturescript type="login" name="ExpPotion" event="script"><![CDATA[
domodlib('PotionExpConfigs50')
local time = configs.time
    if os.time()-getPlayerStorageValue(cid, 49015) < time *60 then
	   doPlayerSetExperienceRate(cid, (1+(configs.addrate/100))+(getPlayerExtraExpRate(cid)/100))
	   creatureEvent(doPlayerSetExperienceRate, (time*60-(os.time()-getPlayerStorageValue(cid, 49015))) * 1000, cid, 1+(getPlayerExtraExpRate(cid)/100-(configs.addrate/100)))
	   creatureEvent(setPlayerStorageValue, (time*60-(os.time()-getPlayerStorageValue(cid, 49015))) * 1000 , cid, 49015, 0)
	   for i = (time*60-(os.time()-getPlayerStorageValue(cid, 49015))), 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, 49015))) then
	   creatureEvent(doPlayerSendCancel, (time*60-(os.time()-getPlayerStorageValue(cid, 49015)))*1000, cid, "The effect of the exp potion end.")
	   end
	   creatureEvent(doPlayerSendCancel, ((time*60-(os.time()-getPlayerStorageValue(cid, 49015)))-i)*1000, cid, "+25% de experiencia!, o efeito acabara em "..a..".")
	   end
    end
return TRUE
]]></creaturescript>
</mod>

 

Link para o post
Compartilhar em outros sites
11 minutos atrás, poko360 disse:

funcionou perfeitamente, obrigado, poderia me falar onde voce alterou? eu tenho outros 3 script pra colocar isso tambem

 

Basta usar:

if getTilePzInfo(getCreaturePosition(cid)) then
doSendMagicEffect(getPlayerPosition(cid), 2)
return doCreatureSay(cid, "[Error] nao pode usar em pz", TALKTYPE_ORANGE_1)
end

antes de iniciar a ação.

Esse código checa se o player está em pz, se estiver ele envia a mensagem de erro, se não estiver executa a ação.

Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo