• 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!

Solved BUG in item

TopllDan

Football <3
Joined
May 14, 2015
Messages
66
Reaction score
0
Hello boost has a stone in my server that is a bug and I hope you help me

I have a stone to use in Pokémon, it's normal functioning the only problem is that no matter where I give use the item, type if I click on the item and use goes down the effect will work on pokemon that are in the slot.

But I wanted the stone effect only worked if I used the item in the ball and not how it is that I can use on anything that the effect works on pokemon that is the main slot

script boost stone

Code:
function onUse(cid, item, fromPosition, item2, toPosition)
    local myball = getPlayerSlotItem(cid, 8)
    local boost = getItemAttribute(myball.uid, "boost") or 0
    local boosts = 10

    if boost == 70 then
        doPlayerSendCancel(cid, "Seu pokemon está no lvl máximo.")
    return true
    end

    if #getCreatureSummons(cid) >= 1 then
        return doPlayerSendCancel(cid, "Retorne seu pokemon para poder usar a boost stone.")
    end
   
    if getPlayerSlotItem(cid, 8).uid <= 0 then
        return doPlayerSendCancel(cid, "Seu pokemon não está no slot principal.")
    end

   
        boosts = boosts
        local pokemon = getItemAttribute(myball.uid, "poke")
        local off = pokes[pokemon].offense * boost_rate * boosts
        local def = pokes[pokemon].defense * boost_rate * boosts
        local agi = pokes[pokemon].agility * boosts
        local spatk = pokes[pokemon].specialattack * boost_rate * boosts
        local vit = pokes[pokemon].vitality * boost_rate * boosts
        newBoost = boost + boosts
       
        if newBoost > 70 then
            newBoost = 70
        end
       
        doSetItemAttribute(myball.uid, "boost", newBoost)
        doItemSetAttribute(myball.uid, "offense", getItemAttribute(myball.uid, "offense") + off)
        doItemSetAttribute(myball.uid, "defense", getItemAttribute(myball.uid, "defense") + def)
        doItemSetAttribute(myball.uid, "speed", getItemAttribute(myball.uid, "speed") + agi)
        doItemSetAttribute(myball.uid, "specialattack", getItemAttribute(myball.uid, "specialattack") + spatk)
        doItemSetAttribute(myball.uid, "vitality", getItemAttribute(myball.uid, "vitality") + vit)
        doRemoveItem(item.uid, 1)
        doSendMagicEffect(getThingPos(item2.uid), 103)
        doPlayerSendTextMessage(cid, 27, "Parabéns, o seu "..pokemon..", foi bostado +"..boosts..".")
        doPlayerSendTextMessage(cid, 27, "Agora, o seu "..pokemon.." está bostado +"..newBoost..".")
        doSendAnimatedText(getThingPos(item2.uid), "+"..boosts.." Boost", 215)
return true 
end

when I'm using anywhere and do not have pokemon in the main slot give this error ai

Code:
[31/07/2015 18:29:45] [Error - Action Interface] 
[31/07/2015 18:29:45] data/actions/scripts/booststone.lua:onUse
[31/07/2015 18:29:45] Description: 
[31/07/2015 18:29:45] (luaGetItemAttribute) Item not found

[31/07/2015 18:29:54] [Error - Action Interface] 
[31/07/2015 18:29:54] data/actions/scripts/booststone.lua:onUse
[31/07/2015 18:29:54] Description: 

[31/07/2015 18:29:54] (luaGetItemAttribute) Item not found
 
