Hopefully fix the error when charging

I think if you had alot of players, it would overload itself and slip in a nil value when checking for player info

This checks if it is a real source number being sent and also adds a slightly delay to help load easier
This commit is contained in:
Jim Shield
2025-05-07 15:58:03 +01:00
parent 5cc7b60a1f
commit 29b3b2ffb9

View File

@@ -21,8 +21,11 @@ registerCommand("cashregister", {
createCallback(getScript()..":MakePlayerList", function(source)
local onlineList = {}
for _, v in pairs(GetPlayers()) do
local Player = getPlayer(v)
onlineList[#onlineList+1] = { value = tonumber(v), text = "["..v.."] - "..Player.name }
if v ~= nil or type(v) ~= "number" then
local Player = getPlayer(v)
onlineList[#onlineList+1] = { value = tonumber(v), text = "["..v.."] - "..Player.name }
Wait(10)
end
end
return onlineList
end)