-
Notifications
You must be signed in to change notification settings - Fork 50
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
restructure ambulancejob #69
base: dev
Are you sure you want to change the base?
Conversation
N0tNvll
commented
Jan 15, 2025
- Separate files in different files for a better structure
- Remove parts from deathscreen to make in independent from ambulancejob
- Added check for dead status in bills
- Created a function to get the status dead of the player in case that wont be present in the list always be false like expected
- Added checks in remove and add inventory items for valid items
chore: merge dev into main
client/deathHandler.lua
Outdated
@@ -0,0 +1,177 @@ | |||
RegisterNetEvent('esx_ambulancejob:clsearch') | |||
AddEventHandler('esx_ambulancejob:clsearch', function(medicId) |
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.
Remove the AddEventHandler where there already is a RegisterNetEvent present
( Everywhere in the resource )
client/deathHandler.lua
Outdated
AddEventHandler('esx_ambulancejob:clsearch', function(medicId) | ||
local playerPed = PlayerPedId() | ||
|
||
if isDead then |
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.
avoid to much code inside of if statements
( if not isDead then return end )
( Everywhere in the resource work with early returns where possible )
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.
Can you overall remove the nestling code in the if statements where it isnt needed
if possible you should do an early return to keep things clean
RegisterNetEvent('esx_ambulancejob:clsearch', function(medicId) | ||
local playerPed = PlayerPedId() | ||
|
||
if isDead then |
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.
avoid nestling
if not isDead then return end
RegisterNetEvent('esx_ambulancejob:revive', function() | ||
local playerPed = PlayerPedId() | ||
|
||
if isDead then |
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.
same thing
isBusy = true | ||
|
||
ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(quantity) | ||
if quantity > 0 then |
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.
so much nestlingggg
RegisterNetEvent('esx_ambulancejob:setDeadPlayers', function(_deadPlayers) | ||
deadPlayers = _deadPlayers | ||
|
||
if isOnDuty then |
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.
avoid nestling
RegisterNetEvent('esx_ambulancejob:PlayerDistressed', function(playerId, playerCoords) | ||
deadPlayers[playerId] = 'distress' | ||
|
||
if isOnDuty then |
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.
same thing
props = vehicle.props, | ||
type = type | ||
} | ||
if not isDead then |
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.
same thing
Deathhandler, Deathcam etc. is supposed to be extracted into the new resource "esx_deathscreen". Basically anything directly related to death. |