Skip to content

Commit

Permalink
detach if vehicle is in air.
Browse files Browse the repository at this point in the history
  • Loading branch information
StuxxyOfficial committed Feb 8, 2023
1 parent de2eac7 commit ec4939e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ local function startMove(netid, direction)
TaskVehicleTempAction(ped, vehicle, 10, 1000)
end
end
if IsEntityInAir(vehicle) then
remotepush = false
return TriggerServerEvent('OT_pushvehicle:detach', netid)
end
end
end
RegisterNetEvent('OT_pushvehicle:startMove', startMove)
Expand Down Expand Up @@ -168,6 +172,7 @@ local function stopPushing()
DetachEntity(ped, true, false)
ClearPedTasks(ped)
end
RegisterNetEvent('OT_pushvehicle:detach', stopPushing)

keybind = lib.addKeybind({
name = 'pushvehicle',
Expand Down
6 changes: 6 additions & 0 deletions server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,10 @@ RegisterNetEvent('OT_pushvehicle:updateOwner', function(netid, direction)
pushing[beingpushed[netid]] = owner
if not pushing[beingpushed[netid]] then return end
TriggerClientEvent('OT_pushvehicle:startMove', owner, netid, direction)
end)

RegisterNetEvent('OT_pushvehicle:detach', function(netid)
if not beingpushed[netid] then return end
if not pushing[beingpushed[netid]] then return end
TriggerClientEvent('OT_pushvehicle:detach', beingpushed[netid])
end)

0 comments on commit ec4939e

Please sign in to comment.