Scoreboard job icon

hello everyone ,
i’m trying to put icon of job like ( :policeman:t2: Xoomer) in scoreboard but this happens

function UpdatePlayerTable(connectedPlayers)
	local formattedPlayerList, num = {}, 1
	local ems, police, taxi, mechanic, cardealer, customcar_dealer, estate, joker, munna, freakx, skull, ninja, players = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0

	for k,v in pairs(connectedPlayers) do
		
		if num == 1 then

			table.insert(formattedPlayerList, ('<tr><td>%s</td><td>%s</td><td>%s</td>'):format(v.name, v.id, v.ping))
			if v.job == 'ambulance' then
				table.insert(formattedPlayerList, ('%s👨‍⚕️'):format(v.name, v.id, v.ping))
			elseif v.job == 'police' then
				table.insert(formattedPlayerList, ('<td>👮🏻 %s </td>'):format(v.name))
			end

			
			num = 2
		elseif num == 2 then
			table.insert(formattedPlayerList, ('<td>%s</td><td>%s</td><td>%s</td></tr>'):format(v.name, v.id, v.ping))

			num = 1
		end

		players = players + 1

		if v.job == 'ambulance' then
			ems = ems + 1
		elseif v.job == 'police' then
			police = police + 1
		elseif v.job == 'taxi' then
			taxi = taxi + 1
		elseif v.job == 'mechanic' then
			mechanic = mechanic + 1
		elseif v.job == 'cardealer' then
			cardealer = cardealer + 1
		elseif v.job == 'custom_cardealer' then
			customcar_dealer = customcar_dealer + 1
		elseif v.job == 'realestateagent' then
			estate = estate + 1
		elseif v.job == 'joker' then
			joker = joker + 1
		elseif v.job == 'munna' then
			munna = munna + 1
		elseif v.job == 'freakx' then
			freakx = freakx + 1
		elseif v.job == 'skull' then
			skull = skull + 1
		elseif v.job == 'ninja' then
			ninja = ninja + 1
		end
	end

	if num == 1 then
		table.insert(formattedPlayerList, '</tr>')
	end

	SendNUIMessage({
		action  = 'updatePlayerList',
		players = table.concat(formattedPlayerList)
	})

	SendNUIMessage({
		action = 'updatePlayerJobs',
		jobs   = {ems = ems, police = police, taxi = taxi, mechanic = mechanic, cardealer = cardealer, customcar_dealer = customcar_dealer, estate = estate,  joker = joker, munna = munna, freakx = freakx, skull = skull, ninja = ninja, player_count = players}
	})
end

You are first inserting the player entry and then inserting it again if the player has a certain job

1 Like

thanks got ur point and i didnt saw that i just fixed it :slight_smile: <3

1 Like