-
Notifications
You must be signed in to change notification settings - Fork 46
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
base: dev
Are you sure you want to change the base?
Conversation
Goshawk1337
commented
Dec 23, 2024
- 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.
server/main.lua
Outdated
if not state then return end | ||
|
||
|
||
ESX.SetStored(plate, state) |
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.
What is this function?
local response = MySQL.query.await('SELECT `owner` FROM `owned_vehicles` WHERE `plate` = ?', { | ||
plate | ||
}) | ||
if not response 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.
server/main.lua
Outdated
|
||
RegisterNetEvent("esx_policejob:impoundVehicle") | ||
AddEventHandler("esx_policejob:impoundVehicle", function(plate, state) | ||
if GetInvokingResource() 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.
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 |
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.
This is overkill. Just do
local plate = ESX.Math.Trim(GetVehicleNumberPlateText(vehicle))
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) |
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.
Pass vehicle netId for validation on the server
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. |
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 |
Hi, i made the changes you asked for. |