Hi, I have a bank system runned by command, but it gets bug after a certain amount when you deposit or withdraw, can anyone add a max cap on it like how can i add it to the script I have, if its possible, a cap max on the storage, deposting and withdrawing. Any help would be great. running 0.3.6 client 8.6 Here are my scripts:
Deposit:
Depositall:
Withdraw:
Balance:
Deposit:
Lua:
function onSay(cid, words, param)
local config = {
bankSystemEnabled = getBooleanFromString(getConfigInfo('bankSystem')),
playerIsFighting = hasCondition(cid, CONDITION_INFIGHT)
}
if config.bankSystemEnabled == TRUE then
if config.playerIsFighting == FALSE then
if(param == "") then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Command requires param.")
return TRUE
end
local m = tonumber(param)
if(not m) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Command requires numeric param.")
return TRUE
end
m = math.abs(m)
if m <= getPlayerMoney(cid) then
doPlayerDepositMoney(cid, m)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Alright, you have added the amount of " .. m .. " gold to your balance. You can withdraw your money anytime you want to. Your account balance is " .. getPlayerBalance(cid) .. ".")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You do not have enough money.")
end
return TRUE
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Bank can not be used in fight.")
return TRUE
end
else
return FALSE
end
end
Depositall:
Lua:
function onSay(cid, words, param)
local config = {
bankSystemEnabled = getBooleanFromString(getConfigInfo('bankSystem')),
playerIsFighting = hasCondition(cid, CONDITION_INFIGHT)
}
if config.bankSystemEnabled == TRUE then
if config.playerIsFighting == FALSE then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Alright, you have added the amount of " .. getPlayerMoney(cid) .. " gold to your balance. You can withdraw your money anytime you want to.")
doPlayerDepositAllMoney(cid)
return TRUE
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Bank can not be used in fight.")
return TRUE
end
else
return FALSE
end
end
Withdraw:
Lua:
function onSay(cid, words, param)
local config = {
bankSystemEnabled = getBooleanFromString(getConfigInfo('bankSystem')),
playerIsFighting = hasCondition(cid, CONDITION_INFIGHT)
}
if config.bankSystemEnabled == TRUE then
local m = tonumber(param)
if(param == "") then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Command requires param.")
return TRUE
end
if(not m) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Command requires numeric param.")
return TRUE
end
if m > 0 then
return false
end
m = math.abs(m)
if m <= getPlayerBalance(cid) then
doPlayerWithdrawMoney(cid, m)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Here you are, " .. m .. " gold. Your account balance is " .. getPlayerBalance(cid) .. ".")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "There is not enough gold on your account.")
end
return TRUE
else
return FALSE
end
end
Balance:
Lua:
function onSay(cid, words, param)
local config = {
bankSystemEnabled = getBooleanFromString(getConfigInfo('bankSystem')),
playerIsFighting = hasCondition(cid, CONDITION_INFIGHT)
}
if config.bankSystemEnabled == TRUE then
if config.playerIsFighting == FALSE then
doPlayerPopupFYI(cid, "Your account balance is " .. getPlayerBalance(cid) .. ".")
return TRUE
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Bank can not be used in fight.")
return TRUE
end
else
return FALSE
end
end
Last edited: