Ir para conteúdo
  • Cadastre-se

[OTX2 8.6] Script Trade Points com Erro.


Ir para solução Resolvido por King Laker,

Posts Recomendados

  • Solução

Boa tarde, estou tendo um erro no script do @Yan Liima, e não parece que terei suporte por lá, alguém poderia me ajudar nessa empreitada?


Estou dando trade com o pergaminho dentro de uma BP, ele faz todas as funções que deveria mas mesmo assim esta apresentando esse erro, como posso corigir?
Erro:
image.png.34155145aa1ac0eb24562b92c43bbe01.png


Script:

 

Editado por King Laker (veja o histórico de edições)

VlVKQKC.png&key=d5c17620ae9567a1f898dd7a

 

 

 

  • 532144234_Logo_NTO_BLOOD_Finish_HIM_By_Antonio_Luckas(3).png.fd58d1af125a7e82ccdd751637e9ca93.png
Link para o post
Compartilhar em outros sites
local ItemID = 1964 -- ID do papel

function PremmyPoints(item)
    local points = getItemAttribute(item, "points")
    if points then
        return tonumber(points)
    else
        return 0
    end
end

function Success(fromplayer, toplayer, points)
    if getPlayerItemCount(toplayer, ItemID) >= 1 and getAccountPointsTrade(fromplayer) >= points then
        doAccountRemovePointsTrade(fromplayer, points)
        doPlayerRemoveItem(toplayer, ItemID, 1)
        doAccountAddPointsTrade(toplayer, points)
        doPlayerSendTextMessage(toplayer, MESSAGE_STATUS_WARNING, "Transfer successful, you can now use the " .. points .. " premium points in our site shop!")
        doPlayerSendTextMessage(fromplayer, MESSAGE_STATUS_WARNING, "Removed " .. points .. " premium points from your account.")
        return true
    end
end

function onTradeAccept(cid, target, item, targetItem)
    if isPlayer(cid) and isPlayer(target) then
        if item.itemid == ItemID and targetItem.itemid == ItemID then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You cannot trade points for points, close the current trade and try again.")
            doPlayerSendTextMessage(target, MESSAGE_STATUS_WARNING, "You cannot trade points for points, close the current trade and try again.")
            return false
        end

        if item.itemid == ItemID then
            local points = PremmyPoints(item)
            if getAccountPointsTrade(cid) >= points then
                addEvent(Success, 1, cid, target, points)
            else
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You do not have " .. points .. " premium points to perform this procedure.")
                doPlayerSendTextMessage(target, MESSAGE_STATUS_WARNING, "The buyer does not have " .. points .. " premium points to perform this procedure.")
                return false
            end
        end

        if targetItem.itemid == ItemID then
            local points = PremmyPoints(targetItem)
            if getAccountPointsTrade(target) >= points then
                addEvent(Success, 1, target, cid, points)
            else
                doPlayerSendTextMessage(target, MESSAGE_STATUS_WARNING, "You do not have " .. points .. " premium points to perform this procedure.")
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "The buyer does not have " .. points .. " premium points to perform this procedure.")
                return false
            end
        end
    end
    return true
end

function onTradeRequest(cid, target, item)
    local tabela = {}
    local black_list = {ItemID}
    scanContainer(item.uid, tabela)
    for i = 1, #black_list do
        if isInArray(tabela, black_list[i]) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You cannot place the premmy trade document in this trade, this document can only be used in trades outside containers (bag, backpack, etc).")
            return false
        end
    end
    return true
end

tentar

Link para o post
Compartilhar em outros sites
5 horas atrás, GM Vortex disse:

local ItemID = 1964 -- ID do papel

function PremmyPoints(item)
    local points = getItemAttribute(item, "points")
    if points then
        return tonumber(points)
    else
        return 0
    end
end

function Success(fromplayer, toplayer, points)
    if getPlayerItemCount(toplayer, ItemID) >= 1 and getAccountPointsTrade(fromplayer) >= points then
        doAccountRemovePointsTrade(fromplayer, points)
        doPlayerRemoveItem(toplayer, ItemID, 1)
        doAccountAddPointsTrade(toplayer, points)
        doPlayerSendTextMessage(toplayer, MESSAGE_STATUS_WARNING, "Transfer successful, you can now use the " .. points .. " premium points in our site shop!")
        doPlayerSendTextMessage(fromplayer, MESSAGE_STATUS_WARNING, "Removed " .. points .. " premium points from your account.")
        return true
    end
end

function onTradeAccept(cid, target, item, targetItem)
    if isPlayer(cid) and isPlayer(target) then
        if item.itemid == ItemID and targetItem.itemid == ItemID then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You cannot trade points for points, close the current trade and try again.")
            doPlayerSendTextMessage(target, MESSAGE_STATUS_WARNING, "You cannot trade points for points, close the current trade and try again.")
            return false
        end

        if item.itemid == ItemID then
            local points = PremmyPoints(item)
            if getAccountPointsTrade(cid) >= points then
                addEvent(Success, 1, cid, target, points)
            else
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You do not have " .. points .. " premium points to perform this procedure.")
                doPlayerSendTextMessage(target, MESSAGE_STATUS_WARNING, "The buyer does not have " .. points .. " premium points to perform this procedure.")
                return false
            end
        end

        if targetItem.itemid == ItemID then
            local points = PremmyPoints(targetItem)
            if getAccountPointsTrade(target) >= points then
                addEvent(Success, 1, target, cid, points)
            else
                doPlayerSendTextMessage(target, MESSAGE_STATUS_WARNING, "You do not have " .. points .. " premium points to perform this procedure.")
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "The buyer does not have " .. points .. " premium points to perform this procedure.")
                return false
            end
        end
    end
    return true
end

function onTradeRequest(cid, target, item)
    local tabela = {}
    local black_list = {ItemID}
    scanContainer(item.uid, tabela)
    for i = 1, #black_list do
        if isInArray(tabela, black_list[i]) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You cannot place the premmy trade document in this trade, this document can only be used in trades outside containers (bag, backpack, etc).")
            return false
        end
    end
    return true
end

tentar

image.thumb.png.8383ad5b3973091490764592123fe004.png

VlVKQKC.png&key=d5c17620ae9567a1f898dd7a

 

 

 

  • 532144234_Logo_NTO_BLOOD_Finish_HIM_By_Antonio_Luckas(3).png.fd58d1af125a7e82ccdd751637e9ca93.png
Link para o post
Compartilhar em outros sites
  • 3 weeks later...

Resolvido.

VlVKQKC.png&key=d5c17620ae9567a1f898dd7a

 

 

 

  • 532144234_Logo_NTO_BLOOD_Finish_HIM_By_Antonio_Luckas(3).png.fd58d1af125a7e82ccdd751637e9ca93.png
Link para o post
Compartilhar em outros sites

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo