Ir para conteúdo
  • 0

[PDA] Adicionar limite de level para usar o item.


Taiger

Pergunta

Ola amigos, algum scripter poderia adicionar limite de level para usar o revive do poketibia para 250, depois do lv 250 o player não poderia mais usar este item. Segue o script:

 

 

 

function onUse(cid, item, frompos, item2, topos)
if (item2.itemid == 13860 or item2.itemid == 13810) and (getPlayerGroupId(cid) < 4 or getPlayerGroupId(cid) > 6) then
doRemoveItem(item2.uid)
return true
end
if getPlayerStorageValue(cid, 990) >= 1 then
doPlayerSendCancel(cid, "You can't use revive during gym battles.")
return true
elseif getPlayerStorageValue(cid, 52481) >= 1 then
doPlayerSendCancel(cid, "You can't do that while a duel.") --alterado v1.6
return true
elseif isPlayer(item2.uid) then
doPlayerSendCancel(cid, "Please, use revive only on pokeballs.")
return true
end
if item2.uid ~= getPlayerSlotItem(cid, 8).uid then
return true
end
if item2.uid ~= getPlayerSlotItem(cid, 8).uid and not isInArray(getPokeballsInContainer(getPlayerSlotItem(cid, 3).uid), item2.uid) then
return true
end
for a, b in pairs (pokeballs) do
if not item2.itemid == b.on or not item2.itemid == b.off then
doPlayerSendCancel(cid, "Please, use revive only on pokeballs.")
return true
end
end
local pokeball = getPlayerSlotItem(cid, 8)
for a, b in pairs (pokeballs) do
if item2.itemid == b.on or item2.itemid == b.off then --edited deixei igual ao do PXG
doTransformItem(item2.uid, b.on)
doSetItemAttribute(item2.uid, "hp", 1)
for c = 1, 15 do
local str = "move"..c
setCD(item2.uid, str, 0)
end
setCD(item2.uid, "control", 0)
setCD(item2.uid, "blink", 0) --alterado v1.6
doSendMagicEffect(getThingPos(cid), 13)
doRemoveItem(item.uid, 1)
doCureBallStatus(getPlayerSlotItem(cid, 8).uid, "all")
doCureStatus(cid, "all", true)
cleanBuffs2(item2.uid) --alterado v1.5
--[[if getPlayerStorageValue(cid, storage) > 0 then
setPlayerStorageValue(cid, storage, getPlayerStorageValue(cid, storage)-1)
end--]]
return true
end
end
return true
end

Obrigado desde já.
Link para o comentário
Compartilhar em outros sites

5 respostass a esta questão

Posts Recomendados

  • 0

Tag:

 

<action itemid="12344;ID_do_outro_revive" event="script" value="revive.lua" blockwalls="1"/>

Código:

local revives = {
    [12344] = "1-199",        --[ID_do_revive] = "minLevel-maxLevel",
    [xxx] = "200-99999", 
}
function onUse(cid, item, frompos, item2, topos)
    if (item2.itemid == 13860 or item2.itemid == 13810) and (getPlayerGroupId(cid) < 4 or getPlayerGroupId(cid) > 6) then
        doRemoveItem(item2.uid)
        return true
    end
    if getPlayerStorageValue(cid, 990) >= 1 then
        doPlayerSendCancel(cid, "You can't use revive during gym battles.")
        return true
    elseif getPlayerStorageValue(cid, 52481) >= 1 then
        doPlayerSendCancel(cid, "You can't do that while a duel.") --alterado v1.6
        return true
    elseif isPlayer(item2.uid) then
        doPlayerSendCancel(cid, "Please, use revive only on pokeballs.")
        return true
    end
    if revives[item.itemid] then
        local level = revives[item.itemid]:explode("-")
        if getPlayerLevel(cid) < tonumber(level[1]) or getPlayerLevel(cid) > tonumber(level[2]) then
            return doPlayerSendCancel(cid, "You can't use this revive at this level.")
        end
    end
    if item2.uid ~= getPlayerSlotItem(cid, 8).uid then
        return true
    end
    if item2.uid ~= getPlayerSlotItem(cid, 8).uid and not isInArray(getPokeballsInContainer(getPlayerSlotItem(cid, 3).uid), item2.uid) then 
        return true 
    end
    for a, b in pairs (pokeballs) do
        if not item2.itemid == b.on or not item2.itemid == b.off then
            doPlayerSendCancel(cid, "Please, use revive only on pokeballs.")
            return true
        end
    end
 
    local pokeball = getPlayerSlotItem(cid, 8)
    for a, b in pairs (pokeballs) do
        if item2.itemid == b.on or item2.itemid == b.off then --edited deixei igual ao do PXG
            doTransformItem(item2.uid, b.on)
            doSetItemAttribute(item2.uid, "hp", 1)
            for c = 1, 15 do
                local str = "move"..c
                setCD(item2.uid, str, 0)
            end
            setCD(item2.uid, "control", 0)
            setCD(item2.uid, "blink", 0) --alterado v1.6
            doSendMagicEffect(getThingPos(cid), 13)
            doRemoveItem(item.uid, 1)
            doCureBallStatus(getPlayerSlotItem(cid, 8).uid, "all")
            doCureStatus(cid, "all", true)
            cleanBuffs2(item2.uid) --alterado v1.5
 
            --[[if getPlayerStorageValue(cid, storage) > 0 then
                setPlayerStorageValue(cid, storage, getPlayerStorageValue(cid, storage)-1)
            end--]]
            return true
        end
    end
    return true
