Hi so I’m making a playlist script but having trouble with the java script displaying words above the player list. I have it done in HTML but is buggy. So how would I get a second table that works.
I’m guessing I broke it by doing 2 buf.find tables. Any help would be great.
And if your wondering why not just keep it HTML, It pops up when you first join the server in its box with the Headings in the player list box making you press ^ (arrow) to remove it / reset it.
local listOn = false
Citizen.CreateThread(function()
listOn = false
while true do
Wait(0)
if IsControlPressed(0, 27)--[[ INPUT_PHONE ]] then
if not listOn then
local players = {}
ptable = GetPlayers()
for _, i in ipairs(ptable) do
table.insert(players,
'<tr style="color: rgb(255, 255, 255); font-weight: 500;"><td>' .. GetPlayerServerId(i) .. '</td><td>' ..GetPlayerName(i)..'</td></tr>' -- The "color: rgb" sets the color of the list
)
end
SendNUIMessage({ text = table.concat(players) })
listOn = true
while listOn do
Wait(0)
if(IsControlPressed(0, 27) == false) then
listOn = false
SendNUIMessage({
meta = 'close'
})
break
end
end
end
end
end
end)
function GetPlayers()
local players = {}
for i = 0, 31 do
if NetworkIsPlayerActive(i) then
table.insert(players, i)
end
end
return players
end