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

Erick Lua

New Member
Joined
Apr 10, 2010
Messages
9
Reaction score
2
Hello everyone, I got a problem with this function that returns the player total capacity but it returns me a nil value, can anyone help me?

Code:
function getPlayerCap(cid)
	query = db.getResult("SELECT `cap` FROM `players` WHERE `id` = " .. getPlayerGUID(cid) .. ";")
	if(query:getID() < 1) then
		return nil
	end
	cap = query:getDataInt("cap")
	query:free()
	return cap
end
 
Lua:
function getPlayerCap(cid)
	local v = db.getResult("SELECT `cap` FROM `players` WHERE `id` = "..getPlayerGUID(cid)..";")
	local cap = v:getDataInt("cap", getPlayerGUID(cid))
	return cap
end

Tested and working, but it will send the player max capacity, know this.

I'll be glad if you rep++ :D
 
Back
Top