Skip to content

fix(es_extended/server/functions): missing attributes for unemployed#1614

Merged
Kenshiin13 merged 4 commits into
esx-framework:devfrom
t1ger-scripts:dev
Feb 18, 2025
Merged

fix(es_extended/server/functions): missing attributes for unemployed#1614
Kenshiin13 merged 4 commits into
esx-framework:devfrom
t1ger-scripts:dev

Conversation

@t1ger-scripts

@t1ger-scripts t1ger-scripts commented Feb 17, 2025

Copy link
Copy Markdown
Contributor

Missing attributes when indexing unemployed job into ESX.Jobs. Database contains name column for jobs table and for job_grades it also contain a grade name column.

Also fixed loop method for grades when inserting into queries.

Description

Adds the missing attributes when assigning unemployed to ESX.Jobs if no jobs are found.
Also fixed loop method for grades when inserting into queries.

Motivation

Because it makes sense

Implementation Details

N/A

Usage Example

3rd party script that compares grades[].name wouldn't work if this attribute is missing.
Fixes issues where creators parse job grades indexed with strings.

PR Checklist

  • My commit messages and PR title follow the Conventional Commits standard.
  • My changes have been tested locally and function as expected.
  • My PR does not introduce any breaking changes.
  • I have provided a clear explanation of what my PR does, including the reasoning behind the changes and any relevant context.

Added missing attributes for unemployed job if no Jobs found
@t1ger-scripts t1ger-scripts changed the title fix: missing attributes for unemployed fix(es_extended/server/functions): missing attributes for unemployed Feb 17, 2025

@Kenshiin13 Kenshiin13 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xPlayer.job.whitelisted is still missing

Added the missing whitelisted attribute for defaulted unemployed job.
@t1ger-scripts

Copy link
Copy Markdown
Contributor Author

xPlayer.job.whitelisted is still missing

Corrected, thanks.

The queries assume that the parsed grades are numerically indexed. But removing ipairs method, and using pairs method, allows to loop grades that are indexed with strings as well. Just like we are using pairs method inside generatenewJobTable
@t1ger-scripts

t1ger-scripts commented Feb 17, 2025

Copy link
Copy Markdown
Contributor Author

Added another commit to this PR as well:

The queries assume that the parsed grades are numerically indexed. But removing ipairs method, and using pairs method, allows to loop grades that are indexed with strings as well. Just like we are using pairs method inside generatenewJobTable.

Comment thread [core]/es_extended/server/modules/createJob.lua Outdated
Added checks for skin_male and skin_female before json encoding to prevent 'NULL' entries in database
@t1ger-scripts

Copy link
Copy Markdown
Contributor Author
grade.skin_male and json.encode(grade.skin_male) or '{}'
grade.skin_female and json.encode(grade.skin_female) or '{}'

Should do the trick.

Fixed.

@Kenshiin13 Kenshiin13 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@Kenshiin13 Kenshiin13 merged commit abedb49 into esx-framework:dev Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Ready for Next Update

Development

Successfully merging this pull request may close these issues.

2 participants