actions/scripts/Addon.lua
function onUse(cid, item, fromPosition, itemEx, toPosition)
if #getCreatureSummons(cid) > 0 then
doPlayerSendCancel(cid, msgs.return_poke[getPlayerLanguage(cid)])
return false
end
local addonNum = addons[item.itemid].addon_num
local addon = addons[item.itemid].looktype
local fly = addons[item.itemid].fly
local ride = addons[item.itemid].ride
local surf = addons[item.itemid].surf
local addonlook = addons[item.itemid].nome
local pb = getPlayerSlotItem(cid, 8).uid
local pk = addons[item.itemid].pokemon
if getItemAttribute(pb, "poke") ~= pk then
doPlayerSendCancel(cid, msgs.cant_use[getPlayerLanguage(cid)])
return false
end
if getItemAttribute(pb, "pokeballusada") == 0 then
doRemoveItem(item.uid, 1)
doSendMagicEffect(fromPosition, 173)
updateAddonAttr(pb, "addon" , addon , addonNum)
updateAddonAttr(pb, "addonfly" , fly , addonNum)
updateAddonAttr(pb, "addonride", ride , addonNum)
updateAddonAttr(pb, "addonsurf", surf , addonNum)
updateAddonAttr(pb, "addonlook", addonlook, addonNum)
if not getItemAttribute(pb, "current_addon") then
doSetItemAttribute(pb, "current_addon", addonNum)
end
return true
end
return false
end