-
Notifications
You must be signed in to change notification settings - Fork 224
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
🔑 Optionally save acquired keys into DB #265
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of doing it from the client, handle it on the server since to give someone keys the server event gets triggered which also checks if they should be giving keys.
I'd also probably change the config value to be more something like Config.PersistentKeys
although others might disagree. I'll ask others.
Quoted from my comment left Apr 18 in your past PR for this, #255.
Yes indeed, from your side though... |
If you want pointers on how to improve it, I'll gladly assist |
This changes should do the trick |
… iteration and fixed lint error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall great, much better approach this time! 👍🏼 🚀
Some of these "comments" might be a bit nitpicky, other ones quite blatant/more important.
Do as you wish with my feedback. Great work this far!
TriggerClientEvent('qb-vehiclekeys:client:RemoveKeys', id, plate) | ||
end | ||
|
||
exports('RemoveKeys', RemoveKeys) | ||
|
||
function HasKeys(id, plate) | ||
local citizenid = QBCore.Functions.GetPlayer(id).PlayerData.citizenid | ||
local Player = QBCore.Functions.GetPlayer(id) | ||
if not Player then return false end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if not Player then return false end | |
if not Player then | |
return false | |
end |
better readability
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think is better to keep it one line, it's cleaner from my view
TriggerClientEvent('QBCore:Notify', id, Lang:t('notify.vgetkeys')) | ||
TriggerClientEvent('qb-vehiclekeys:client:AddKeys', id, plate) | ||
end | ||
|
||
exports('GiveKeys', GiveKeys) | ||
|
||
function RemoveKeys(id, plate) | ||
local citizenid = QBCore.Functions.GetPlayer(id).PlayerData.citizenid | ||
local Player = QBCore.Functions.GetPlayer(id) | ||
if not Player then return end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if not Player then return end | |
if not Player then | |
return | |
end |
better readability
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think is better to keep it one line, it's cleaner from my view
Co-authored-by: Zerio <[email protected]>
Co-authored-by: Zerio <[email protected]>
Co-authored-by: Zerio <[email protected]>
Thanks for the ideas and corrections, comments like that are always welcome |
if this going to be added? |
Describe Pull request
This PR makes so the aquired keys will be saved into DB so when the server restarts you will still have the keys you were given. This feature is optional and can be set in the Config file. The PR is made to answer this suggestion [SUGGESTION] Database keys. I believe that is easier to make this into player metadata instead of a full new database table. Also this PR was already open, but also closed because of lack of answer, so I decided to make a new one: old one here.
Questions (please complete the following information):