Code:
local function something(playerGUID)
local lastDeath = db.storeQuery("SELECT time FROM player_deaths WHERE player_id = " .. playerGUID .. " ORDER BY time")
if lastDeath ~= false then
local timeStamp = result.getNumber(lastDeath, "time")
result.free(lastDeath)
return timeStamp
end
return 0
end
something(player:getGuid())
i get ERRORS: getNumber is nil
this line: local timeStamp = result.getNumber(lastDeath, "time")
I tried several other possibilites too, all gave nil error.
local timeStamp = result.getNumber(lastDeath, time)
local timeStamp = result.getNumber(lastDeath)
local timeStamp = result.getNumber("time")
local timeStamp = result.getNumber(time)
local timeStamp = result.getSring(lastDeath, "time")
local timeStamp = result.getSring(lastDeath, time)
local timeStamp = result.getSring(lastDeath)
local timeStamp = result.getSring("time")
local timeStamp = result.getSring(time)
EDIT: ITS ALIVE!!!!
local timeStamp = result.getDataInt(lastDeath, "time")
was the function what made it work
Full Working script:
Code:
local function NinjaOPFunction(playerGUID)
local lastDeath = db.storeQuery("SELECT time FROM player_deaths WHERE player_id = " .. playerGUID .. " ORDER BY time")
if lastDeath ~= false then
local timeStamp = result.getDataInt(lastDeath, "time")
result.free(lastDeath)
return timeStamp
end
return 0
end
local lastDeath = NinjaOPFunction(player:getGuid())