I'm having problems with the doPlayerRemoveMoney function in 0.3.6pl1, its returning a false value even though the player has money on him. The transcript example is below:
Transcript:
Code (Deposit):
Hope someone can help me out, this problem is annoying me now
Transcript:
12:18 GM Maverick [331]: hi
12:18 Naji [Bank]: Welcome to the Tibian bank, GM Maverick! What can I do for you?
12:18 GM Maverick [331]: deposit all
12:18 Naji [Bank]: Would you really like to deposit your all money, 10000 gold coins?
12:19 GM Maverick [331]: yes
12:19 Naji [Bank]: You don't have 10000 gold coins.
Code (Deposit):
Lua:
--deposit
if talk_state[cid] == 20 and getCount(msg) > 0 then
talk_state[cid] = 21
last_count[cid] = getCount(msg)
sayText = 'Would you really like to deposit ' .. last_count[cid] .. ' gold coins?'
elseif talk_state[cid] == 20 and msgcontains(msg, 'all') then
if getPlayerMoney(cid) <= 0 then
talk_state[cid] = 0
sayText = 'You don\'t have any money.'
else
talk_state[cid] = 21
last_count[cid] = getPlayerMoney(cid)
sayText = 'Would you really like to deposit your all money, ' .. last_count[cid] .. ' gold coins?'
end
elseif talk_state[cid] == 21 and getCount(msg) <= 0 then
if msgcontains(msg, 'yes') then
local balance = getPlayerBalance(cid)
if doPlayerRemoveMoney(cid,last_count[cid]) then --This is the problem line
setPlayerStorageValue(cid, 50505, balance+last_count[cid])
sayText = 'You deposited ' .. last_count[cid] .. ' gold coins. Now your account balance is ' .. getPlayerBalance(cid) .. ' gold coins.'
else
sayText = 'You don\'t have ' .. last_count[cid] .. ' gold coins.'
end
else
sayText = 'Well, can I help you with something else?'
end
talk_state[cid] = 0
end
Hope someone can help me out, this problem is annoying me now
Last edited: