Skip to content
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

chore(resource/menu/client): Added keybind for vehicle fix menu function #980

Merged
merged 1 commit into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)