Hi, I just have a little problem with my eup-ui because i want to set the menù only for the police and this is the lua file.

just get current player job and look if its police something like
if playerjob == “police” then
it was just an example this is how you do it :
add this function :
function QBCore.Functions.GetPlayerData(cb)
if not cb then return QBCore.PlayerData end
cb(QBCore.PlayerData)
end
and add this in your register command :
RegisterCommand("eup", function()
local Player = QBCore.Functions.GetPlayerData()
local jobName = Player.job.name
if jobName == "police" then
mainMenu:Visible(not mainMenu:Visible())
else
print("you dont have the right job to do that")
end
end
u can find an example here:Client Function Reference - QBCore Documentation
1 Like
It’s work, but i had to add this at the first line:
local QBCore = exports['qb-core']:GetCoreObject()
and then how you said i’ve put this:
RegisterCommand("eup", function()
local Player = QBCore.Functions.GetPlayerData()
local jobName = Player.job.name
if jobName == "police" then
mainMenu:Visible(not mainMenu:Visible())
else
print("you dont have the right job to do that")
end
end
Thank u so much!!!
Hi leo_melo07,
I would suggest you to not trust on client side.
Register a commands on server-side only (While fetching player data).
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
