[Help] Menu Job


#1

Hi, I have a bug with my menu, it does not want to display, menu of the system. I make them myself

My code client.lua :

---------------------------------- VAR ----------------------------------
---------------------------------- VAR ----------------------------------
 local jobs = {
	opened = false,
	title = "Pole Emploi",
	currentmenu = "main",
	lastmenu = nil,
	currentpos = nil,
	selectedbutton = 0,
	marker = { r = 0, g = 155, b = 255, a = 200, type = 1 },
	menu = {
		x = 0.9,
		y = 0.08,
		width = 0.2,
		height = 0.04,
		buttons = 10,
		from = 1,
		to = 10,
		scale = 0.4,
		font = 0,
		["main"] = {
			title = "CATEGORIES",
			name = "main",
			buttons = {
				{title = "Métiers [Sans Etudes]", name = "Métiers [Sans Etudes]", description = ""},
			}
		},
		["Métiers [Sans Etudes]"] = {
			title = "Métiers [Sans Etudes]",
			name = "Métiers [Sans Etudes]",
			buttons = {
				{title = "Médecin", name = "Médecin", id = 2},
				{title = "Mineur", name = "Mineur", id = 3},
				{title = "Chauffeur de Taxi", name = "Chauffeur de Taxi", id = 4}, 
				{title = "Brasseur", name = "Brasseur", id = 5}, 
				{title = "Pêcheur", name = "Pêcheur", id = 6}, 
				{title = "Bûcheron", name = "Bûcheron", id = 7}, 
				{title = "Dépanneur", name = "Dépanneur", id = 8}, 
				{title = "Vigneron", name = "Vigneron", id = 9},
				{title = "Fermier", name = "Fermier", id = 10}, 
				{title = "Joaillier", name = "Joaillier", id = 11}, 
				{title = "Transporteur Brinks", name = "Transporteur Brinks", id = 12}, 
				{title = "Eléctricien", name = "Eléctricien", id = 13},
			}
		},
	}
}		
				
				
local changeYourJob = {
  {name="Pole Emploi", colour=68, id=407, x=-266.94, y=-960.744, z=31.2231},
}
 
---------------------------------- FUNCTIONS ----------------------------------
 
function drawMenuButton(button,x,y,selected)
	local menu = jobs.menu
	SetTextFont(menu.font)
	SetTextProportional(0)
	SetTextScale(menu.scale, menu.scale)
	if selected then
		SetTextColour(0, 0, 0, 255)
	else
		SetTextColour(255, 255, 255, 255)
	end
	SetTextCentre(0)
	SetTextEntry("STRING")
	AddTextComponentString(button.title)
	if selected then
		DrawRect(x,y,menu.width,menu.height,255,255,255,255)
	else
		DrawRect(x,y,menu.width,menu.height,0,0,0,150)
	end
	DrawText(x - menu.width/2 + 0.005, y - menu.height/2 + 0.0028)
end

function drawMenuInfo(text)
	local menu = jobs.menu
	SetTextFont(menu.font)
	SetTextProportional(0)
	SetTextScale(0.45, 0.45)
	SetTextColour(255, 255, 255, 255)
	SetTextCentre(0)
	SetTextEntry("STRING")
	AddTextComponentString(text)
	DrawRect(0.675, 0.95,0.65,0.050,0,0,0,150)
	DrawText(0.365, 0.934)
end

function drawMenuRight(txt,x,y,selected)
	local menu = jobs.menu
	SetTextFont(menu.font)
	SetTextProportional(0)
	SetTextScale(menu.scale, menu.scale)
	SetTextRightJustify(1)
	if selected then
		SetTextColour(0, 0, 0, 255)
	else
		SetTextColour(255, 255, 255, 255)
	end
	SetTextCentre(0)
	SetTextEntry("STRING")
	AddTextComponentString(txt)
	DrawText(x + menu.width/2 - 0.03, y - menu.height/2 + 0.0028)
end

function drawMenuTitle(txt,x,y)
local menu = jobs.menu
	SetTextFont(2)
	SetTextProportional(0)
	SetTextScale(0.5, 0.5)
	SetTextColour(255, 255, 255, 255)
	SetTextEntry("STRING")
	AddTextComponentString(txt)
	DrawRect(x,y,menu.width,menu.height,0,0,0,150)
	DrawText(x - menu.width/2 + 0.005, y - menu.height/2 + 0.0028)
end
 
---------------------------------- CITIZEN ----------------------------------
 
Citizen.CreateThread(function()
    for _, item in pairs(changeYourJob) do
      item.blip = AddBlipForCoord(item.x, item.y, item.z)
      SetBlipSprite(item.blip, item.id)
      SetBlipAsShortRange(item.blip, true)
      BeginTextCommandSetBlipName("STRING")
      AddTextComponentString(item.name)
      EndTextCommandSetBlipName(item.blip)
    end
end)
 
Citizen.CreateThread(function()
  while true do
    Citizen.Wait(0)
    if (IsNearJobs() == true) then
      drawTxt('Appuyer sur ~g~H~s~ pour accéder ou fermer le menu des métiers',0,1,0.5,0.8,0.6,255,255,255,255)
    if (IsControlJustPressed(1,Keys["H"]) and IsNearJobs() == true) then
      menuJobs()
      Menu.hidden = not Menu.hidden
    end
  end
    Menu.renderGUI()
  end
end)

RegisterNetEvent('jobssystem:updateJob')
AddEventHandler('jobssystem:updateJob', function(nameJob)
local id = PlayerId()
local playerName = GetPlayerName(id)
SendNUIMessage({
updateJob = true,
job = nameJob,
player = playerName
})
end)

#2

Help me please tanks you UP


#3

Linters can help to find syntaxe errors.
Citizen.Trace can help you to find your mistakes


#4

ok Other people please

Help me

Tanks You


#5

You wrote it ? Look much that vehshop menu ^^


#6

@Povers Check :slight_smile: Anyone a guy who steal your work


#7

UP Please, can you Help me Tanks You