diff --git a/resource/cl_main.lua b/resource/cl_main.lua index 6d5659e89..f9d4be832 100644 --- a/resource/cl_main.lua +++ b/resource/cl_main.lua @@ -142,6 +142,7 @@ CreateThread(function() '/txAdmin:menu:openPlayersPage', '/txAdmin:menu:togglePlayerIDs', '/txAdmin:menu:tpToWaypoint', + '/txAdmin:menu:fixVehicle', --Convars '/txAdmin-version', diff --git a/resource/menu/client/cl_base.lua b/resource/menu/client/cl_base.lua index 7ac01870f..3b10ae759 100644 --- a/resource/menu/client/cl_base.lua +++ b/resource/menu/client/cl_base.lua @@ -103,6 +103,7 @@ RegisterNetEvent('txcl:setAdmin', function(username, perms, rejectReason) RegisterKeyMapping('txAdmin:menu:noClipToggle', 'Menu: Toggle NoClip', 'keyboard', '') RegisterKeyMapping('txAdmin:menu:togglePlayerIDs', 'Menu: Toggle Player IDs', 'KEYBOARD', '') RegisterKeyMapping('txAdmin:menu:tpToWaypoint', 'Menu: Teleport to Waypoint', 'KEYBOARD', '') + RegisterKeyMapping('txAdmin:menu:fixVehicle', 'Menu: Fix vehicle', 'KEYBOARD', '') end else noMenuReason = tostring(rejectReason) diff --git a/resource/menu/client/cl_vehicle.lua b/resource/menu/client/cl_vehicle.lua index 312b82b80..587092235 100644 --- a/resource/menu/client/cl_vehicle.lua +++ b/resource/menu/client/cl_vehicle.lua @@ -369,3 +369,14 @@ RegisterNetEvent('txcl:seatInVehicle', function(vehNetID, seat, oldVehVelocity) end end end) + +RegisterCommand('txAdmin:menu:fixVehicle', function() + local ped = PlayerPedId() + local veh = GetVehiclePedIsIn(ped, false) + if (veh == 0) and not IsPedOnMount(ped) then + return sendSnackbarMessage('error', 'nui_menu.page_main.vehicle.not_in_veh_error', true) + end + + TriggerServerEvent('txsv:req:vehicle:fix') + sendSnackbarMessage('info', 'nui_menu.page_main.vehicle.fix.success', true) +end)