• 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.

TalkAction Mock bank system

Mock

Mock the bear (MTB)
Joined
Jul 29, 2008
Messages
619
Reaction score
106
Location
Brazil

  • [*]Author: Mock the bear
    bearpaw.png

    [*]Tested on: TFS 0.3.6

With this bank system you can do:
!bank [command] [amount]
  • Withdraw
!bank withdraw 1000
!bank w 1000
!withdraw 1000
  • Balance
!bank balance
!bank b
!balance
  • Deposit
!bank deposit 100
!bank d 100
!deposit 100​
---
Or else:
!bank [cmd] all
!bank deposit all
!bank withdraw all
:thumbup:
Add these tag on talkactions.xml
Code:
<talkaction words="!bank" event="script" value="bank.lua" />
<talkaction words="!withdraw" event="script" value="bank.lua" />
<talkaction words="!deposit" event="script" value="bank.lua" />
<talkaction words="!balance" event="script" value="bank.lua" />
And the script:
Lua:
---Script by mock the bear
local storeige = 18316
local function msg(cid,m)
	doCreatureSay(cid,m,TALKTYPE_ORANGE_1)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, m)
end
function onSay(cid, words, param, channel) ---Script by mock the bear
	local c = getPlayerStorageValue(cid,storeige)
	c = c == -1 and 0 or c
	if param:find('balance') or param == 'b'  or (words == '!balance') then
		msg(cid,'Account balance '..c..'')
	elseif param:find('amount') or param == 'a' then
		local c = getPlayerMoney(cid)
		doCreatureSay(cid,'Account balance '..c..' gps.',TALKTYPE_ORANGE_1)
		msg(cid,'Your account balance contains only '..c..' gps.')
	elseif param:match('deposit (.+)') or param:match('d (.+)') or (words == '!deposit') then
		local v = param:match('deposit (.+)') or param:match('d (.+)') or tonumber(param) or param == 'all' and param
		local dep = tonumber(v == 'all' and getPlayerMoney(cid) or v)
		if not dep then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Insert a value')
		else
			if getPlayerMoney(cid) >= dep then
				setPlayerStorageValue(cid,storeige,c+dep)
				doPlayerRemoveMoney(cid,dep)
				msg(cid,'Deposit '..dep..'.')
			else
				msg(cid,'Your account balance contains only '..getPlayerMoney(cid)..'.')
			end
		end
	elseif param:match('withdraw (.+)') or param:match('w (.+)') or (words == '!withdraw') then
		local v = param:match('withdraw (.+)') or param:match('w (.+)') or tonumber(param) or param == 'all' and param
		local dep = tonumber(v == 'all' and c or v)
		if not dep then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Insert a value')
		else
			if c >= dep then
				setPlayerStorageValue(cid,storeige,c-dep)
				doPlayerAddMoney(cid,dep)
				msg(cid,'Withdraw '..dep..'.')
			else
				msg(cid,'Your account balance contains only '..c..'.')
			end
		end
	else
		doPlayerSendTextMessage(cid, 25, "Use like this:\n!bank deposit x\n!bank balance\n!bank withdraw\n!bank amount(ou assim)\n!bank d x\n!bank w x\n!bank deposit all\n!bank a")
	end
	return TRUE
end
 
Nice script, although I like the npc script better. Makes things more realistic.
 
@soul4soul
i said full bank system '-'?
Better dont change storage values using db.execute...
 
nice! short script :) can you add the configurable option, for execute the talkaction only in protection zone?
 
Last edited:
Back
Top