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

Windows Is it possible to check how much money...

Xeo

Zote
Joined
Jun 14, 2009
Messages
129
Solutions
1
Reaction score
2
Location
Chile
Is it possible to check how much money every player has?like sql command or something?
Thanks.
 
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
 
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

Isnt that bank system code? what if the player doesnt uses it and the money is inside his depot :(
 
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
 
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

How can I implement this? it's a talkaction?
 
Back
Top