-
Notifications
You must be signed in to change notification settings - Fork 21
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
feat(esx_mechanicjob): rework and rewrite by Tizas #25
base: dev
Are you sure you want to change the base?
Conversation
client/main.lua
Outdated
cb(vehicle) | ||
end) | ||
|
||
Citizen.CreateThread(function() |
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 Citizen. you can just trigger CreateThread no need for Citizen in front of it.
client/main.lua
Outdated
local playerPed = ESX.PlayerData.ped | ||
local playerCoords = GetEntityCoords(playerPed) | ||
local vehicle = ESX.Game.GetClosestVehicle(playerCoords) | ||
if vehicle == -1 then cb(false) 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.
if not vehicle or vehicle == -1 then
return cb(false) -- return otherwise it will trigger cb(vehicle) as well
end
cb(vehicle)
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.
@Arctos2win ESX.Game.GetClosestVehicle
will either return -1 or an entity handle. No need to check for nil
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.
@Arctos2win
ESX.Game.GetClosestVehicle
will either return -1 or an entity handle. No need to check for nil
didnt know the point was just the return before cb(false) otherwise cb(true) will also run even if there is no vehicle
client/modules/cloakroom.lua
Outdated
) | ||
end | ||
|
||
Citizen.CreateThread(function() |
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.
Citizen. can be removed
end | ||
|
||
local function EndJob() | ||
if activeJob 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.
if not activeJob then
return ESX.ShowNotification(TranslateCap('no_active_job'))
end
end, | ||
inside = function() | ||
DrawText3D(job.vehicleCoords, "~INPUT_PICKUP~ Start the job", 0.4) | ||
if IsControlJustReleased(0, 38) 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.
You can use an outside local variabel for this
and then trigger this:
ESX.RegisterInteraction("mechanicjob", function()
MonitorRepair()
SetEntityDrawOutline(vehicle, false)
repairPoint:delete()
print("Delete Point")
end, function()
return isInside
end)
check how it works in here:
https://github.com/esx-framework/esx_core/blob/0426e760859f0d73213b499801165e6ad392ca38/%5Bcore%5D/es_extended/client/modules/interactions.lua#L9
end | ||
|
||
if not xPlayer.canCarryItem(itemName, count) then | ||
xPlayer.showNotification('You cannot carry this amount of items.') |
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.
return xPlayer.showNotification
ESX.RegisterUsableItem('tirekit', function(source) | ||
local source = source | ||
local xPlayer = ESX.GetPlayerFromId(source) | ||
ESX.TriggerClientCallback(source , "esx_mechanicjob:client:checkForVehicle", function(closeVehicle) |
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 as the repairkit
end, | ||
inside = function() | ||
DrawText3D(job.vehicleCoords, "~INPUT_PICKUP~ Start the job", 0.4) | ||
if IsControlJustReleased(0, 38) 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.
do this with interactionkey
client/modules/npcJob.lua
Outdated
end | ||
|
||
local function MonitorRepair() | ||
Citizen.CreateThread(function() |
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 Citizen.
return EndJob() | ||
end | ||
print("Player Entered Zone") | ||
SpawnVehicle(job.vehicleCoords, job.carModel) |
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.
Spawn server side vehicle and add an extra step on server to check timing
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.
Brb, ill go bash my head into a wall
No description provided.