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

Feat: conditional shuffle seat #104

Merged
merged 10 commits into from
May 16, 2024
Prev Previous commit
feat: conditional shuffle seat
artur-michalak committed May 15, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 0cd785256ddfbd9a9dc9d42592aebb83091d7c23
7 changes: 5 additions & 2 deletions locales/en.json
Original file line number Diff line number Diff line change
@@ -6,7 +6,9 @@
"deleted_recording": "Deleted Recording!",
"later_aligator": "Later aligator!",
"stress_gain": "Feeling More Stressed!",
"no_vehicle_nearby": "No Vehicle Nearby For Flipping."
"no_vehicle_nearby": "No Vehicle Nearby For Flipping.",
"is_handcuffed": "You are handcuffed.",
"is_fastened": "You wear a seat belt."
},
"success": {
"cruise_control_enabled": "Cruise control enabled",
@@ -30,7 +32,8 @@
},
"info": {
"minutes": "minutes",
"seconds": "seconds.."
"seconds": "seconds..",
"shuffleSeat": "Shuffle seat"
},
"actions": {
"push_vehicle": "Press [~g~SHIFT~w~] and [~g~E~w~] to push the vehicle until [~g~SHIFT~w~] release",
14 changes: 12 additions & 2 deletions qbx_noshuff/client.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
local config = lib.loadJson('qbx_noshuff.config')

---Disables auto seat switching
---@param seatIndex number
local function disableAutoShuffle(seatIndex)
@@ -12,6 +14,14 @@ lib.onCache('seat', disableAutoShuffle)

---Makes the player ped shuffle to the next vehicle seat.
local function shuffleSeat(self)
if QBX.PlayerData.metadata.ishandcuffed then
return exports.qbx_core:Notify(locale('error.is_handcuffed'), 'error')
end

if LocalPlayer.state.seatbelt then
return exports.qbx_core:Notify(locale('error.is_fastened'), 'error')
end

self:disable(true)
if cache.vehicle and cache.seat then
TaskShuffleToNextVehicleSeat(cache.ped, cache.vehicle)
@@ -24,7 +34,7 @@ end

lib.addKeybind({
name = 'shuffleSeat',
description = '',
defaultKey = 'O',
description = locale('info.shuffleSeat'),
defaultKey = config.shuffleSeatKey,
onPressed = shuffleSeat
})
3 changes: 3 additions & 0 deletions qbx_noshuff/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"shuffleSeatKey": "O"
}