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

Update events.lua #1102

Merged
merged 4 commits into from
May 23, 2024
Merged

Update events.lua #1102

merged 4 commits into from
May 23, 2024

Conversation

TehSteel
Copy link
Contributor

Description

Added a trigger whenever a player leaves the server.

Checklist

  • I have personally loaded this code into an updated qbcore project and checked all of its functionality.
  • My code fits the style guidelines.
  • My PR fits the contribution guidelines.

@GhzGarage
Copy link
Member

What're you using this for

@TehSteel
Copy link
Contributor Author

You can't directly access a dropped player's data without "complicating" things too much.
If you want to access a dropped player's data, you need to listen to onPlayerLoaded event and save the citizenid inside a table and when playerDropped event occurs, you need to check if the citizenid exists.
Only then can you use QBCore.Functions.GetOfflinePlayerByCitizenId.
Even if you use this method, it makes unnecessary SQL queries instead of making a trigger and passing the Player object.

@GhzGarage GhzGarage merged commit a36cd49 into qbcore-framework:main May 23, 2024
1 of 2 checks passed
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.

None yet

2 participants