[Encerrado] Problema No Trade Do Meu Ot [Urgente]

matayo1888
em Tópicos Sem Resposta

matayo1888

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 19/09/12Posts: 39

Olá pessoal, estou com um problema e preciso resolve-lo rapido.

 

No meu ot de poketibia, o players quando fazem TRADE (troca de pokemons,iten, etc ...) o server desliga sozinho, tipo o forggottenserver da erro.

 

Alguem por favor pode me ajudar ??

Yan Oliveira

Yan18
avatar
Moderador
Moderador

INFOS

Grupo: ModeradorRegistrado: 05/06/12Posts: 2221Gênero: Masculino

matayo1888

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 19/09/12Posts: 39

Quais são os scripts de Trade ??

Yan Oliveira

Yan18
avatar
Moderador
Moderador

INFOS

Grupo: ModeradorRegistrado: 05/06/12Posts: 2221Gênero: Masculino

matayo1888

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 19/09/12Posts: 39

Não, nem tentei pois não entendo sobre Trade, vim logo pro Xtibia pra ver se resolvo

Yan Oliveira

Yan18
avatar
Moderador
Moderador

INFOS

Grupo: ModeradorRegistrado: 05/06/12Posts: 2221Gênero: Masculino

matayo1888

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 19/09/12Posts: 39

Aqui está:

 

 

 

function onTradeRequest(cid, target, item)

local itemPokeball = isPokeball(item.itemid) and 1 or 0

local cancel = false

 

if itemPokeball == 1 then

local pokename = getItemAttribute(item.uid, "poke")

if getArticle(pokename) == "error" then

cancel = true

end

end

 

if cancel then

doPlayerSendTextMessage(cid, 26, "Your pokemon is with some bug, please report to a GOD.")

return false

end

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

if itemPokeball == 1 and targetItemPokeball == 1 then

setPlayerStorageValue(cid, 8900, 1)

setPlayerStorageValue(target, 8900, 1)

end

return true

end

 

 

Yan Oliveira

Yan18
avatar
Moderador
Moderador

INFOS

Grupo: ModeradorRegistrado: 05/06/12Posts: 2221Gênero: Masculino

Tente assim:

 

 

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

 

if isContainer(item.uid) then

local bagItems = getItensUniquesInContainer(item.uid)

if #bagItems >= 1 then

doPlayerSendCancel(cid, "Has a Unique Item in this bag, you can't trade this item.")

return false

end

elseif getItemAttribute(item.uid, "unique") then

doPlayerSendCancel(cid, "It is a Unique Item, you can't trade this item.")

return false

end

 

if isContainer(item.uid) then

local itens = getPokeballsInContainer(item.uid)

if #itens >= 1 then

for i = 1, #itens do

local lvl = getItemAttribute(itens, "level")

local name = getItemAttribute(itens, "poke")

if not lvl then

doItemSetAttribute(itens, "level", pokes[name].level)

end

end

end

elseif isPokeball(item.itemid) then

local lvl = getItemAttribute(item.uid, "level")

local name = getItemAttribute(item.uid, "poke")

if not lvl then

doItemSetAttribute(item.uid, "level", pokes[name].level)

end

end

 

if getPlayerStorageValue(cid, 52480) >= 1 then

doPlayerSendTextMessage(cid, 20, "You can't do that while be in a duel!")

return false

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 getPlayerMana(cid) + itemPokeball > 6 then

cancel = true

p1 = cid

end

if getPlayerMana(target) + targetItemPokeball > 6 then

cancel = true

p2 = target

end

 

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

 

 

 

Se não funcionar me avisa.

matayo1888

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 19/09/12Posts: 39

Pegou, vlw aew, reporte o topico pf

Yan Oliveira

Yan18
avatar
Moderador
Moderador

INFOS

Grupo: ModeradorRegistrado: 05/06/12Posts: 2221Gênero: Masculino

Stigal

don't ever stop...
avatar
Herói
Herói

INFOS

Grupo: HeróiRegistrado: 28/11/10Posts: 3402Gênero: Masculino

Resolvido.

Topico Movido!

VI6MDIG.png

 

"O fracasso é a oportunidade de se começar de novo inteligentemente"

Minhas Redes Sociais: Youtube | Página & Grupo | Steam  | Discord Xtibia | Skype: @mrooger

 

OTpanel

Stigal

don't ever stop...
avatar
Herói
Herói

INFOS

Grupo: HeróiRegistrado: 28/11/10Posts: 3402Gênero: Masculino
A questão neste tópico de suporte foi encerrada por falta de respostas. Este tópico está fechado e foi movido para Suporte - Tópicos Sem Resposta.

+ Caso a dúvida não tenha sido resolvida você poderá criar outro tópico solicitando ajuda.
* Lembre-se que é permitido dar UP no tópico a cada 24 horas para assim o destacar e manter movimentado.

VI6MDIG.png

 

"O fracasso é a oportunidade de se começar de novo inteligentemente"

Minhas Redes Sociais: Youtube | Página & Grupo | Steam  | Discord Xtibia | Skype: @mrooger

 

OTpanel