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, "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
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, "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
@up are you talking about getting the players money for a website or ingame? try getPlayerMoney(cid) ?
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
Try this function
Code: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