Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Job locked licenses #7

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

SirOMGitsYOU
Copy link
Contributor

Add the ability for Cityhall to check for job roles for licenses to be displayed

Also added comments into the config just for clarification on each part and added commented out job role for weapon license as an example

@NietThijmen
Copy link
Member

Would it be possible to check in the config it a job lock is defined and only it if it designed to check (might need to do the same for license)

@SirOMGitsYOU
Copy link
Contributor Author

Would it be possible to check in the config it a job lock is defined and only it if it designed to check (might need to do the same for license)

I don't think I'm understanding what you mean sorry, Currently it works the same way the licenses works where licenses are checking your player metadata on open, the job does the same thing where on open it will check if you have the job and if you job name matches the one defined in the config and if so you see that license

@NietThijmen
Copy link
Member

Would it be possible to check in the config it a job lock is defined and only it if it designed to check (might need to do the same for license)

I don't think I'm understanding what you mean sorry, Currently it works the same way the licenses works where licenses are checking your player metadata on open, the job does the same thing where on open it will check if you have the job and if you job name matches the one defined in the config and if so you see that license

Something like

if Config.job then 
  if PlayerData.job.name ~= Config.job then 
     Code to continue the loop without adding the option
  end
end

@SirOMGitsYOU
Copy link
Contributor Author

So just to make sure I understand is Config.Job a table of jobs or a true or false? as I've tried to implement this but I'm really struggling to understand from the example if that is meant to be a table or true or false, and if it's a table I'm not sure how this is different to how it is working currently.

Apologies if this is something really obvious/dumb I'm still learning when it comes to fivem and lua

@NietThijmen
Copy link
Member

So just to make sure I understand is Config.Job a table of jobs or a true or false? as I've tried to implement this but I'm really struggling to understand from the example if that is meant to be a table or true or false, and if it's a table I'm not sure how this is different to how it is working currently.

Apologies if this is something really obvious/dumb I'm still learning when it comes to fivem and lua

It is both, sort of.

If you make it a string or table and do

local job = "police"

if job then 
--this code runs, as job is defined
--this wont run if job is false or nil or not defined
--if you put the jobcheck in here it will only run if a job is defined, and you can also have licenses without a job lock / needed license.
end

@morethancodenl morethancodenl locked and limited conversation to collaborators Sep 25, 2023
@Mitchel Mitchel marked this pull request as draft September 25, 2023 11:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants