From 51a1ee0b36d27d844f8fa8dc2cbe8d3a4daa1319 Mon Sep 17 00:00:00 2001 From: Katoteki <58405477+katotekii@users.noreply.github.com> Date: Sat, 9 Dec 2023 20:39:38 +0100 Subject: [PATCH] Update server.lua tested on 100+ players right now, without wait it wont insert in SQL, event better idea would be to put unique key on identifier and use `ON DUPLICATE KEY UPDATE` option --- modules/prison/server.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/prison/server.lua b/modules/prison/server.lua index 8dee252..dca20d0 100644 --- a/modules/prison/server.lua +++ b/modules/prison/server.lua @@ -91,6 +91,7 @@ function JailPlayer(source, time, index, noSave) TriggerClientEvent("pickle_prisons:jailPlayer", source, Prisoners[source]) if noSave then return end MySQL.Async.execute("DELETE FROM pickle_prisons WHERE identifier=@identifier;", {["@identifier"] = identifier}) + Wait(150) MySQL.Async.execute("INSERT INTO pickle_prisons (identifier, prison, time, inventory, sentence_date) VALUES (@identifier, @prison, @time, @inventory, @sentence_date);", { ["@identifier"] = Prisoners[source].identifier, ["@prison"] = Prisoners[source].index, @@ -372,4 +373,4 @@ end CreateThread(function() PrisonTimer() -end) \ No newline at end of file +end)