end
Link para o comentário
Compartilhar em outros sites

  • 0

 

local level = 250
function onUse(cid, item, frompos, item2, topos)
    if (item2.itemid == 13860 or item2.itemid == 13810) and (getPlayerGroupId(cid) < 4 or getPlayerGroupId(cid) > 6) then
        doRemoveItem(item2.uid)
        return true
    end
    if getPlayerStorageValue(cid, 990) >= 1 then
        doPlayerSendCancel(cid, "You can't use revive during gym battles.")
        return true
    elseif getPlayerStorageValue(cid, 52481) >= 1 then
        doPlayerSendCancel(cid, "You can't do that while a duel.") --alterado v1.6
        return true
    elseif isPlayer(item2.uid) then
        doPlayerSendCancel(cid, "Please, use revive only on pokeballs.")
        return true
    elseif getPlayerLevel(cid) > level then
        return doPlayerSendCancel(cid, "You can't use this item at this level.")
    end
    if item2.uid ~= getPlayerSlotItem(cid, 8).uid then
        return true
    end
    if item2.uid ~= getPlayerSlotItem(cid, 8).uid and not isInArray(getPokeballsInContainer(getPlayerSlotItem(cid, 3).uid), item2.uid) then 
        return true 
    end
    for a, b in pairs (pokeballs) do
        if not item2.itemid == b.on or not item2.itemid == b.off then
            doPlayerSendCancel(cid, "Please, use revive only on pokeballs.")
            return true
        end
    end
 
    local pokeball = getPlayerSlotItem(cid, 8)
    for a, b in pairs (pokeballs) do
        if item2.itemid == b.on or item2.itemid == b.off then --edited deixei igual ao do PXG
            doTransformItem(item2.uid, b.on)
            doSetItemAttribute(item2.uid, "hp", 1)
            for c = 1, 15 do
                local str = "move"..c
                setCD(item2.uid, str, 0)
            end
            setCD(item2.uid, "control", 0)
            setCD(item2.uid, "blink", 0) --alterado v1.6
            doSendMagicEffect(getThingPos(cid), 13)
            doRemoveItem(item.uid, 1)
            doCureBallStatus(getPlayerSlotItem(cid, 8).uid, "all")
            doCureStatus(cid, "all", true)
            cleanBuffs2(item2.uid) --alterado v1.5
 
            --[[if getPlayerStorageValue(cid, storage) > 0 then
                setPlayerStorageValue(cid, storage, getPlayerStorageValue(cid, storage)-1)
            end--]]
            return true
        end
    end
    return true
end
Link para o comentário
Compartilhar em outros sites

  • 0

Obrigado zipter98, eu ja tinha acabado de conseguir aqui deste geito ó, ve se ta bom, funcionou certinho tb.

 

 

 

