diff --git a/resources/Engine-Toggle/cl_vengine.lua b/resources/Engine-Toggle/cl_vengine.lua index ffbfcbaaf..7df36a242 100644 --- a/resources/Engine-Toggle/cl_vengine.lua +++ b/resources/Engine-Toggle/cl_vengine.lua @@ -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) diff --git a/resources/Seat-Switcher/LICENSE.txt b/resources/Seat-Switcher/LICENSE.txt new file mode 100644 index 000000000..6707bcc64 --- /dev/null +++ b/resources/Seat-Switcher/LICENSE.txt @@ -0,0 +1,7 @@ +Copyright 2020 Evan Darwin + +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. \ No newline at end of file diff --git a/resources/Seat-Switcher/README.md b/resources/Seat-Switcher/README.md new file mode 100644 index 000000000..1a9e1cdbe --- /dev/null +++ b/resources/Seat-Switcher/README.md @@ -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. + diff --git a/resources/Seat-Switcher/client.lua b/resources/Seat-Switcher/client.lua new file mode 100644 index 000000000..d91cace1e --- /dev/null +++ b/resources/Seat-Switcher/client.lua @@ -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) \ No newline at end of file diff --git a/resources/Seat-Switcher/fxmanifest.lua b/resources/Seat-Switcher/fxmanifest.lua new file mode 100644 index 000000000..bfed268c6 --- /dev/null +++ b/resources/Seat-Switcher/fxmanifest.lua @@ -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' \ No newline at end of file diff --git a/server.cfg b/server.cfg index 37b732e23..246da600a 100644 --- a/server.cfg +++ b/server.cfg @@ -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