Ir para conteúdo

Featured Replies

Postado
  • 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)

Resolvido por King Laker

Ir para solução
Postado
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

Postado
  • Autor
  Em 26/09/2023 em 10:38, 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

  • 3 weeks later...

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

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo