Itutorial
Legendary OT User
- Joined
- Dec 23, 2014
- Messages
- 2,335
- Solutions
- 68
- Reaction score
- 1,013
So I am making a banking code and I can't seem to use param at all...
I can use !balance but I can't do !deposit all or !deposit 1000. I cant even print the param it is just empty....
in xml
Lua:
function onSay(player, words, param)
if words == "!balance" then
player:popupFYI("[Balance]: "..player:getBankBalance())
return false
elseif words == "!deposit" then
if not param then
player:sendCancelMessage("Usage: !deposit all / !deposit amount")
return false
end
if param == "all" then
local amount = player:getMoney()
if not amount then
player:sendCancelMessage("You do not have any gold to deposit.")
return false
end
player:removeMoney(amount)
local oldBalance = player:getBankBalance()
player:setBankBalance(player:getBankBalance() + amount)
player:popupFYI("[Old Balance]: "..oldBalance.."\n[New Balance]: "..player:getBankBalance())
return false
else
local amount = tonumber(param)
if amount < 0 or amount > 100000000 then
player:sendCancelMessage("You can only deposit 1-100kk gold at a time.")
return false
end
if not player:removeMoney(amount) then
player:sendCancelMessage("You do not have that much gold.")
return false
end
local oldBalance = player:getBankBalance()
player:setBankBalance(player:getBankBalance() + amount)
player:popupFYI("[Old Balance]: "..oldBalance.."\n[New Balance]: "..player:getBankBalance())
return false
end
end
return false
end
I can use !balance but I can't do !deposit all or !deposit 1000. I cant even print the param it is just empty....
in xml
XML:
<talkaction words="!balance" separator=" " script="banking.lua" />
<talkaction words="!deposit" separator=" " script="banking.lua" />
<talkaction words="!withdraw" separator=" " script="banking.lua" />
<talkaction words="!transfer" separator=" " script="banking.lua" />
Last edited: