I currently have a row called ‘uniqueid’ that contains a players steamid, but it can be in the row more than one time.
Right now I have it setup so when a player spawns, it checks to see if they are in the database, and if they are, it gives them what is in the “item” row.
It works fine if there is just one time their steam id is in the row, but when it is there more than once, it doesn’t give them all their items at once, it does it one at a time in 5 second intervals.
Is there a way to have it so it gives them all their items in the first 5 seconds, and not every 5 seconds per item?
Currently my code is:
function TestSQLFunc(ply) timer.Create("KeepChecking"..ply:UniqueID(), 5, 0, function() local check = db5:query("SELECT * FROM `test` WHERE `uniqueid`='"..ply:SteamID64().."' AND `redeemed` = '0' GROUP BY `tid`;") check.onSuccess = function(q, d ) if checkQuery(q) then local info = q:getData() local redeemed = info.redeemed; local item = info.item; local tid = info.tid; if (redeemed == "0") then if (item == "test") then ply:SendLua("print('got the test')") elseif (item == "test2") then ply:SendLua("print('got test 2')") end end end end check.onError = function(q, e) ServerLog("Failed to check test data"..e) end check:start() end) end hook.Add("PlayerInitialSpawn", "TestSQLFunc", TestSQLFunc)
And it prints out
got the test --5 seconds later got test 2
thanks in advance