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

Database "query" and "result"

Nothxbye

Banned User
Joined
Jan 22, 2012
Messages
1,124
Reaction score
174
To set status = 1 in database from lua script it looks like:
Code:
db.query('UPDATE `players` SET `status` = 1 WHERE `id` = '..getPlayerGUIDByName(getCreatureName(cid))..'')

But how to check status whether it is 0 or 1 from database?
I've got something like this but it doesnt work:

Code:
local Info = result.getDataInt("SELECT `status` FROM `players` WHERE `id` = "..getPlayerGUIDByName("Name").." AND `status` = 1")
        if(Info:getID() ~= -1) then

        end

Using Otserv
 
LUA:
local res = db.getResult("SELECT `status` FROM `players` WHERE `id` = "..getPlayerGUIDByName("Name").." AND `status` = 1")
if res:getID() ~= -1 then
    local status = res:getDataInt("status")


    res:free()
end
 
Back
Top