• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Bank Check System

velocitraptor

devFuel = feedback
Joined
Jun 3, 2016
Messages
23
Reaction score
20
Hi, this is a system i made just for fun, i hope you like it.

How it works?
If you have enough cash on your bank account you could create a document with cash (A.K.A. check) then someone could get that cash when click on it.

How to create check?

Use the command /bankCheck amount <- where amount min could be set on config (default is 30k), you will receive the check on your Inbox.

How to get money from check?

Just click on it ;)

How it looks?

bc3oxUr.png


and that's all, here you are:

data/lib/custom/bankCheck.lua
Code:
local base = 13529
BANK_CHECK = --config
{
   ["ITEMID"] = base,
   ["ACTIONID"] = 13530,
   ["STORAGE_EXHAUST"] = base + 2,
   ["EXHAUSTION_TIME"] = 5,  
   ["MIN_AMOUNT"] = 30000      
}


function Player.doBankCheck(self, amount)

   if (self:getBankBalance() < amount) then
       return false
   end

    local check = self:getInbox():addItem(BANK_CHECK["ITEMID"], 1, false, 1)

    if not check then
        print('[ERROR Bank Check System] = Error on adding item to inbox.')
        return false
    end
    self:setBankBalance(self:getBankBalance() - amount)

    check:setAttribute(ITEM_ATTRIBUTE_NAME, string.format("Bank Check signed by %s", self:getName()))
    check:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, string.format("This check its worth %d gp.", amount))
    check:setAttribute(ITEM_ATTRIBUTE_ACTIONID, BANK_CHECK["ACTIONID"])
    return true
end



function Player.getBankCheck(self, bankCheck)

   if (bankCheck:getId() == BANK_CHECK["ITEMID"] and bankCheck:getAttribute(ITEM_ATTRIBUTE_ACTIONID) == BANK_CHECK["ACTIONID"]) then
       local desc = bankCheck:getAttribute(ITEM_ATTRIBUTE_DESCRIPTION)
       local cash = tonumber(desc:match("%d+"))
       self:setBankBalance(self:getBankBalance() + cash)

       return cash
   else
       return false
   end
end

--Thanks to Printer
function Player.setExhaustion(self, value, time)
    self:setStorageValue(value, time + os.time())
end

function Player.getExhaustion(self, value)
    local storage = self:getStorageValue(value)
    if not storage or storage <= os.time() then
        return 0
    end

    return storage - os.time()
end

function Player:hasExhaustion(value)
    return self:getExhaustion(value) >= os.time() and true or false
end


add this at the end of data/lib/lib.lua
Code:
dofile('data/lib/custom/bankCheck.lua')

data/actions/scripts/bankCheck.lua
Code:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)

   if (item:getId() == BANK_CHECK["ITEMID"]) then
       local res = player:getBankCheck(item)
       if (res) then
           player:sendTextMessage(MESSAGE_EVENT_ORANGE, string.format("[Bank Check System] %d gps have been added to your bank account.", res))
           item:remove(1)
       end
   end

   return true
end

data/actions/actions.xml
Code:
<action actionid="13530" script="bankCheck.lua" />

data/talkactions/scripts/bankCheck.lua
Code:
function onSay(player, words, param)
   if (player:getExhaustion(BANK_CHECK["STORAGE_EXHAUST"]) > 0) then
       player:sendTextMessage(MESSAGE_STATUS_SMALL, "Wait...")
       return false
   end


   player:setExhaustion(BANK_CHECK["STORAGE_EXHAUST"], BANK_CHECK["EXHAUSTION_TIME"])
   if (not param or param == '') then
       player:sendTextMessage(MESSAGE_STATUS_SMALL, "Command requires param.")
       return false
   end

   local amount = tonumber(param)
   if (not amount) then
       player:sendTextMessage(MESSAGE_STATUS_SMALL, "You can enter numbers only.")
       return false
   end

   if (amount < BANK_CHECK["MIN_AMOUNT"]) then
       player:sendTextMessage(MESSAGE_EVENT_ORANGE, string.format("[Bank Check System] Min cash for create a check is %d", BANK_CHECK["MIN_AMOUNT"]))
       return false    
   end
   local res = player:doBankCheck(amount)
   if (res) then
       player:sendTextMessage(MESSAGE_EVENT_ORANGE, "[Bank Check System] Check has been created, check your inbox.")
   else
       player:sendTextMessage(MESSAGE_EVENT_ORANGE, "[Bank Check System] Couldn't create Bank Check.")
   end


   return false
end

data/talkactions/talkactions.xml
Code:
<talkaction words="/bankCheck" separator=" " script="mios/bankCheck.lua" />


