Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
feat: configurable default keybind
  • Loading branch information
MrGriefs committed Nov 21, 2021
1 parent a41f87d commit fa43c34
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion client.lua
Expand Up @@ -6,7 +6,7 @@ local showHelp = false
local activated
local hasSeatbelt

RegisterKeyMapping('seatbelt', 'Seatbelt', 'keyboard', 'k')
RegisterKeyMapping('seatbelt', 'Seatbelt', 'keyboard', Constants.DefaultKeybind)
RegisterFrameworkCommand('seatbelt', function()
local ped = PlayerPedId()
if IsPedInAnyVehicle(ped) then
Expand Down
8 changes: 8 additions & 0 deletions config.lua
Expand Up @@ -13,6 +13,14 @@ Config = {
--- @type number
Distance = 20,

--- The default seatbelt keybind.
--- After a player joins, their keybind will not change if
--- the default keybind changes.
--- Players can manually change this keybind in their settings.
--- @type string
--- @see {@link https://docs.fivem.net/docs/game-references/input-mapper-parameter-ids/keyboard}
DefaultKeybind = 'K',

--- Custom vehicles/seats that don't have seatbelts.
--- Bicycles, motorbikes and submersibles are excluded automatically
--- - `1` or `true` = No seatbelt, windscreen ejection still occurs
Expand Down
1 change: 1 addition & 0 deletions util.lua
Expand Up @@ -29,6 +29,7 @@ end
Constants = {
Distance = Config.Distance + 0.0,
Excluded = Config.Excluded,
DefaultKeybind = Config.DefaultKeybind,
}

local GetPlayerIdentifierMethods = {
Expand Down

0 comments on commit fa43c34

Please sign in to comment.