[HELP] RP scoreboard

Hi, i want get my rp name, job and ping to scoreboard but cant get this work.

my client.lua

ESX = nil

Citizen.CreateThread(function()
  while ESX == nil do
    TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
    Citizen.Wait(0)
  end
end)

local listOn = false

Citizen.CreateThread(function()
	TriggerServerEvent("sb_info", data)
    listOn = false
    while true do
        Wait(0)
		
        if IsControlPressed(0, 10)--[[ PageUp ]] 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>'..data.firstname .. ' ' .. data.lastname ..'</td><td>'.. data.job.label ..'</td><td>'.. data.ping ..'</td></tr>'
                    )
                end

                SendNUIMessage({ text = table.concat(players) })

                listOn = true
                while listOn do
                    Wait(0)
                    if(IsControlPressed(0, 10) == false) then
                        listOn = false
                        SendNUIMessage({
                            meta = 'close'
                        })
                        break
                    end
                end
            end
        end
    end
end, GetPlayerServerId(source))

function GetPlayers()
    local players = {}

    for i = 0, 31 do
        if NetworkIsPlayerActive(i) then
            table.insert(players, i)
        end
    end

    return players
end

and my server.lua

ESX = nil

TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)

RegisterServerEvent('sb_info')
AddEventHandler('sb_info', function(source, cb)
    local xPlayer = ESX.GetPlayerFromId(source)
    local identifier = GetPlayerIdentifiers(source)[1]
	
    local result = MySQL.Sync.fetchAll("SELECT * FROM users WHERE identifier = @identifier", {
      ['@identifier'] = identifier
    })

    local user      	= result[1]
    local firstname     = user['firstname']
    local lastname      = user['lastname']

    local data = {
      firstname = firstname,
      lastname = lastname,
	  job = xPlayer.job,
	  ping = GetPlayerPing(source)
    }
	cb(data)
end)

my console says

InvokeNative: execution failed: Argument at index 0 was null.
Error running system event handling function for resource scoreboard: citizen:/scripting/lua/scheduler.lua:41: Failed to execute thread: Execution of native 00000000ff7f66ab in script host failed.
stack traceback:
        [C]: in upvalue '_in'
        citizen:/scripting/lua/natives_server.lua:97: in function 'GetNumPlayerIdentifiers'
        citizen:/scripting/lua/scheduler.lua:245: in function 'GetPlayerIdentifiers'
        scoreboard_server.lua:8: in upvalue 'handler'
        citizen:/scripting/lua/scheduler.lua:174: in function <citizen:/scripting/lua/scheduler.lua:173>
stack traceback:
        [C]: in function 'error'
        citizen:/scripting/lua/scheduler.lua:41: in field 'CreateThreadNow'
        citizen:/scripting/lua/scheduler.lua:173: in function <citizen:/scripting/lua/scheduler.lua:138>

Thanks

Did you get this working?

3 Likes

GJ! GZ!! Well done m8!:star_struck::muscle::clap::clap::clap::clap::clap::clap:

Damn this looks really fricking good! Did you release this somewhere or are you keeping it private? If you were I wouldn’t blame you haha

will release after its done

1 Like

It is a beautiful model. You have the original me. Continue to study?

There is the possibility of putting this to download, it is very good this scoreboard of the best so far.

Pls m8 :smiley:

Hi, I want your scoreboard.

https://github.com/SuomiPelaajaa/rp-scoreboard

1 Like

I want the way you use it.

sir. can i ask you image what is this? and is it working for you ?

Sorry to revive but the link is dead