Tente assim
local a = {
[13769] = {balltype = "ultra", ballid = 11829,
pokemons = {"Shiny Charizard"}},
}
function onUse(cid, item, frompos, item2, topos)
if getCreatureStorageValue(cid, 8465) == 1 then
return 0
end
local b = a[item.itemid]
if not b then return true end
local pokemon = b.pokemons[math.random(#b.pokemons)]
local btype = b.balltype
if not pokeballs[btype] then return true end
local gender = getRandomGenderByName(pokemon)
local happy = 220
local ball = 0
local sendToDepot = false --alterado v1.6
if getCreatureMana(cid) >= 6 or not hasSpaceInContainer(getPlayerSlotItem(cid, 3).uid) then
sendToDepot = true
ball = doCreateItemEx(b.ballid) --alterado v1.3
else
ball = item.uid
end
doItemSetAttribute(ball, "poke", pokemon)
doItemSetAttribute(ball, "hp", 1)
doItemSetAttribute(ball, "happy", happy)
doItemSetAttribute(ball, "gender", gender)
if pokemon == "Hitmonchan" or pokemon == "Shiny Hitmonchan" then
doItemSetAttribute(ball, "hands", 0)
end
doItemSetAttribute(ball, "description", "Contains a "..pokemon..".")
doItemSetAttribute(ball, "fakedesc", "Contains a "..pokemon..".")
doItemSetAttribute(ball, "boost", 50)
local nick = "".. getPlayerName(cid) ..""
local description = "Contains a "..getItemAttribute(ball, "poke").."."
doItemSetAttribute(ball, "nick", nick)
local newdes = description.."\nIt's nickname is: ".. getPlayerName(cid) .."."
doItemSetAttribute(ball, "description", newdes)
local hp = getItemAttribute(ball, "happy")
doItemSetAttribute(ball, "happy", hp + 25)
doPlayerSendTextMessage(cid, 27, "You opened a pokemon prize box +"..item.itemid - (11637).."!")
doPlayerSendTextMessage(cid, 27, "The prize pokemon was a "..pokemon..", congratulations!")
if sendToDepot then
doPlayerSendMailByName(getCreatureName(cid), ball, 1) --alterado v1.3
doPlayerSendTextMessage(cid, 27, "You are already holding six pokemons, so your new pokemon was sent to your depot.")
setPlayerStorageValue(cid, 85552, os.time () + 9999)
setPlayerStorageValue(cid, 8465, 1)
doRemoveItem(item.uid)
else
doTransformItem(ball,pokeballs[btype].on)
end
doSendMagicEffect(getThingPos(cid), 29)
return true
end







info
Grupo: Visconde
Registrado: 11/12/07
Posts: 332
Reputação: +11
local a = { [13769] = {balltype = "ultra", ballid = 11829, pokemons = {"Shiny Charizard"}}, } function onUse(cid, item, frompos, item2, topos) local b = a[item.itemid] if not b then return true end local pokemon = b.pokemons[math.random(#b.pokemons)] local btype = b.balltype if not pokeballs[btype] then return true end local gender = getRandomGenderByName(pokemon) local happy = 220 local ball = 0 local sendToDepot = false --alterado v1.6 if getCreatureMana(cid) >= 6 or not hasSpaceInContainer(getPlayerSlotItem(cid, 3).uid) then sendToDepot = true ball = doCreateItemEx(b.ballid) --alterado v1.3 else ball = item.uid end doItemSetAttribute(ball, "poke", pokemon) doItemSetAttribute(ball, "hp", 1) doItemSetAttribute(ball, "happy", happy) doItemSetAttribute(ball, "gender", gender) if pokemon == "Hitmonchan" or pokemon == "Shiny Hitmonchan" then doItemSetAttribute(ball, "hands", 0) end doItemSetAttribute(ball, "description", "Contains a "..pokemon..".") doItemSetAttribute(ball, "fakedesc", "Contains a "..pokemon..".") doItemSetAttribute(ball, "boost", 50) local nick = "".. getPlayerName(cid) .."" local description = "Contains a "..getItemAttribute(ball, "poke").."." doItemSetAttribute(ball, "nick", nick) local newdes = description.."\nIt's nickname is: ".. getPlayerName(cid) .."." doItemSetAttribute(ball, "description", newdes) local hp = getItemAttribute(ball, "happy") doItemSetAttribute(ball, "happy", hp + 25) doPlayerSendTextMessage(cid, 27, "You opened a pokemon prize box +"..item.itemid - (11637).."!") doPlayerSendTextMessage(cid, 27, "The prize pokemon was a "..pokemon..", congratulations!") if sendToDepot then doPlayerSendMailByName(getCreatureName(cid), ball, 1) --alterado v1.3 doPlayerSendTextMessage(cid, 27, "You are already holding six pokemons, so your new pokemon was sent to your depot.") setPlayerStorageValue(cid, 85552, os.time () + 9999) doRemoveItem(item.uid) else doTransformItem(ball, pokeballs[btype].on) end doSendMagicEffect(getThingPos(cid), 29) return true end