Jump to content

Advanced Trade System For Pda


Recommended Posts

Hi all

I'm not br, sorry if you don't understand me...

i made a code that it is really useful, in trade when the players say: "SELL DRATINI ALMOST 43" the another player can't know if that is true or not, sometimes that poke need 100% of its exp to evolve lol. With my feature the players can see that by this way:

 

11:36 That offered poke: Rattata[M] needs 96% of exp.Boost level: 0.

it is onTradeRequest, when someone try to trade with you that message will be displayed :)

 

here it is the revamped trade system, just remove all of the script creaturescripts/trade system.lua and replace for this:

[/font][/color]
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
elseif (b.on == item.itemid) then
local pokename = getItemAttribute(item.uid , "poke")
local nivel = getItemAttribute(item.uid , "level")
local gender = getItemAttribute(item.uid, "gender") == 3 and "[F]" or "[M]"
local boost = getItemAttribute(item.uid, "boost") or 0
str = "That offered poke: "..pokename..""..gender
if (nivel < 100) then
local experiencia = getPokemonExperienceTable(pokename)[nivel + 1] - getPokemonExperienceTable(pokename)[nivel]
local proxima = getItemAttribute(item.uid , "nextlevelexp")
local xp = round(proxima/experiencia * 100)
str = str.." needs "..xp.."% of exp."

else
str = str.." it has the maximum level. "
end
str = str.. "Boost level: "..boost
doPlayerSendTextMessage(target, 19, str)
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

if itemPokeball == 1 and targetItemPokeball == 1 then
setPlayerStorageValue(cid, 8900, 1)
setPlayerStorageValue(target, 8900, 1)
end

return true
end
[color=#282828][font=helvetica, arial, sans-serif]

i hope you like it ^^

Link to comment
Share on other sites

  • 4 months later...

1* - achu q ficaria +/- assim.. kk

Ola para todo mundo...
Eu nao sou brasileiro, desculpe se voces nao me intenderem...
Eu fiz um codigo q eh bastante util, nas trocas quando o player fla: "VENDO DRATINI QUASE LVL 43" e o outro player nao pode saber se isso eh verdade ou nao,
algumas vezes esse poke precisa de 100% de exp para evoluir lol. Com meu 'recurso' os jogadores podem ver desse jeito:

11:36 Esse pokemon: Rattata[M] precisa de 96% exp. Boost level: 0.

Isso vai aparecer quando alguem tentar dar troca com você 
Aki esta o sistem de trade renovado, apenas troque o script de creaturescripts/scripts/trade system.lua por isso:

 

2* LoL greatttttt ideia man... i will never think in that o.O thanks so much!!!

Link to comment
Share on other sites

×
×
  • Create New...