• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua How do you return db.query integer?

mackerel

Well-Known Member
Joined
Apr 26, 2017
Messages
398
Solutions
18
Reaction score
74
I need healthmax of my character but it returns true, instead of a number

LUA:
        local currentHealth = db.query("SELECT `healthmax` FROM `players` WHERE `players`.`id` = " .. getPlayerGUID(oldPlayer) .. ";")
        print(currentHealth)


using tfs 1.0
 
Solution
LUA:
local resultId = db.storeQuery("SELECT `healthmax` FROM `players` WHERE `players`.`id` = " .. getPlayerGUID(oldPlayer) .. ";")
if resultId ~= false then
    print(result.getDataInt(resultId, "healthmax"))
    result.free(resultId)
end
LUA:
local resultId = db.storeQuery("SELECT `healthmax` FROM `players` WHERE `players`.`id` = " .. getPlayerGUID(oldPlayer) .. ";")
if resultId ~= false then
    print(result.getDataInt(resultId, "healthmax"))
    result.free(resultId)
end
 
Last edited:
Solution
Back
Top