Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- elseif data.current.value == 'dep_trailer' then
- local playerPed = PlayerPedId()
- local vehicle = GetVehiclePedIsIn(playerPed, true)
- local towmodel = GetHashKey('pjtrailer')
- local isVehicleTow = IsVehicleModel(vehicle, towmodel)
- if isVehicleTow then
- local targetVehicle = ESX.Game.GetVehicleInDirection()
- if CurrentlyTowedVehicle == nil then
- if targetVehicle ~= 0 then
- if not IsPedInAnyVehicle(playerPed, true) then
- if vehicle ~= targetVehicle then
- AttachEntityToEntity(targetVehicle, vehicle, 20, -0.5, -5.0, 1.0, 0.0, 0.0, 0.0, false, false, false, false, 20, true)
- CurrentlyTowedVehicle = targetVehicle
- ESX.ShowNotification(_U('vehicle_success_attached'))
- if NPCOnJob then
- if NPCTargetTowable == targetVehicle then
- ESX.ShowNotification(_U('please_drop_off'))
- Config.Zones.VehicleDelivery.Type = 1
- if Blips['NPCTargetTowableZone'] then
- RemoveBlip(Blips['NPCTargetTowableZone'])
- Blips['NPCTargetTowableZone'] = nil
- end
- Blips['NPCDelivery'] = AddBlipForCoord(Config.Zones.VehicleDelivery.Pos.x, Config.Zones.VehicleDelivery.Pos.y, Config.Zones.VehicleDelivery.Pos.z)
- SetBlipRoute(Blips['NPCDelivery'], true)
- end
- end
- else
- ESX.ShowNotification(_U('cant_attach_own_tt'))
- end
- end
- else
- ESX.ShowNotification(_U('no_veh_att'))
- end
- else
- AttachEntityToEntity(CurrentlyTowedVehicle, vehicle, 20, -0.5, -12.0, 1.0, 0.0, 0.0, 0.0, false, false, false, false, 20, true)
- DetachEntity(CurrentlyTowedVehicle, true, true)
- if NPCOnJob then
- if NPCTargetDeleterZone then
- if CurrentlyTowedVehicle == NPCTargetTowable then
- ESX.Game.DeleteVehicle(NPCTargetTowable)
- TriggerServerEvent('esx_mechanicjob:onNPCJobMissionCompleted')
- StopNPCJob()
- NPCTargetDeleterZone = false
- else
- ESX.ShowNotification(_U('not_right_veh'))
- end
- else
- ESX.ShowNotification(_U('not_right_place'))
- end
- end
- CurrentlyTowedVehicle = nil
- ESX.ShowNotification(_U('veh_det_succ'))
- end
- else
- ESX.ShowNotification(_U('imp_flatbed'))
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement