local BOXES = {
[3000] = {level = 5, pokemons = {"Pidgey"}}
}
local slot = {
getPlayerSlotItem(cid, PLAYER_SLOT_EVOLVE),
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local randomBoxPokemon = BOXES[item.itemid].pokemons[math.random(1, #BOXES[item.itemid].pokemons)]
doSendMagicEffect(getCreaturePosition(cid), EFFECT_FIREWORK_YELLOW)
doPlayerRemoveItem(cid, slot, 1)
doPlayerAddItem(cid, PLAYER_SLOT_EVOLVE, 2377, true)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, string.format(__L(cid, "Congratulations! Your %s result in %s."), getItemNameById(item.itemid), getMonsterInfo(randomBoxPokemon).description))
doCreatePokemonBall(cid, "poke", randomBoxPokemon, BOXES[item.itemid].level, nil, nil,
math.floor(BOXES[item.itemid].level / 2), cid, true)
doTeleportThing(cid, {x = 3295, y = 564, z = 7}, false)
return true
end
try this