Skip to content

Conversation

WhereiamL
Copy link

Code Refactor

Describe Pull request
First, make sure you've read and are following the contribution guidelines and style guide and your code reflects that.
Write up a clear and concise description of what your pull request adds or fixes and if it's an added feature explain why you think it should be included in the core.

If your PR is to fix an issue mention that issue here

Questions (please complete the following information):

  • Have you personally loaded this code into an updated qbcore project and checked all it's functionality? [yes/no] (Be honest)
  • Does your code fit the style guidelines? [yes/no]
  • Does your PR fit the contribution guidelines? [yes/no]

Code Refactor
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.

Looks good to me, would perhaps just recommend simplifying the Ternary to provide better readability

Comment on lines +15 to +16
local paymentMethod = Player.PlayerData.money.cash >= Config.TruckerJobTruckDeposit and 'cash' or
Player.PlayerData.money.bank >= Config.TruckerJobTruckDeposit and 'bank' or nil
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
local paymentMethod = Player.PlayerData.money.cash >= Config.TruckerJobTruckDeposit and 'cash' or
Player.PlayerData.money.bank >= Config.TruckerJobTruckDeposit and 'bank' or nil
local paymentMethod
if Player.PlayerData.money.cash >= Config.TruckerJobTruckDeposit then
paymentMethod = 'cash'
elseif Player.PlayerData.money.bank >= Config.TruckerJobTruckDeposit then
paymentMethod = 'bank'
end

This would be more readable, especially for people who havent used Lua a lot in the past and are unaware of this (unconventional outside of Lua) ternary operation

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.

2 participants