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

Solved Lua Script Error: [GlobalEvent Interface]

Hugofasima

Website: thenosegang.servegame.com
Joined
Jun 24, 2015
Messages
206
Reaction score
23
Anyone can fix this script to me?

Error:
Lua Script Error: [GlobalEvent Interface]
data/globalevents/scripts/others/cleanHouse.lua: onStartup
data/globalevents/scripts/others/cleanHouse.lua:12: attempt to index a nil value

stack traceback:
[C]: in function '__index'
data/globalevents/scripts/others/cleanHouse.lua:12: in function <data/globalevents/scripts/others/cleanHouse.lua:3>

local days = 20 -- days to lose the house

function onStartup()
local resultId = db.storeQuery("SELECT `owner`,`id` FROM `houses`;")

if resultId then
repeat
local aux = db.storeQuery("SELECT `lastlogin` FROM `players` WHERE `id` = ".. result.getDataString(resultId, "owner") .. ";")

if aux then
if result.getDataInt(aux, "lastlogin") < os.time() - (days * 86400) then
House(result.getDataInt(resultId, "id")):setOwnerGuid(-1)
end
end

until not result.next(resultId)
end
saveServer()

return true
end

Thanks OT Land!


@EDIT: TFS 1.0 / Gesior 2012
 
Last edited:
Anyone can fix this script to me?

Error:
Lua Script Error: [GlobalEvent Interface]
data/globalevents/scripts/others/cleanHouse.lua: onStartup
data/globalevents/scripts/others/cleanHouse.lua:12: attempt to index a nil value

stack traceback:
[C]: in function '__index'
data/globalevents/scripts/others/cleanHouse.lua:12: in function <data/globalevents/scripts/others/cleanHouse.lua:3>

local days = 20 -- days to lose the house

function onStartup()
local resultId = db.storeQuery("SELECT `owner`,`id` FROM `houses`;")

if resultId then
repeat
local aux = db.storeQuery("SELECT `lastlogin` FROM `players` WHERE `id` = ".. result.getDataString(resultId, "owner") .. ";")

if aux then
if result.getDataInt(aux, "lastlogin") < os.time() - (days * 86400) then
House(result.getDataInt(resultId, "id")):setOwnerGuid(-1)
end
end

until not result.next(resultId)
end
saveServer()

return true
end

Thanks OT Land!
can you show me the players sql table :)
 
can you show me the players sql table :)

Versions: TFS 1.0 / Gesior 2012

Is that right?

Untitled.jpg
 
The only change I made was to check to make sure there was a house. This way at least won't throw an error message. ( I hope :p )
Code:
local days = 20 -- days to lose the house

function onStartup()
local resultId = db.storeQuery("SELECT `owner`,`id` FROM `houses`;")

    if resultId then
    repeat
    local aux = db.storeQuery("SELECT `lastlogin` FROM `players` WHERE `id` = " .. result.getDataString(resultId, "owner") .. ";")

        if aux then
            if result.getDataInt(aux, "lastlogin") < os.time() - (days * 86400) then
                local house = House(result.getDataInt(resultId, "id"))
                    if house then
                        house:setOwnerGuid(-1)
                    end
            end
        end

    until not result.next(resultId)
    end
saveServer()

return true
end
 
The only change I made was to check to make sure there was a house. This way at least won't throw an error message. ( I hope :p )
Code:
local days = 20 -- days to lose the house

function onStartup()
local resultId = db.storeQuery("SELECT `owner`,`id` FROM `houses`;")

    if resultId then
    repeat
    local aux = db.storeQuery("SELECT `lastlogin` FROM `players` WHERE `id` = " .. result.getDataString(resultId, "owner") .. ";")

        if aux then
            if result.getDataInt(aux, "lastlogin") < os.time() - (days * 86400) then
                local house = House(result.getDataInt(resultId, "id"))
                    if house then
                        house:setOwnerGuid(-1)
                    end
            end
        end

    until not result.next(resultId)
    end
saveServer()

return true
end

And you're right !!!

100% SOLVED! THANK YOU!!!
 
Back
Top