Skip to content

Commit

Permalink
chore: added keybind for vehicle fix menu function
Browse files Browse the repository at this point in the history
  • Loading branch information
Yorick20022 authored and tabarra committed Sep 29, 2024
1 parent 955acae commit f3fdc52
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions resource/cl_main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ CreateThread(function()
'/txAdmin:menu:openPlayersPage',
'/txAdmin:menu:togglePlayerIDs',
'/txAdmin:menu:tpToWaypoint',
'/txAdmin:menu:fixVehicle',

--Convars
'/txAdmin-version',
Expand Down
1 change: 1 addition & 0 deletions resource/menu/client/cl_base.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
11 changes: 11 additions & 0 deletions resource/menu/client/cl_vehicle.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit f3fdc52

Please sign in to comment.