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

impound vehicle to garage, notify the owner, and an error fix #58

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

Conversation

Goshawk1337
Copy link

  • If a policeman impounds a vehicle it wil l go to the garage, and notify the owner
  • if the data.value was nil it was throwing an error, now its fixed and the menu can properly work.

- If a policeman impounds a vehicle it wil l go to the garage, and notify the owner
- if the data.value was nil it was throwing an error, now its fixed and the menu can properly work.
@Kenshiin13 Kenshiin13 self-requested a review December 23, 2024 22:59
server/main.lua Outdated
if not state then return end


ESX.SetStored(plate, state)

Choose a reason for hiding this comment

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

What is this function?

local response = MySQL.query.await('SELECT `owner` FROM `owned_vehicles` WHERE `plate` = ?', {
plate
})
if not response then return end

Choose a reason for hiding this comment

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

server/main.lua Outdated

RegisterNetEvent("esx_policejob:impoundVehicle")
AddEventHandler("esx_policejob:impoundVehicle", function(plate, state)
if GetInvokingResource() then return end

Choose a reason for hiding this comment

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

What is the point of this? Just confirm the source players job and distance to the entity for validation.

client/main.lua Outdated
function ImpoundVehicle(vehicle)
--local vehicleName = GetLabelText(GetDisplayNameFromVehicleModel(GetEntityModel(vehicle)))
local plate = ESX.Game.GetVehicleProperties(vehicle).plate
Copy link

@Kenshiin13 Kenshiin13 Dec 23, 2024

Choose a reason for hiding this comment

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

This is overkill. Just do

local plate = ESX.Math.Trim(GetVehicleNumberPlateText(vehicle))

client/main.lua Show resolved Hide resolved
client/main.lua Outdated
function ImpoundVehicle(vehicle)
--local vehicleName = GetLabelText(GetDisplayNameFromVehicleModel(GetEntityModel(vehicle)))
local plate = ESX.Game.GetVehicleProperties(vehicle).plate
TriggerServerEvent("esx_policejob:impoundVehicle", plate, 2)

Choose a reason for hiding this comment

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

Pass vehicle netId for validation on the server

@Kenshiin13
Copy link

With all that being said, I am not sure why we should send a vehicle to a players garage when police impounds it.

@Goshawk1337
Copy link
Author

Goshawk1337 commented Dec 23, 2024

With all that being said, I am not sure why we should send a vehicle to a players garage when police impounds it.

there was a todo for it, and i thought i try to do it, which i did, but it did not meet the requirments, also it sends to the impound.
The setStored is a function i made to the core. i made a pull request for that too but i think i made something wrong when mading the request.

@Goshawk1337
Copy link
Author

Also sorry, for the many mistakes, i learned everything basically from myself, and i thougth this is a good practice for, me what to do better, as expected there is many thing i can :D

@Kenshiin13
Copy link

Also sorry, for the many mistakes, i learned everything basically from myself, and i thougth this is a good practice for, me what to do better, as expected there is many thing i can :D

You good, that's the point of these reviews 👍🏽 Appreciate your contribution

@Goshawk1337
Copy link
Author

Hi, i made the changes you asked for.

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

Successfully merging this pull request may close these issues.

2 participants