function onTradeRequest(cid, target, item)
for a, b in pairs (pokeballs) do
if b.use == item.itemid then
doPlayerSendCancel(cid, "You can't trade this item.")
return false
end
end
return true
end
local function noCap(cid, sid)
if isCreature(cid) then
doPlayerSendCancel(cid, "You can't carry more than six pokemons, trade cancelled.")
end
if isCreature(sid) then
doPlayerSendCancel(sid, "You can't carry more than six pokemons, trade cancelled.")
end
end
function onTradeAccept(cid, target, item, targetItem)
local pbs = #getPokeballsInContainer(item.uid)
local cancel = false
local p1 = 0
local p2 = 0
local itemPokeball = isPokeball(item.itemid) and 1 or 0
local targetItemPokeball = isPokeball(targetItem.itemid) and 1 or 0
if pbs > 0 and getCreatureMana(target) + pbs > 6 + targetItemPokeball then
cancel = true
p1 = target
end
pbs = #getPokeballsInContainer(targetItem.uid)
if pbs > 0 and getCreatureMana(cid) + pbs > 6 + itemPokeball then
cancel = true
p2 = cid
end
if cancel then
addEvent(noCap, 20, p1, p2)
return false
end
<p>if itemPokeball == 1 and targetItemPokeball ==