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

restructure ambulancejob #69

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open

restructure ambulancejob #69

wants to merge 3 commits into from

Conversation

N0tNvll
Copy link

@N0tNvll 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

@Arctos2win Arctos2win changed the title reestructure ambulancejob restructure ambulancejob Jan 18, 2025
@@ -0,0 +1,177 @@
RegisterNetEvent('esx_ambulancejob:clsearch')
AddEventHandler('esx_ambulancejob:clsearch', function(medicId)
Copy link
Contributor

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 )

AddEventHandler('esx_ambulancejob:clsearch', function(medicId)
local playerPed = PlayerPedId()

if isDead then
Copy link
Contributor

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 )

Copy link
Contributor

@Arctos2win Arctos2win left a 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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

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

same thing

@Kenshiin13 Kenshiin13 changed the base branch from main to dev January 27, 2025 21:43
@Kenshiin13
Copy link
Contributor

Deathhandler, Deathcam etc. is supposed to be extracted into the new resource "esx_deathscreen". Basically anything directly related to death.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Ready for Next Update
Development

Successfully merging this pull request may close these issues.

3 participants