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

save błąd

Xordex

New Member
Joined
Dec 23, 2011
Messages
83
Reaction score
1
Witam mam błąd tfs 0.4

[11:10:11.589] [Error - GlobalEvent Interface]
[11:10:11.589] data/globalevents/scripts/save.lua:eek:nThink
[11:10:11.589] Description:
[11:10:11.589] data/globalevents/scripts/save.lua:5: attempt to index local 'result_plr' (a boolean value)
[11:10:11.589] stack traceback:
[11:10:11.589] data/globalevents/scripts/save.lua:5: in function <data/globalevents/scripts/save.lua:2>
[11:10:11.589] [Error - GlobalEvents::think] Couldn't execute event: save
[11:10:11.590] > Saving server...
[11:10:11.590] > SAVE: Complete in 1.23 seconds using relational house storage.

Moje save.lua
local requiredTime = 60 * 60 * 24 * 30
function onThink(interval, lastExecution)
doSaveServer()
local result_plr = db.query("SELECT * FROM `houses`;")
if(result_plr:getID() ~= -1) then
while(true) do

local owner = tonumber(result_plr:getDataInt("owner"))
local hid = tonumber(result_plr:getDataInt("id"))
local lastlogin = 0
local result = db.getResult("SELECT * FROM `players` WHERE `id` = ".. owner ..";")
if(result:getID() ~= -1) then
while(true) do

lastlogin = tonumber(result:getDataInt("lastlogin"))

if not(result:next()) then
break
end

end

result:free()
end

if lastlogin < os.time(t) - requiredTime then
setHouseOwner(hid, 0, true)
end

if not(result_plr:next()) then
break
end

end

result_plr:free()
end
return TRUE
end

Global
<globalevent name="save" interval="900000" event="script" value="save.lua"/>
Proszę o pomoc bo nic nei działaa
 
ML5pqYY.jpg

lol
 
Nie chce mi się czytać tego co napisałeś ale łap skrypt z mojego silnika:
Code:
local config = {
	broadcast = {120, 30},
	flags = 13,
	delay = 120,
	events = 30
}

local function executeSave(seconds)
	if(isInArray(config.broadcast, seconds)) then
		doBroadcastMessage("Server save within " .. seconds .. " seconds, please mind it may freeze!")
	end

	if(seconds > 0) then
		addEvent(executeSave, config.events * 1000, seconds - config.events)
	else
		doSaveServer(config.flags)
	end
end

function onThink(interval)
	if(table.maxn(config.broadcast) == 0) then
		doSaveServer(config.flags)
	else
		executeSave(config.delay)
	end

	return true
end

Code:
<globalevent name="save" interval="900000" event="script" value="save.lua"/>
 
Napisałem 3 posty naraz, bo wcześniej szukałem odpowiedzi na innym forum i nie znalazłem...

@Edit
Potem sprawdze, jak będzie all okey, rep poleci ;
 
Back
Top