HumanTree92/esx_advancedjail

Not a bug more so a fix for a bug.

Closed this issue · 0 comments

Describe the Bug | A Clear & Concise Description of Bug

Questions
Have you made changes to anything in client/main.lua or server/main.lua?:
Have you looked through the Closed Topics?:
Have you looked through the Wiki?:
Are you using a Pre-Installed ESX? If Yes who?:
Are you using es_extended? If Yes what Version? (Example: 1.2):
Are you using Essentialmode?:
Are you using ExtendedMode?:
Are you using OneSync?:
Linux or Windows?:

Hey this is actually none of the above, I dont like doing pull requests but wanted to let anyone know who has an error for Config on line 107 in server this is the fix

Replace thread with this

Citizen.CreateThread(function()
while true do
Citizen.Wait(waittime)
local tasks = {}

	for playerId,data in pairs(playersInJail) do
		local task = function(cb)
			MySQL.Async.execute('UPDATE users SET jail_time = @time_remaining WHERE identifier = @identifier', {
				['@identifier'] = data.identifier,
				['@time_remaining'] = data.timeRemaining
			}, function(rowsChanged)
				cb(rowsChanged)
			end)
		end

		table.insert(tasks, task)
	end

	Async.parallelLimit(tasks, 4, function(results) end)
end

end)

And place local waittime = Config.JailTimeSyncInterval on line 3 of server.lua
It seems that u cannot call Config in a wait, which I didnt know this either until I tested it on other things. SO a workaround
is to variable the config calling and just put variable in its place :D
Thanks!