How to set an access menu for only 1 job

Hi, I’m looking for how to make a menu that is accessible for just one job?
An idea ? Thank you

2 option :

  1. use a script menu like nativeUI or similar
  2. code your own menu.

Ok sorry men i give You code

 if IsControlJustPressed(1, key) and Idjob ==2 then 

My Serveur.lua

function Idjob(player)
  local executed_query = MySQL:executeQuery("SELECT identifier, job_id, job_name FROM users LEFT JOIN jobs ON jobs.job_id = users.job WHERE users.identifier = '@identifier'", {['@identifier'] = player})
  local result = MySQL:getResults(executed_query, {'job_id'}, "identifier")
  return tostring(result[1].job_id)
end
1 Like

you have to send the result to the client side with a TriggerClientEvent , and then on client side you create your menu .
if you want to do it manualy the easy way is to draw rectangle and text with the native.

I did that but it does not work. How can I do

Code client.lua Pressed

Citizen.CreateThread(function()
    while true do
        Citizen.Wait(0)
        if IsControlJustPressed(1, 166) then 
		if jobId == 6 then
            Main()
            Menu.hidden = not Menu.hidden
		else
		end
        end
        Menu.renderGUI(options)
    end
end)

server.lua :

function idJob(player)
  local result = MySQL.Sync.fetchAll("SELECT identifier, job_id, job_name FROM users LEFT JOIN jobs ON jobs.job_id = users.job WHERE users.identifier = @identifier", {['@identifier'] = player})
  return tostring(result[1].job_id)
end

function GetJobId(source)
  local jobId = -1
 
  TriggerEvent('es:getPlayerFromId', source,
    function(user)
      local result = MySQL.Sync.fetchAll("SELECT identifier, job_id, job_name FROM users LEFT JOIN jobs ON jobs.job_id = users.job WHERE users.identifier = @identifier AND job_id IS NOT NULL", {['@identifier'] = user.identifier})
 
      if (result[1] ~= nil) then
        jobId = result[1].job_id
      end
    end
  )
 
  return jobId
end

How can I do ?