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

Lua doPlayerRemoveMoney problem

BeniS

Advanced OT User
Senator
Joined
Aug 8, 2009
Messages
1,850
Reaction score
189
Location
New Zealand
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:
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 :p
 
Last edited:
Back
Top