Code:
function onUse(cid, item, fromPosition, item2, toPosition)
    local myball = getPlayerSlotItem(cid, 8)
    local boost = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "boost") or 0
    local boosts = 10

    if boost == 70 then
        doPlayerSendCancel(cid, "Seu pokemon está no lvl máximo.")
    return true
    end

    if #getCreatureSummons(cid) >= 1 then
        return doPlayerSendCancel(cid, "Retorne seu pokemon para poder usar a boost stone.")
    end
 
    if getPlayerSlotItem(cid, 8).uid <= 0 then
        return doPlayerSendCancel(cid, "Seu pokemon não está no slot principal.")
    end

 
        boosts = boosts
        local pokemon = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "poke")
        local off = pokes[pokemon].offense * boost_rate * boosts
        local def = pokes[pokemon].defense * boost_rate * boosts
        local agi = pokes[pokemon].agility * boosts
        local spatk = pokes[pokemon].specialattack * boost_rate * boosts
        local vit = pokes[pokemon].vitality * boost_rate * boosts
        newBoost = boost + boosts
     
        if newBoost > 70 then
            newBoost = 70
        end
     
        doSetItemAttribute(myball.uid, "boost", newBoost)
        doItemSetAttribute(myball.uid, "offense", getItemAttribute(myball.uid, "offense") + off)
        doItemSetAttribute(myball.uid, "defense", getItemAttribute(myball.uid, "defense") + def)
        doItemSetAttribute(myball.uid, "speed", getItemAttribute(myball.uid, "speed") + agi)
        doItemSetAttribute(myball.uid, "specialattack", getItemAttribute(myball.uid, "specialattack") + spatk)
        doItemSetAttribute(myball.uid, "vitality", getItemAttribute(myball.uid, "vitality") + vit)
        doRemoveItem(item.uid, 1)
        doSendMagicEffect(getThingPos(item2.uid), 103)
        doPlayerSendTextMessage(cid, 27, "Parabéns, o seu "..pokemon..", foi bostado +"..boosts..".")
        doPlayerSendTextMessage(cid, 27, "Agora, o seu "..pokemon.." está bostado +"..newBoost..".")
        doSendAnimatedText(getThingPos(item2.uid), "+"..boosts.." Boost", 215)
return true
end
 
Code:
function onUse(cid, item, fromPosition, item2, toPosition)
    local myball = getPlayerSlotItem(cid, 8)
    local boost = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "boost") or 0
    local boosts = 10

    if boost == 70 then
        doPlayerSendCancel(cid, "Seu pokemon está no lvl máximo.")
    return true
    end

    if #getCreatureSummons(cid) >= 1 then
        return doPlayerSendCancel(cid, "Retorne seu pokemon para poder usar a boost stone.")
    end

    if getPlayerSlotItem(cid, 8).uid <= 0 then
        return doPlayerSendCancel(cid, "Seu pokemon não está no slot principal.")
    end


        boosts = boosts
        local pokemon = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "poke")
        local off = pokes[pokemon].offense * boost_rate * boosts
        local def = pokes[pokemon].defense * boost_rate * boosts
        local agi = pokes[pokemon].agility * boosts
        local spatk = pokes[pokemon].specialattack * boost_rate * boosts
        local vit = pokes[pokemon].vitality * boost_rate * boosts
        newBoost = boost + boosts
    
        if newBoost > 70 then
            newBoost = 70
        end
    
        doSetItemAttribute(myball.uid, "boost", newBoost)
        doItemSetAttribute(myball.uid, "offense", getItemAttribute(myball.uid, "offense") + off)
        doItemSetAttribute(myball.uid, "defense", getItemAttribute(myball.uid, "defense") + def)
        doItemSetAttribute(myball.uid, "speed", getItemAttribute(myball.uid, "speed") + agi)
        doItemSetAttribute(myball.uid, "specialattack", getItemAttribute(myball.uid, "specialattack") + spatk)
        doItemSetAttribute(myball.uid, "vitality", getItemAttribute(myball.uid, "vitality") + vit)
        doRemoveItem(item.uid, 1)
        doSendMagicEffect(getThingPos(item2.uid), 103)
        doPlayerSendTextMessage(cid, 27, "Parabéns, o seu "..pokemon..", foi bostado +"..boosts..".")
        doPlayerSendTextMessage(cid, 27, "Agora, o seu "..pokemon.." está bostado +"..newBoost..".")
        doSendAnimatedText(getThingPos(item2.uid), "+"..boosts.." Boost", 215)
return true
end

is the same way and when I click somewhere with the item give this error ai
Code:
[31/07/2015 21:12:04] [Error - Action Interface] 
[31/07/2015 21:12:04] data/actions/scripts/booststone.lua:onUse
[31/07/2015 21:12:04] Description: 
[31/07/2015 21:12:04] (luaGetItemAttribute) Item not found

[31/07/2015 21:12:11] [Error - Action Interface] 
[31/07/2015 21:12:11] data/actions/scripts/booststone.lua:onUse
[31/07/2015 21:12:11] Description: 
[31/07/2015 21:12:11] (luaGetItemAttribute) Item not found

[31/07/2015 21:12:15] [Error - Action Interface] 
[31/07/2015 21:12:15] data/actions/scripts/booststone.lua:onUse
[31/07/2015 21:12:15] Description: 
[31/07/2015 21:12:15] (luaGetItemAttribute) Item not found
[31/07/2015 21:12:23] Blastoise ball has been created by [GOD]Ticho.

[31/07/2015 21:12:26] [Error - Action Interface] 
[31/07/2015 21:12:26] data/actions/scripts/booststone.lua:onUse
[31/07/2015 21:12:26] Description: 
[31/07/2015 21:12:26] (luaGetItemAttribute) Item not found
[31/07/2015 21:12:42] [GOD]Ticho has logged out.
 
Code:
function onUse(cid, item, fromPosition, item2, toPosition)
    local myball = getPlayerSlotItem(cid, 8)
    local boost = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "boost") or 0
    local boosts = 10

    if boost == 70 then
        doPlayerSendCancel(cid, "Seu pokemon está no lvl máximo.")
    return true
    end

    if #getCreatureSummons(cid) >= 1 then
        return doPlayerSendCancel(cid, "Retorne seu pokemon para poder usar a boost stone.")
    end
    if getPlayerSlotItem(cid, 8).uid <= 0 then
        return doPlayerSendCancel(cid, "Seu pokemon não está no slot principal.")
    end

        boosts = boosts
        local pokemon = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "poke")
        local off = pokes[getItemAttribute(getPlayerSlotItem(cid, 8).uid, "poke")].offense * boost_rate * boosts
        local def = pokes[getItemAttribute(getPlayerSlotItem(cid, 8).uid, "poke")].defense * boost_rate * boosts
        local agi = pokes[getItemAttribute(getPlayerSlotItem(cid, 8).uid, "poke")].agility * boosts
        local spatk = pokes[getItemAttribute(getPlayerSlotItem(cid, 8).uid, "poke")].specialattack * boost_rate * boosts
        local vit = pokes[getItemAttribute(getPlayerSlotItem(cid, 8).uid, "poke")].vitality * boost_rate * boosts
        newBoost = boost + boosts
    
        if newBoost > 70 then
            newBoost = 70
        end
    
        doSetItemAttribute(myball.uid, "boost", newBoost)
        doItemSetAttribute(myball.uid, "offense", getItemAttribute(myball.uid, "offense") + off)
        doItemSetAttribute(myball.uid, "defense", getItemAttribute(myball.uid, "defense") + def)
        doItemSetAttribute(myball.uid, "speed", getItemAttribute(myball.uid, "speed") + agi)
        doItemSetAttribute(myball.uid, "specialattack", getItemAttribute(myball.uid, "specialattack") + spatk)
        doItemSetAttribute(myball.uid, "vitality", getItemAttribute(myball.uid, "vitality") + vit)
        doRemoveItem(item.uid, 1)
        doSendMagicEffect(getThingPos(item2.uid), 103)
        doPlayerSendTextMessage(cid, 27, "Parabéns, o seu "..pokemon..", foi bostado +"..boosts..".")
        doPlayerSendTextMessage(cid, 27, "Agora, o seu "..pokemon.." está bostado +"..newBoost..".")
        doSendAnimatedText(getThingPos(item2.uid), "+"..boosts.." Boost", 215)
return true
end
 
Code:
function onUse(cid, item, fromPosition, item2, toPosition)
    local myball = getPlayerSlotItem(cid, 8)
    local boost = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "boost") or 0
    local boosts = 10

    if boost == 70 then
        doPlayerSendCancel(cid, "Seu pokemon está no lvl máximo.")
    return true
    end

    if #getCreatureSummons(cid) >= 1 then
        return doPlayerSendCancel(cid, "Retorne seu pokemon para poder usar a boost stone.")
    end
    if getPlayerSlotItem(cid, 8).uid <= 0 then
        return doPlayerSendCancel(cid, "Seu pokemon não está no slot principal.")
    end

        boosts = boosts
        local pokemon = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "poke")
        local off = pokes[getItemAttribute(getPlayerSlotItem(cid, 8).uid, "poke")].offense * boost_rate * boosts
        local def = pokes[getItemAttribute(getPlayerSlotItem(cid, 8).uid, "poke")].defense * boost_rate * boosts
        local agi = pokes[getItemAttribute(getPlayerSlotItem(cid, 8).uid, "poke")].agility * boosts
        local spatk = pokes[getItemAttribute(getPlayerSlotItem(cid, 8).uid, "poke")].specialattack * boost_rate * boosts
        local vit = pokes[getItemAttribute(getPlayerSlotItem(cid, 8).uid, "poke")].vitality * boost_rate * boosts
        newBoost = boost + boosts
  
        if newBoost > 70 then
            newBoost = 70
        end
  
        doSetItemAttribute(myball.uid, "boost", newBoost)
        doItemSetAttribute(myball.uid, "offense", getItemAttribute(myball.uid, "offense") + off)
        doItemSetAttribute(myball.uid, "defense", getItemAttribute(myball.uid, "defense") + def)
        doItemSetAttribute(myball.uid, "speed", getItemAttribute(myball.uid, "speed") + agi)
        doItemSetAttribute(myball.uid, "specialattack", getItemAttribute(myball.uid, "specialattack") + spatk)
        doItemSetAttribute(myball.uid, "vitality", getItemAttribute(myball.uid, "vitality") + vit)
        doRemoveItem(item.uid, 1)
        doSendMagicEffect(getThingPos(item2.uid), 103)
        doPlayerSendTextMessage(cid, 27, "Parabéns, o seu "..pokemon..", foi bostado +"..boosts..".")
        doPlayerSendTextMessage(cid, 27, "Agora, o seu "..pokemon.." está bostado +"..newBoost..".")
        doSendAnimatedText(getThingPos(item2.uid), "+"..boosts.." Boost", 215)
return true
end

same mistake and still giving use anywhere :(

this script is another stone else can help

Code:
local evo = {
["Charizard"] = {"Shiny Charizard", 1},
["Venusaur"] = {"Shiny Venusaur", 1},
["Blastoise"] = {"Shiny Blastoise", 1},
["Butterfree"] = {"Shiny Butterfree", 1},
["Beedrill"] = {"Shiny Beedrill", 1},
["Pidgeot"] = {"Shiny Pidgeot", 1},
["Raticate"] = {"Shiny Raticate", 1},
["Fearow"] = {"Shiny Fearow", 1},
["Pikachu"] = {"Shiny Pikachu", 1},
["Raichu"] = {"Shiny Raichu", 1},
["Nidoking"] = {"Shiny Nidoking", 1},
["Ninetales"] = {"Shiny Ninetales", 1},
["Golbat"] = {"Shiny Golbat", 1},
["Vileplume"] = {"Shiny Vileplume", 1},
["Parasect"] = {"Shiny Parasect", 1},
["Venomoth"] = {"Shiny Venomoth", 1},
["Arcanine"] = {"Shiny Arcanine", 1},
["Alakazam"] = {"Shiny Alakazam", 1},
["Tentacruel"] = {"Shiny Tentacruel", 1},
["Golem"] = {"Shiny Golem", 1},
["Farfetch'd"] = {"Shiny Farfetch'd", 1},
["Muk"] = {"Shiny Muk", 1},
["Gengar"] = {"Shiny Gengar", 1},
["Onix"] = {"Shiny Onix", 1},
["Hypno"] = {"Shiny Hypno", 1},
["Kingler"] = {"Shiny Kingler", 1},
["Electrode"] = {"Shiny Electrode", 1},
["Cubone"] = {"Shiny Cubone", 1},
["Marowak"] = {"Shiny Marowak", 1},
["Hitmonlee"] = {"Shiny Hitmonlee", 1},
["Hitmonchan"] = {"Shiny Hitmonchan", 1},
["Hitmontop"] = {"Shiny Hitmontop", 1},
["Scyther"] = {"Shiny Scyther", 1},
["Jynx"] = {"Shiny Jynx", 1},
["Electabuzz"] = {"Shiny Electabuzz", 1},
["Gyarados"] = {"Shiny Gyarados", 1},
["Vaporeon"] = {"Shiny Vaporeon", 1},
["Jolteon"] = {"Shiny Jolteon", 1},
["Flareon"] = {"Shiny Flareon", 1},
["Snorlax"] = {"Shiny Snorlax", 1},
["Dragonite"] = {"Shiny Dragonite", 1},
["Mr. Mime"] = {"Shiny Mr. Mime", 1},
["Rhydon"] = {"Shiny Rhydon", 1},
["Magneton"] = {"Shiny Magneton", 1},
["Espeon"] = {"Shiny Espeon", 1},
["Umbreon"] = {"Shiny Umbreon", 1},
["Meganium"] = {"Shiny Meganium", 1},
["Feraligatr"] = {"Shiny Feraligatr", 1},
["Typhlosion"] = {"Shiny Typhlosion", 1},
["Aerodactyl"] = {"Shiny Aerodactyl", 1},
["Rhyperior"] = {"Shiny Rhyperior", 1},
["Larvitar"] = {"Shiny Larvitar", 1},
["Pupitar"] = {"Shiny Pupitar", 1},
["Tyranitar"] = {"Shiny Tyranitar", 1},
["Magmar"] = {"Shiny Magmar", 1},
["Magmortar"] = {"Shiny Magmortar", 1},
["Magby"] = {"Shiny Magby", 1},
["Absol"] = {"Shiny Absol", 1},
["Aggron"] = {"Shiny Aggron", 1},
["Elekid"] = {"Shiny Elekid", 1},
["Electivire"] = {"Shiny Electivire", 1},
["Tropius"] = {"Shiny Tropius", 1},
["Manectric"] = {"Shiny Manectric", 1},
["Metagross"] = {"Shiny Metagross", 1},
["Shiftry"] = {"Shiny Shiftry", 1},
["Salamence"] = {"Shiny Salamence", 1},
["Steelix"] = {"Shiny Steelix", 1},
}

local balls = {
[11827] = {newBall = 11738}, -- PokeBall
[11833] = {newBall = 11741}, -- GreatBall
[11836] = {newBall = 11744}, -- SuperBall
[11830] = {newBall = 11747}, -- UltraBall
[10976] = {newBall = 12622}, -- Saffari Ball
[11738] = {newBall = 11738}, -- Shiny Pokeball
[11741] = {newBall = 11741}, -- Shiny GreatBall
[11744] = {newBall = 11744}, -- Shiny SuperBall
[11747] = {newBall = 11747}, -- Shiny UltraBall
[12622] = {newBall = 12622}, -- Shiny Saffari Ball
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
local pokeball = getPlayerSlotItem(cid, 8)

if isMonster(itemEx.uid) and getCreatureMaster(itemEx.uid) == cid then
local monster = getCreatureName(itemEx.uid)

if not balls[pokeball.itemid] then

doPlayerSendCancel(cid, "Seu pokemon esta em uma pokebola invalida.")
return true
end

if evo[monster] then
if getPlayerItemCount(cid, item.itemid) >= evo[monster][2] then

doPlayerSendTextMessage(cid, 27, "Parabens! Seu "..getPokeName(itemEx.uid).." evoluiu para "..evo[monster][1].."!")
local health, maxHealth = getCreatureHealth(itemEx.uid), getCreatureMaxHealth(itemEx.uid)
doSendMagicEffect(getThingPos(itemEx.uid), 242)
doRemoveCreature(itemEx.uid)
doPlayerRemoveItem(cid, item.itemid, evo[monster][2]-1)
doRemoveItem(item.uid, 1)
doSummonMonster(cid,evo[monster][1])
doItemSetAttribute(pokeball.uid, "poke", evo[monster][1])
doItemSetAttribute(pokeball.uid, "level", pokes[evo[monster][1]].level)
doItemSetAttribute(pokeball.uid, "hp", 1)
doItemSetAttribute(pokeball.uid, "happy", 110)
local pk = getCreatureSummons(cid)[1]
doTransformItem(pokeball.uid, balls[pokeball.itemid].newBall)
adjustStatus(pk, pokeball.uid, true, false, true)
return TRUE
else

return doPlayerSendTextMessage(cid, 27, "Voce precisa de pelo menos ".. evo[monster][2] .." stones para faze-lo vira shiny!")
end
end
end
return false
end
 
Code:
if getPlayerSlotItem(cid, 8).uid <= 0 then
      return doPlayerSendCancel(cid, "Seu pokemon não está no slot principal.")
end
This part should be above where getItemAttribute is used, since it reads the script from the top (under function onUse) to the bottom (end that closes the function), so it finds getItemAttribute first if it's above it.
 
Code:
if getPlayerSlotItem(cid, 8).uid <= 0 then
      return doPlayerSendCancel(cid, "Seu pokemon não está no slot principal.")
end
This part should be above where getItemAttribute is used, since it reads the script from the top (under function onUse) to the bottom (end that closes the function), so it finds getItemAttribute first if it's above it.

Sorry I do not quite understand because I am Brazilian and I speak Portuguese, can simplify or even make modifications to the script? thanks
 
What I posted is added in the script, but it's on the wrong place, it should be right under function onUse so it's above getItemAttribute.
 
Code:
function onUse(cid, item, fromPosition, item2, toPosition)
     -- add it here
     -- rest of the script
end
https://translate.google.com/

like that?

Code:
function onUse(cid, item, fromPosition, item2, toPosition)

    if getPlayerSlotItem(cid, 8).uid <= 0 then
        return doPlayerSendCancel(cid, "Seu pokemon não está no slot principal.")
    end

    local myball = getPlayerSlotItem(cid, 8)
    local boost = getItemAttribute(myball.uid, "boost") or 0
    local boosts = 10

    if boost == 70 then
        doPlayerSendCancel(cid, "Seu pokemon está no lvl máximo.")
    return true
    end

    if #getCreatureSummons(cid) >= 1 then
        return doPlayerSendCancel(cid, "Retorne seu pokemon para poder usar a boost stone.")
    end
  
        boosts = boosts
        local pokemon = getItemAttribute(myball.uid, "poke")
        local off = pokes[pokemon].offense * boost_rate * boosts
        local def = pokes[pokemon].defense * boost_rate * boosts
        local agi = pokes[pokemon].agility * boosts
        local spatk = pokes[pokemon].specialattack * boost_rate * boosts
        local vit = pokes[pokemon].vitality * boost_rate * boosts
        newBoost = boost + boosts
      
        if newBoost > 70 then
            newBoost = 70
        end
      
       if (boost + boosts) >= 50 or boost >= 50 then
            doItemSetAttribute(myball.uid, "aura", "white") 
        end
      
        doSetItemAttribute(myball.uid, "boost", newBoost)
        doItemSetAttribute(myball.uid, "offense", getItemAttribute(myball.uid, "offense") + off)
        doItemSetAttribute(myball.uid, "defense", getItemAttribute(myball.uid, "defense") + def)
        doItemSetAttribute(myball.uid, "speed", getItemAttribute(myball.uid, "speed") + agi)
        doItemSetAttribute(myball.uid, "specialattack", getItemAttribute(myball.uid, "specialattack") + spatk)
        doItemSetAttribute(myball.uid, "vitality", getItemAttribute(myball.uid, "vitality") + vit)
        doRemoveItem(item.uid, 1)
        doSendMagicEffect(getThingPos(item2.uid), 103)
        doPlayerSendTextMessage(cid, 27, "Parabéns, o seu "..pokemon..", foi bostado +"..boosts..".")
        doPlayerSendTextMessage(cid, 27, "Agora, o seu "..pokemon.." está bostado +"..newBoost..".")
        doSendAnimatedText(getThingPos(item2.uid), "+"..boosts.." Boost", 215)
return true
end

the error stopped happening, only that is still going on bug I give use with stone anywhere in the pokemon that are in the main slot will suffer the effect and I wanted to work only in the pokemon that the player gave use

thanks for helping to stop the error <3

Bump
 
Last edited by a moderator:
Code:
function onUse(cid, item, fromPosition, item2, toPosition)
    local myball = getPlayerSlotItem(cid, 8)
    local boost = getItemAttribute(myball.uid, "boost") or 0
    local boosts = 10
   
if getPlayerSlotItem(cid, 8).uid > 0 then
    if boost == 70 then
        doPlayerSendCancel(cid, "Seu pokemon está no lvl máximo.")
    return true
    end

    if #getCreatureSummons(cid) >= 1 then
        return doPlayerSendCancel(cid, "Retorne seu pokemon para poder usar a boost stone.")
    end

        boosts = boosts
        local pokemon = getItemAttribute(myball.uid, "poke")
        local off = pokes[pokemon].offense * boost_rate * boosts
        local def = pokes[pokemon].defense * boost_rate * boosts
        local agi = pokes[pokemon].agility * boosts
        local spatk = pokes[pokemon].specialattack * boost_rate * boosts
        local vit = pokes[pokemon].vitality * boost_rate * boosts
        newBoost = boost + boosts
      
        if newBoost > 70 then
            newBoost = 70
        end
      
        doSetItemAttribute(myball.uid, "boost", newBoost)
        doItemSetAttribute(myball.uid, "offense", getItemAttribute(myball.uid, "offense") + off)
        doItemSetAttribute(myball.uid, "defense", getItemAttribute(myball.uid, "defense") + def)
        doItemSetAttribute(myball.uid, "speed", getItemAttribute(myball.uid, "speed") + agi)
        doItemSetAttribute(myball.uid, "specialattack", getItemAttribute(myball.uid, "specialattack") + spatk)
        doItemSetAttribute(myball.uid, "vitality", getItemAttribute(myball.uid, "vitality") + vit)
        doRemoveItem(item.uid, 1)
        doSendMagicEffect(getThingPos(item2.uid), 103)
        doPlayerSendTextMessage(cid, 27, "Parabéns, o seu "..pokemon..", foi bostado +"..boosts..".")
        doPlayerSendTextMessage(cid, 27, "Agora, o seu "..pokemon.." está bostado +"..newBoost..".")
        doSendAnimatedText(getThingPos(item2.uid), "+"..boosts.." Boost", 215)
       
        else
       doPlayerSendCancel(cid, "Seu pokemon não está no slot principal.")
    end
return true
end
 
Code:
function onUse(cid, item, fromPosition, item2, toPosition)
    local myball = getPlayerSlotItem(cid, 8)
    local boost = getItemAttribute(myball.uid, "boost") or 0
    local boosts = 10
 
if getPlayerSlotItem(cid, 8).uid > 0 then
    if boost == 70 then
        doPlayerSendCancel(cid, "Seu pokemon está no lvl máximo.")
    return true
    end

    if #getCreatureSummons(cid) >= 1 then
        return doPlayerSendCancel(cid, "Retorne seu pokemon para poder usar a boost stone.")
    end

        boosts = boosts
        local pokemon = getItemAttribute(myball.uid, "poke")
        local off = pokes[pokemon].offense * boost_rate * boosts
        local def = pokes[pokemon].defense * boost_rate * boosts
        local agi = pokes[pokemon].agility * boosts
        local spatk = pokes[pokemon].specialattack * boost_rate * boosts
        local vit = pokes[pokemon].vitality * boost_rate * boosts
        newBoost = boost + boosts
    
        if newBoost > 70 then
            newBoost = 70
        end
    
        doSetItemAttribute(myball.uid, "boost", newBoost)
        doItemSetAttribute(myball.uid, "offense", getItemAttribute(myball.uid, "offense") + off)
        doItemSetAttribute(myball.uid, "defense", getItemAttribute(myball.uid, "defense") + def)
        doItemSetAttribute(myball.uid, "speed", getItemAttribute(myball.uid, "speed") + agi)
        doItemSetAttribute(myball.uid, "specialattack", getItemAttribute(myball.uid, "specialattack") + spatk)
        doItemSetAttribute(myball.uid, "vitality", getItemAttribute(myball.uid, "vitality") + vit)
        doRemoveItem(item.uid, 1)
        doSendMagicEffect(getThingPos(item2.uid), 103)
        doPlayerSendTextMessage(cid, 27, "Parabéns, o seu "..pokemon..", foi bostado +"..boosts..".")
        doPlayerSendTextMessage(cid, 27, "Agora, o seu "..pokemon.." está bostado +"..newBoost..".")
        doSendAnimatedText(getThingPos(item2.uid), "+"..boosts.." Boost", 215)
     
        else
       doPlayerSendCancel(cid, "Seu pokemon não está no slot principal.")
    end
return true
end

Code:
[01/08/2015 14:55:40] [Error - Action Interface]
[01/08/2015 14:55:40] data/actions/scripts/booststone.lua:eek:nUse
[01/08/2015 14:55:40] Description:
[01/08/2015 14:55:40] (luaGetItemAttribute) Item not found

[01/08/2015 14:55:41] [Error - Action Interface]
[01/08/2015 14:55:41] data/actions/scripts/booststone.lua:eek:nUse
[01/08/2015 14:55:41] Description:
[01/08/2015 14:55:41] (luaGetItemAttribute) Item not found

[01/08/2015 14:55:42] [Error - Action Interface]
[01/08/2015 14:55:42] data/actions/scripts/booststone.lua:eek:nUse
[01/08/2015 14:55:42] Description:
[01/08/2015 14:55:42] (luaGetItemAttribute) Item not found

[01/08/2015 14:55:43] [Error - Action Interface]
[01/08/2015 14:55:43] data/actions/scripts/booststone.lua:eek:nUse
[01/08/2015 14:55:43] Description:
[01/08/2015 14:55:43] (luaGetItemAttribute) Item not found

this script here's normal functioning without error the only problem is that is giving ainada use anywhere

Code:
function onUse(cid, item, fromPosition, item2, toPosition)

    if getPlayerSlotItem(cid, 8).uid <= 0 then
        return doPlayerSendCancel(cid, "Seu pokemon não está no slot principal.")
    end

    local myball = getPlayerSlotItem(cid, 8)
    local boost = getItemAttribute(myball.uid, "boost") or 0
    local boosts = 10

    if boost == 70 then
        doPlayerSendCancel(cid, "Seu pokemon está no lvl máximo.")
    return true
    end

    if #getCreatureSummons(cid) >= 1 then
        return doPlayerSendCancel(cid, "Retorne seu pokemon para poder usar a boost stone.")
    end
   
        boosts = boosts
        local pokemon = getItemAttribute(myball.uid, "poke")
        local off = pokes[pokemon].offense * boost_rate * boosts
        local def = pokes[pokemon].defense * boost_rate * boosts
        local agi = pokes[pokemon].agility * boosts
        local spatk = pokes[pokemon].specialattack * boost_rate * boosts
        local vit = pokes[pokemon].vitality * boost_rate * boosts
        newBoost = boost + boosts
       
        if newBoost > 70 then
            newBoost = 70
        end
       
       if (boost + boosts) >= 50 or boost >= 50 then
            doItemSetAttribute(myball.uid, "aura", "white")  
        end
       
        doSetItemAttribute(myball.uid, "boost", newBoost)
        doItemSetAttribute(myball.uid, "offense", getItemAttribute(myball.uid, "offense") + off)
        doItemSetAttribute(myball.uid, "defense", getItemAttribute(myball.uid, "defense") + def)
        doItemSetAttribute(myball.uid, "speed", getItemAttribute(myball.uid, "speed") + agi)
        doItemSetAttribute(myball.uid, "specialattack", getItemAttribute(myball.uid, "specialattack") + spatk)
        doItemSetAttribute(myball.uid, "vitality", getItemAttribute(myball.uid, "vitality") + vit)
        doRemoveItem(item.uid, 1)
        doSendMagicEffect(getThingPos(item2.uid), 103)
        doPlayerSendTextMessage(cid, 27, "Parabéns, o seu "..pokemon..", foi bostado +"..boosts..".")
        doPlayerSendTextMessage(cid, 27, "Agora, o seu "..pokemon.." está bostado +"..newBoost..".")
        doSendAnimatedText(getThingPos(item2.uid), "+"..boosts.." Boost", 215)
return true 
end
 
Solved thanks to Zipter98

solution:

Code:
function onUse(cid, item, fromPosition, item2, toPosition)
    local myball = getPlayerSlotItem(cid, 8)
    if myball.uid < 1 or item2.uid ~= myball.uid then
        return doPlayerSendCancel(cid, "Use this item on a pokeball in the pokeball slot.")
    end
    local boost = getItemAttribute(myball.uid, "boost") or 0
    local boosts = 10

    if boost == 70 then
        doPlayerSendCancel(cid, "Seu pokemon está no lvl máximo.")
        return true
    end

    if #getCreatureSummons(cid) >= 1 then
        return doPlayerSendCancel(cid, "Retorne seu pokemon para poder usar a boost stone.")
    end

    if getPlayerSlotItem(cid, 8).uid <= 0 then
        return doPlayerSendCancel(cid, "Seu pokemon não está no slot principal.")
    end


    boosts = boosts
    local pokemon = getItemAttribute(myball.uid, "poke")
    local off = pokes[pokemon].offense * boost_rate * boosts
    local def = pokes[pokemon].defense * boost_rate * boosts
    local agi = pokes[pokemon].agility * boosts
    local spatk = pokes[pokemon].specialattack * boost_rate * boosts
    local vit = pokes[pokemon].vitality * boost_rate * boosts
    newBoost = boost + boosts

    if newBoost > 70 then
        newBoost = 70
    end

    doSetItemAttribute(myball.uid, "boost", newBoost)
    doItemSetAttribute(myball.uid, "offense", getItemAttribute(myball.uid, "offense") + off)
    doItemSetAttribute(myball.uid, "defense", getItemAttribute(myball.uid, "defense") + def)
    doItemSetAttribute(myball.uid, "speed", getItemAttribute(myball.uid, "speed") + agi)
    doItemSetAttribute(myball.uid, "specialattack", getItemAttribute(myball.uid, "specialattack") + spatk)
    doItemSetAttribute(myball.uid, "vitality", getItemAttribute(myball.uid, "vitality") + vit)
    doRemoveItem(item.uid, 1)
    doSendMagicEffect(getThingPos(item2.uid), 103)
    doPlayerSendTextMessage(cid, 27, "Parabéns, o seu "..pokemon..", foi bostado +"..boosts..".")
    doPlayerSendTextMessage(cid, 27, "Agora, o seu "..pokemon.." está bostado +"..newBoost..".")
    doSendAnimatedText(getThingPos(item2.uid), "+"..boosts.." Boost", 215)
    return true 
end
 
Back
Top