Skip to content

Conversation

@ThembaMahlangu
Copy link

Describe Pull request
This PR fixes an issue where the nationality selection dropdown was empty during character creation. The fix modifies the GetNumberOfCharacters server callback to properly load and send the countries data from countries.json to the client. This is a critical fix as it restores core functionality of the character creation system, allowing players to properly select their character's nationality.

The fix:

  1. Loads the countries.json file using LoadResourceFile
  2. Decodes the JSON data into a Lua table
  3. Passes both the number of characters and countries list to the callback

This should be included in the core as nationality selection is a fundamental feature of character creation and this fix restores intended functionality without introducing new features or dependencies.

Related Issue: [If there's a GitHub issue, reference it here]

Questions:

  • Have you personally loaded this code into an updated qbcore project and checked all it's functionality? [yes]

    • Tested character creation
    • Verified nationality dropdown populates correctly
    • Confirmed data saves properly to database
    • Tested with both Config.customNationality true/false settings
  • Does your code fit the style guidelines? [yes]

    • Follows Lua formatting conventions
    • Uses existing QBCore patterns and functions
    • Maintains consistent error handling
    • No unnecessary code additions
  • Does your PR fit the contribution guidelines? [yes]

    • Fixes core functionality
    • Minimal and focused change
    • No breaking changes
    • Properly documented

@Qwerty1Verified
Copy link
Member

Doesn't this already get stored at the top of the file upon first execution?

@ChristianBDev
Copy link
Contributor

@Qwerty1Verified Yes line 3

@ThembaMahlangu
Copy link
Author

Honestly I wouldn't have done this if this was not so buggy, On character creation you have less than 80% chances of the nationality data to load so I got fed up and this way works all the times

@ThembaMahlangu
Copy link
Author

@ChristianBDev @Qwerty1Verified You can verify what I mean above, because just commenting won't help figure it out

@ChristianBDev
Copy link
Contributor

This request should be closed, this is already added to the script/code

Copy link
Contributor

@Z3rio Z3rio left a comment

Choose a reason for hiding this comment

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

This PR should be closed, as the logic has not been changed in any way at all from its current form.
Unless we can provide steps on how to actually recreate the issue concerning the Countries variable not loading correctly.

@ThembaMahlangu ThembaMahlangu deleted the fixes branch August 14, 2025 02:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants