Hey, so i have been looking in the forums but i cant find what i want. So ill post it here.
I want to transfer the amount of certain jobs connected to the client side.
Server side:
RegisterServerEvent('tomy_scoreboard:retrieveJobs')
AddEventHandler('tomy_scoreboard:retrieveJobs', function(police, ambulance, mechanic, taxi)
local xPlayers = ESX.GetPlayers()
local xPlayer = ESX.GetPlayerFromId(source)
if xPlayer ~= nil then
-- POLICIAS
local police = 0
for i=1, #xPlayers, 1 do
local xPlayer = ESX.GetPlayerFromId(xPlayers[i])
if xPlayer.job.name == 'police' then
police = police + 1
end
end
-- EMS
local ambulance = 0
for i=1, #xPlayers, 1 do
local xPlayer = ESX.GetPlayerFromId(xPlayers[i])
if xPlayer.job.name == 'ambulance' then
ambulance = ambulance + 1
end
end
-- MECHANIC
local mechanic = 0
for i=1, #xPlayers, 1 do
local xPlayer = ESX.GetPlayerFromId(xPlayers[i])
if xPlayer.job.name == 'mechanic' then
mechanic = mechanic + 1
end
end
-- TAXI
local taxi = 0
for i=1, #xPlayers, 1 do
local xPlayer = ESX.GetPlayerFromId(xPlayers[i])
if xPlayer.job.name == 'taxi' then
taxi = taxi + 1
end
end
end
end)
What should i put on client? the values have to change the variables with the same names in client (those will change it in the HTML stream of the scoreboard)
Thanks for your time!