• 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 Bank System

Rurouni

New Member
Joined
Sep 23, 2012
Messages
10
Reaction score
2
balance.lua
PHP:
function onSay(cid, words, param)
	if getTilePzInfo(getPlayerPosition(cid)) == TRUE then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your account balance is ".. getPlayerBalance(cid) .." gold.")
	else
		doPlayerSendCancel(cid, "You can only use this command in PZ.")
		doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
	end
end

deposit.lua
PHP:
function onSay(cid, words, param)
	if getPlayerTown(cid) == 24 then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You cannot deposit money being in Rookgaard.")
		return
	end
	
	if isPlayer(cid) == TRUE and param ~= "" then
		if getTilePzInfo(getPlayerPosition(cid)) == TRUE then
				if	doPlayerRemoveMoney(cid, param) == TRUE then
					doPlayerSetBalance(cid, param)
					doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have added the amount of ".. param .." gold to your balance. You can withdraw your money anytime you want to.")
				else
					doPlayerSendCancel(cid, "You do not have enough money.")
					doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
				end
		else
			doPlayerSendCancel(cid, "You can only use this command in PZ.")
			doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
		end
	end
end

withdraw.lua
PHP:
function onSay(cid, words, param)
	if getPlayerTown(cid) == 24 then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You cannot withdraw money being in Rookgaard.")
		return
	end
	
	if isPlayer(cid) == TRUE and param ~= "" then
		if getTilePzInfo(getPlayerPosition(cid)) == TRUE then
				if getPlayerBalance(cid) >= param then
					doPlayerSetBalance(cid, getPlayerBalance(cid) - param)
					doPlayerAddMoney(cid, param)
					doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Here you are, ".. param .." gold.")
				else
					doPlayerSendCancel(cid, "You do not have enough money.")
					doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
				end
		else
			doPlayerSendCancel(cid, "You can only use this command in PZ.")
			doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
		end
	end
end

- - - Updated - - -

you should change
getPlayerTown(cid) == 24
for your rookgaard town ID.
 
I have a noob question. for your bank npc how do you add multiple scripts for him?

Withdraw/deposit/balance etc
 
Code:
doPlayerSendCancel(cid, "You do not have enough money.")
That doesn't sound nice, should be something like 'you don't have any money on your account'.

Apart from that, cheers for the script.
 
Back
Top