function onUse(cid, item, frompos, item2, topos)
if (item2.itemid == 13860 or item2.itemid == 13810) and (getPlayerGroupId(cid) < 4 or getPlayerGroupId(cid) > 6) then
doRemoveItem(item2.uid)
return true
end
if getPlayerLevel(cid) >= 200 then
doPlayerSendCancel(cid, "You can't use revive above lv 200+.")
return true
end
if getPlayerStorageValue(cid, 990) >= 1 then
doPlayerSendCancel(cid, "You can't use revive during gym battles.")
return true
elseif getPlayerStorageValue(cid, 52481) >= 1 then
doPlayerSendCancel(cid, "You can't do that while a duel.") --alterado v1.6
return true
elseif isPlayer(item2.uid) then
doPlayerSendCancel(cid, "Please, use revive only on pokeballs.")
return true
end
if item2.uid ~= getPlayerSlotItem(cid, 8).uid then
return true
end
if item2.uid ~= getPlayerSlotItem(cid, 8).uid and not isInArray(getPokeballsInContainer(getPlayerSlotItem(cid, 3).uid), item2.uid) then
return true
end
for a, b in pairs (pokeballs) do
if not item2.itemid == b.on or not item2.itemid == b.off then
doPlayerSendCancel(cid, "Please, use revive only on pokeballs.")
return true
end
end
local pokeball = getPlayerSlotItem(cid, 8)
for a, b in pairs (pokeballs) do
if item2.itemid == b.on or item2.itemid == b.off then --edited deixei igual ao do PXG
doTransformItem(item2.uid, b.on)
doSetItemAttribute(item2.uid, "hp", 1)
for c = 1, 15 do
local str = "move"..c
setCD(item2.uid, str, 0)
end
setCD(item2.uid, "control", 0)
setCD(item2.uid, "blink", 0) --alterado v1.6
doSendMagicEffect(getThingPos(cid), 13)
doRemoveItem(item.uid, 1)
doCureBallStatus(getPlayerSlotItem(cid, 8).uid, "all")
doCureStatus(cid, "all", true)
cleanBuffs2(item2.uid) --alterado v1.5
--[[if getPlayerStorageValue(cid, storage) > 0 then
setPlayerStorageValue(cid, storage, getPlayerStorageValue(cid, storage)-1)
end--]]
return true
end
end
return true
end


zipter pode me ajudar ainda nesse script? Tipow eu quero colocar os 2 revives em um só script, esse ai de cima, um revive normal q pode ser usado até o lv 199 e o max revive após lv 200, eu ia criar 1 scripts de revive para cada um, mais acho q da para colocar os 2 revives nesse mesmo script, não?

<action itemid="12344" event="script" value="revive.lua" blockwalls="1"/>

 

 

function onUse(cid, item, frompos, item2, topos)
if (item2.itemid == 13860 or item2.itemid == 13810) and (getPlayerGroupId(cid) < 4 or getPlayerGroupId(cid) > 6) then
doRemoveItem(item2.uid)
return true
end
if getPlayerLevel(cid) >= 200 then
doPlayerSendCancel(cid, "You can't use revive above lv 200+.")
return true
end
if getPlayerStorageValue(cid, 990) >= 1 then
doPlayerSendCancel(cid, "You can't use revive during gym battles.")
return true
elseif getPlayerStorageValue(cid, 52481) >= 1 then
doPlayerSendCancel(cid, "You can't do that while a duel.") --alterado v1.6
return true
elseif isPlayer(item2.uid) then
doPlayerSendCancel(cid, "Please, use revive only on pokeballs.")
return true
end
if item2.uid ~= getPlayerSlotItem(cid, 8).uid then
return true
end
if item2.uid ~= getPlayerSlotItem(cid, 8).uid and not isInArray(getPokeballsInContainer(getPlayerSlotItem(cid, 3).uid), item2.uid) then
return true
end
for a, b in pairs (pokeballs) do
if not item2.itemid == b.on or not item2.itemid == b.off then
doPlayerSendCancel(cid, "Please, use revive only on pokeballs.")
return true
end
end
local pokeball = getPlayerSlotItem(cid, 8)
for a, b in pairs (pokeballs) do
if item2.itemid == b.on or item2.itemid == b.off then --edited deixei igual ao do PXG
doTransformItem(item2.uid, b.on)
doSetItemAttribute(item2.uid, "hp", 1)
for c = 1, 15 do
local str = "move"..c
setCD(item2.uid, str, 0)
end
setCD(item2.uid, "control", 0)
setCD(item2.uid, "blink", 0) --alterado v1.6
doSendMagicEffect(getThingPos(cid), 13)
doRemoveItem(item.uid, 1)
doCureBallStatus(getPlayerSlotItem(cid, 8).uid, "all")
doCureStatus(cid, "all", true)
cleanBuffs2(item2.uid) --alterado v1.5
--[[if getPlayerStorageValue(cid, storage) > 0 then
setPlayerStorageValue(cid, storage, getPlayerStorageValue(cid, storage)-1)
end--]]
return true
end
end
return true
end

Desde ja agradeço.
Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...