Seat Switching & F9 engine toggle

+ Added seat switch script; Seat-Switcher.
+ Changed Engine-Toggle.
This commit is contained in:
Jacob
2022-04-21 21:08:18 +01:00
parent 81a15a9127
commit eddc17c49f
6 changed files with 125 additions and 7 deletions
+4 -4
View File
@@ -1,6 +1,6 @@
-- Configuration
local button = nil -- 167 (F6 by default)
local button = 56 -- 167 (F6 by default)
local commandEnabled = true -- (false by default) If you set this to true, typing "/engine" in chat will also toggle your engine.
-- You're all set now!
@@ -19,9 +19,9 @@ Citizen.CreateThread(function()
Citizen.Wait(0)
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
--if (IsControlJustReleased(0, button) or IsDisabledControlJustReleased(0, button)) and vehicle ~= nil and vehicle ~= 0 and GetPedInVehicleSeat(vehicle, 0) then
--toggleEngine()
--end
if (IsControlJustReleased(0, button) or IsDisabledControlJustReleased(0, button)) and vehicle ~= nil and vehicle ~= 0 and GetPedInVehicleSeat(vehicle, 0) then
toggleEngine()
end
end
end)
+7
View File
@@ -0,0 +1,7 @@
Copyright 2020 Evan Darwin <evan@relta.net>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+28
View File
@@ -0,0 +1,28 @@
# seat-switcher - 1.1.0
This is a very simple client-side script that is a modern version of the "[Disable Seat Shuffling](https://forum.cfx.re/t/release-disable-seat-shuffling/53526)" plugin by _callmejaf_.
This release fixes some of the most common bugs with it, such as:
- The seat shuffle animation no longer loops / does partial animations
- Door closing animation works properly now
## Commands
### `/seat [seat]`
This command will switch your character's seat to the desired seat.
### `/shuffle` (or `/shuff`)
This command lets the player shuffle to the driver seat.
## Changelog
### 1.1.0
- Added `/shuffle` as a command alias
- Use a better method of preventing seat shuffling
### 1.0.0
- Initial version
## License
This script is licensed under the MIT license. Have fun. The license details are available in the **LICENSE** file.
+75
View File
@@ -0,0 +1,75 @@
-- optimizations
local tonumber = tonumber
local CreateThread = Citizen.CreateThread
local Wait = Citizen.Wait
local TriggerEvent = TriggerEvent
local RegisterCommand = RegisterCommand
local PlayerPedId = PlayerPedId
local IsPedInAnyVehicle = IsPedInAnyVehicle
local GetPedInVehicleSeat = GetPedInVehicleSeat
local GetVehiclePedIsIn = GetVehiclePedIsIn
local SetPedIntoVehicle = SetPedIntoVehicle
-- end optimizations
local disabled = false
CreateThread(function()
while true do
local ped = PlayerPedId()
local restrictSwitching = false
if IsPedInAnyVehicle(ped, false) and not disabled then
if GetPedInVehicleSeat(GetVehiclePedIsIn(ped, false), 0) == ped then
restrictSwitching = true
end
end
SetPedConfigFlag(ped, 184, restrictSwitching)
Wait(150)
end
end)
local function switchSeat(_, args)
local seatIndex = tonumber(args[1]) - 1
if seatIndex < -1 or seatIndex >= 4 then
SetNotificationTextEntry('STRING')
AddTextComponentString("~r~Seat ~b~" .. (seatIndex + 1) .. "~r~ is not recognized")
DrawNotification(true, true)
else
local ped = PlayerPedId()
local veh = GetVehiclePedIsIn(ped, false)
if veh ~= nil and veh > 0 then
CreateThread(function()
disabled = true
SetPedIntoVehicle(PlayerPedId(), veh, seatIndex)
Wait(50)
disabled = false
end)
end
end
end
local function shuffleSeat()
CreateThread(function()
disabled = true
Wait(3000)
disabled = false
end)
end
RegisterCommand("seat", switchSeat)
RegisterCommand("shuff", shuffleSeat)
RegisterCommand("shuffle", shuffleSeat)
TriggerEvent('chat:addSuggestion', '/shuff', "Switch to the driver's seat")
TriggerEvent('chat:addSuggestion', '/shuffle', "Switch to the driver's seat")
TriggerEvent('chat:addSuggestion', '/seat', 'Switch seats in the current vehicle',
{ { name = 'seat', help = "Switch seats in the current vehicle. 0 = driver, 1 = passenger, 2-3 = back seats" } })
AddEventHandler('onClientResourceStop', function(name)
if name == 'seat-switcher' then
SetPedConfigFlag(PlayerPedId(), 184, false)
end
end)
+8
View File
@@ -0,0 +1,8 @@
fx_version 'cerulean'
game 'gta5'
description 'Seat Switcher'
version '1.1.0'
author 'GoatGeek (https://github.com/GoatG33k)'
client_script 'client.lua'
+3 -3
View File
@@ -161,13 +161,13 @@ start carsounds
start carsounds4
start rcore_pool
start asedrussounds
start LegacyFuel
start refuelingnozzle
//start LegacyFuel
//start refuelingnozzle
start wheelvarietypack
start cummins5924v
start stretcher
start stretcherscript
start Seat-Switcher
#[-----Discord Perms-----]
start discord_perms