report bugs :)
 
Last edited:
Hi, this is a system i made just for fun, i hope you like it.

How it works?
If you have enough cash on your bank account you could create a document with cash (A.K.A. check) then someone could get that cash when click on it.

How to create check?

Use the command /bank Check amount <- where amount min could be set on config (default is 30k), you will receive the check on your Inbox.

How to get money from check?

Just click on it ;)

How it looks?

bc3oxUr.png


and that's all, here you are:

data/lib/custom/bankCheck.lua
Code:
local base = 13529
BANK_CHECK = --config
{
   ["ITEMID"] = base,
   ["ACTIONID"] = 13530,
   ["STORAGE_EXHAUST"] = base + 1,
   ["EXHAUSTION_TIME"] = 5, 
   ["MIN_AMOUNT"] = 30000     
}

function Player.doBankCheck(self, amount)

   if (self:getBankBalance() < amount) then
       return false
   end

    local check = self:getInbox():addItem(BANK_CHECK["ITEMID"], 1, false, 1)

    if not check then
        print('[ERROR Bank Check System] = Error on adding item to inbox.')
        return false
    end
    self:setBankBalance(self:getBankBalance() - amount)

    check:setAttribute(ITEM_ATTRIBUTE_NAME, string.format("Bank Check signed by %s", self:getName()))
    check:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, string.format("This check its worth %d gp.", amount))
    check:setAttribute(ITEM_ATTRIBUTE_ACTIONID, BANK_CHECK["ACTIONID"])
    check:setAttribute(ITEM_ATTRIBUTE_OWNER, amount)
    return true
end

function Player.getBankCheck(self, bankCheck)

   if (bankCheck:getId() == BANK_CHECK_ITEMID and bankCheck:getAttribute(ITEM_ATTRIBUTE_ACTIONID) == BANK_CHECK["ACTIONID"]) then
       local cash = bankCheck:getAttribute(ITEM_ATTRIBUTE_OWNER)
       self:setBankBalance(self:getBankBalance() + cash)

       return cash
   else
       return false
   end
end

--Thanks to Printer
function Player.setExhaustion(self, value, time)
    self:setStorageValue(value, time + os.time())
end

function Player.getExhaustion(self, value)
    local storage = self:getStorageValue(value)
    if not storage or storage <= os.time() then
        return 0
    end

    return storage - os.time()
end

function Player:hasExhaustion(value)
    return self:getExhaustion(value) >= os.time() and true or false
end


add this at the end of data/lib/lib.lua
Code:
dofile('data/lib/custom/bankCheck.lua')

data/actions/scripts/bankCheck.lua
Code:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)

   if (item:getId() == BANK_CHECK["ITEMID"]) then
       local res = player:getBankCheck(item)
       if (res) then
           player:sendTextMessage(MESSAGE_EVENT_ORANGE, string.format("[Bank Check System] %d gps have been added to your bank account.", res))
           item:remove(1)
       end
   end

   return true
end

data/actions/actions.xml
Code:
<action actionid="13530" script="bankCheck.lua" />

data/talkactions/scripts/bankCheck.lua
Code:
function onSay(player, words, param)
   if (player:getExhaustion(BANK_CHECK["STORAGE_EXHAUST"]) > 0) then
       player:sendTextMessage(MESSAGE_STATUS_SMALL, "Wait...")
       return false
   end


   player:setExhaustion(BANK_CHECK["STORAGE_EXHAUST"], BANK_CHECK["EXHAUSTION_TIME"])
   if (not param or param == '') then
       player:sendTextMessage(MESSAGE_STATUS_SMALL, "Command requires param.")
       return false
   end

   local amount = tonumber(param)
   if (not amount) then
       player:sendTextMessage(MESSAGE_STATUS_SMALL, "You can enter numbers only.")
       return false
   end

   if (amount < BANK_CHECK["MIN_AMOUNT"]) then
       player:sendTextMessage(MESSAGE_EVENT_ORANGE, string.format("[Bank Check System] Min cash for create a check is %d", BANK_CHECK["MIN_AMOUNT"]))
       return false     
   end
   local res = player:doBankCheck(amount)
   if (res) then
       player:sendTextMessage(MESSAGE_EVENT_ORANGE, "[Bank Check System] Check has been created, check your inbox.")
   else
       player:sendTextMessage(MESSAGE_EVENT_ORANGE, "[Bank Check System] Couldn't create Bank Check.")
   end


   return false
end

data/talkactions/talkactions.xml
Code:
<talkaction words="/bankCheck" separator=" " script="mios/hacerCheque.lua" />


report bugs :)
hey thats pretty good
 
Back
Top