• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Tradeoff 2.0 TFS 1.3+

nanduzenho

Member
Joined
Mar 21, 2021
Messages
187
Solutions
1
Reaction score
15
GitHub
nanduzenho
Good afternoon, I have this revscript "auction system" for TFS 1.3, however this error is occurring in the console when I run the command !tradeoff add, 500000. Could anyone help me to solve this problem?

tradeoff.JPG

In case someone converts it to normal script, without being revscript so I can do a test. As per my test this script worked perfectly on TFS 1.5 but mine is TFS 1.3

Capturar1.JPG
 

Attachments

Solution
Paste this inside lib\core\player.lua
Lua:
function Player.removeTotalMoney(self, amount)
    local moneyCount = self:getMoney()
    local bankCount = self:getBankBalance()

    if amount <= moneyCount then
        self:removeMoney(amount)
        return true

    elseif amount <= (moneyCount + bankCount) then
        if moneyCount ~= 0 then
            self:removeMoney(moneyCount)
            local remains = amount - moneyCount
            self:setBankBalance(bankCount - remains)
            self:sendTextMessage(MESSAGE_INFO_DESCR, ("Paid %d from inventory and %d gold from bank account. Your account balance is now %d gold."):format(moneyCount, amount - moneyCount, self:getBankBalance()))
            return true
        else...
Yes, apparently it has this function
No. It does not.


There is only getDuration for ItemType (like item with ID 2400 - from items.xml), not for Item.

You must replace (line 408):
Code:
local duration = itemOfertado:getDuration()
with:
Code:
local duration = itemOfertado:getAttribute(ITEM_ATTRIBUTE_DURATION)

Replace (line 813):
Code:
local duration = itemDoSlot:getDuration()
with:
Code:
local duration = itemDoSlot:getAttribute(ITEM_ATTRIBUTE_DURATION)

Replace (line 101):
Code:
local duration = itemDentroDoContainer:getDuration()
with:
Code:
local duration = itemDentroDoContainer:getAttribute(ITEM_ATTRIBUTE_DURATION)
 
Post automatically merged:

No. It does not.


There is only getDuration for ItemType (like item with ID 2400 - from items.xml), not for Item.

You must replace (line 408):
Code:
local duration = itemOfertado:getDuration()
with:
Code:
local duration = itemOfertado:getAttribute(ITEM_ATTRIBUTE_DURATION)

Replace (line 813):
Code:
local duration = itemDoSlot:getDuration()
with:
Code:
local duration = itemDoSlot:getAttribute(ITEM_ATTRIBUTE_DURATION)

Replace (line 101):
Code:
local duration = itemDentroDoContainer:getDuration()
with:
Code:
local duration = itemDentroDoContainer:getAttribute(ITEM_ATTRIBUTE_DURATION)

Thx bro! Now this error happens

removetotalmoney.JPG
Post automatically merged:

well, I put "removeMoney" and apparently it's working =D
 
Last edited:
Paste this inside lib\core\player.lua
Lua:
function Player.removeTotalMoney(self, amount)
    local moneyCount = self:getMoney()
    local bankCount = self:getBankBalance()

    if amount <= moneyCount then
        self:removeMoney(amount)
        return true

    elseif amount <= (moneyCount + bankCount) then
        if moneyCount ~= 0 then
            self:removeMoney(moneyCount)
            local remains = amount - moneyCount
            self:setBankBalance(bankCount - remains)
            self:sendTextMessage(MESSAGE_INFO_DESCR, ("Paid %d from inventory and %d gold from bank account. Your account balance is now %d gold."):format(moneyCount, amount - moneyCount, self:getBankBalance()))
            return true
        else
            self:setBankBalance(bankCount - amount)
            self:sendTextMessage(MESSAGE_INFO_DESCR, ("Paid %d gold from bank account. Your account balance is now %d gold."):format(amount, self:getBankBalance()))
            return true
        end
    end
    return false
end
 
Solution
Paste this inside lib\core\player.lua
Lua:
function Player.removeTotalMoney(self, amount)
    local moneyCount = self:getMoney()
    local bankCount = self:getBankBalance()

    if amount <= moneyCount then
        self:removeMoney(amount)
        return true

    elseif amount <= (moneyCount + bankCount) then
        if moneyCount ~= 0 then
            self:removeMoney(moneyCount)
            local remains = amount - moneyCount
            self:setBankBalance(bankCount - remains)
            self:sendTextMessage(MESSAGE_INFO_DESCR, ("Paid %d from inventory and %d gold from bank account. Your account balance is now %d gold."):format(moneyCount, amount - moneyCount, self:getBankBalance()))
            return true
        else
            self:setBankBalance(bankCount - amount)
            self:sendTextMessage(MESSAGE_INFO_DESCR, ("Paid %d gold from bank account. Your account balance is now %d gold."):format(amount, self:getBankBalance()))
            return true
        end
    end
    return false
end
It worked!! Thank u!!!!!!!!
Post automatically merged:

Paste this inside lib\core\player.lua
Lua:
function Player.removeTotalMoney(self, amount)
    local moneyCount = self:getMoney()
    local bankCount = self:getBankBalance()

    if amount <= moneyCount then
        self:removeMoney(amount)
        return true

    elseif amount <= (moneyCount + bankCount) then
        if moneyCount ~= 0 then
            self:removeMoney(moneyCount)
            local remains = amount - moneyCount
            self:setBankBalance(bankCount - remains)
            self:sendTextMessage(MESSAGE_INFO_DESCR, ("Paid %d from inventory and %d gold from bank account. Your account balance is now %d gold."):format(moneyCount, amount - moneyCount, self:getBankBalance()))
            return true
        else
            self:setBankBalance(bankCount - amount)
            self:sendTextMessage(MESSAGE_INFO_DESCR, ("Paid %d gold from bank account. Your account balance is now %d gold."):format(amount, self:getBankBalance()))
            return true
        end
    end
    return false
end

Now this error occurs when I try to buy

tradeoff.JPG
 
Last edited:
It worked!! Thank u!!!!!!!!
Post automatically merged:



Now this error occurs when I try to buy

View attachment 65950
Paste this inside lib\core\player.lua too
Lua:
function Player.getTotalMoney(self)
    return self:getMoney() + self:getBankBalance()
end
 
Back
Top