Script permission jog grade

help

#1

hello, sorry for my bad english but i need help to this script:

function OpenCloakroomMenu()

  ESX.UI.Menu.Open(
    'default', GetCurrentResourceName(), 'cloakroom',
    {
      title    = _U('cloakroom'),
      align    = 'top-left',
      elements = {
        {label = _U('ems_clothes_civil'), value = 'citizen_wear'},
        {label = _U('inem_paramedico'), value = 'inem_paramedico'}, // i need this skin only for grade job "boss"
      },
    },
    function(data, menu)

      menu.close()

command to “boss” is - “PlayerData.job.grade_name == ‘boss’”


#2

So you want to make it so when someone types /boss, then the cloakroom opens?


#3

No, this script is the cloakroom menu, and I wanted to put the skin “inem_paramedico” only for boss, or just the boss could see the skin “inem_paramedico” in the cloakroom menu.


#4

Not familiar with ESX, so not able to help you, sorry.


#5

no problem, but someone can help me?

i try this code:

function OpenCloakroomMenu()

  ESX.UI.Menu.Open(
    'default', GetCurrentResourceName(), 'cloakroom',
    {
      title    = _U('cloakroom'),
      align    = 'top-left',
      elements = {
        {label = _U('ems_clothes_civil'), value = 'citizen_wear'},
        {PlayerData.job.grade_name == 'boss', label = _U('inem_paramedico'), value = 'inem_paramedico'},  -- This metod dont work :s 
      },
    },
    function(data, menu)

      menu.close()

      if data.current.value == 'citizen_wear' then
        ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin)
          local model = nil

          if skin.sex == 0 then
            model = GetHashKey("mp_m_freemode_01")
          else
            model = GetHashKey("mp_f_freemode_01")
          end

          RequestModel(model)
          while not HasModelLoaded(model) do
            RequestModel(model)
            Citizen.Wait(1)
          end

          SetPlayerModel(PlayerId(), model)
          SetModelAsNoLongerNeeded(model)

          TriggerEvent('skinchanger:loadSkin', skin)
          TriggerEvent('esx:restoreLoadout')
        end)
      end

      if PlayerData.job.grade_name == 'boss' and data.current.value  == 'inem_paramedico' then

        ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin)

        if skin.sex == 0 then
          local model = GetHashKey("inem_paramedico")

          RequestModel(model)
          while not HasModelLoaded(model) do
            RequestModel(model)
            Citizen.Wait(0)
          end

          SetPlayerModel(PlayerId(), model)
          SetModelAsNoLongerNeeded(model)
      else
          local model = GetHashKey("inem_paramedico")

          RequestModel(model)
          while not HasModelLoaded(model) do
            RequestModel(model)
            Citizen.Wait(0)
          end

          SetPlayerModel(PlayerId(), model)
          SetModelAsNoLongerNeeded(model)
          end

        end)
      end

      CurrentAction     = 'ambulance_actions_menu'
      CurrentActionMsg  = _U('open_menu')
      CurrentActionData = {}

    end,
    function(data, menu)
      menu.close()
    end
  )

end

I wanted to put this “inem_paramedico” skin only for “boss” but I am not able to get anyone to help?


#6
function OpenCloakroomMenu()

    local elements = {}

    table.insert(elements, {label = _U('ems_clothes_civil'), value = 'citizen_wear'})

    if PlayerData.job.grade_name == 'boss' then
        table.insert(elements, {label = _U('inem_paramedico'), value = 'inem_paramedico'})
    end

    ESX.UI.Menu.Open(
      'default', GetCurrentResourceName(), 'cloakroom',
      {
        title    = _U('cloakroom'),
        align    = 'top-left',
        elements = elements
      },
      function(data, menu)
  
        menu.close()
  
        if data.current.value == 'citizen_wear' then
          ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin)
            local model = nil
  
            if skin.sex == 0 then
              model = GetHashKey("mp_m_freemode_01")
            else
              model = GetHashKey("mp_f_freemode_01")
            end
  
            RequestModel(model)
            while not HasModelLoaded(model) do
              RequestModel(model)
              Citizen.Wait(1)
            end
  
            SetPlayerModel(PlayerId(), model)
            SetModelAsNoLongerNeeded(model)
  
            TriggerEvent('skinchanger:loadSkin', skin)
            TriggerEvent('esx:restoreLoadout')
          end)
        end
  
        if PlayerData.job.grade_name == 'boss' and data.current.value  == 'inem_paramedico' then
  
          ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin)
  
          if skin.sex == 0 then
            local model = GetHashKey("inem_paramedico")
  
            RequestModel(model)
            while not HasModelLoaded(model) do
              RequestModel(model)
              Citizen.Wait(0)
            end
  
            SetPlayerModel(PlayerId(), model)
            SetModelAsNoLongerNeeded(model)
        else
            local model = GetHashKey("inem_paramedico")
  
            RequestModel(model)
            while not HasModelLoaded(model) do
              RequestModel(model)
              Citizen.Wait(0)
            end
  
            SetPlayerModel(PlayerId(), model)
            SetModelAsNoLongerNeeded(model)
            end
  
          end)
        end
  
        CurrentAction     = 'ambulance_actions_menu'
        CurrentActionMsg  = _U('open_menu')
        CurrentActionData = {}
  
      end,
      function(data, menu)
        menu.close()
      end
    )
  
  end

This will work, tr this out!


#7

Thanks bro work fine!


#8

@MorreJaa did you replace a custom ped skin with the freemode MP skin for the ambulance job? Do you just replace work_wear with the ped name for example s_m_m_paramedic?