function getPlayerMoneyEx(cid)
local pid = getPlayerGUID(cid)
if(pid == nil) then
error("Cannot load player.")
end
local count, moneyInItems, moneyInDp = 0, 0, 0
local ids = {{2160, 10000}, {2152, 100}, {2148, 1}}
for i = 1, 3 do
moneyInItems = db.getResult("SELECT `count` FROM `player_items` WHERE `player_id` = " ..pid.. " AND `itemtype` = " ..ids[i][1]..";")
moneyInDp = db.getResult("SELECT `count` FROM `player_depotitems` WHERE `player_id` = " ..pid.. " AND `itemtype` = " ..ids[i][1]..";")
if(money:getID() >= 0) then
count = count + moneyInItems:getDataInt('count') * ids[i][2]
end
if(moneyInDp:getID() >= 0) then
count = count + moneyInDp:getDataInt('count') * ids[i][2]
end
moneyInItems:free()
moneyInDp:free()
end
return count
end