Skip to content

Commit

Permalink
🚑 Handle off seatbelt on motorcycles
Browse files Browse the repository at this point in the history
  • Loading branch information
Gellipapa committed Aug 17, 2023
1 parent dade983 commit c1eb6c8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
11 changes: 9 additions & 2 deletions client/vehicle/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ if not Config.Disable.Vehicle then
local engineRunning = GetIsVehicleEngineRunning(currentVehicle)
local rpm

if vehicleType == "LAND" then
if vehicleType == "LAND" or vehicleType == "MOTO" then
rpm = engineRunning and (GetVehicleCurrentRpm(currentVehicle) * 450) or 0
else
rpm = math.ceil(ESX.PlayerData.coords.z)
Expand Down Expand Up @@ -160,7 +160,14 @@ if not Config.Disable.Vehicle then
inVehicle = true
HUD.Data.Driver = currentSeat == -1 or false
HUD.Data.Vehicle = currentVehicle
vehicleType = (vehicleClass == 15 or vehicleClass == 16) and "AIR" or "LAND"
vehicleType = "LAND"

if vehicleClass == 15 or vehicleClass == 16 then
vehicleType = "AIR"
elseif vehicleClass == 8 then
vehicleType = "MOTO"
end

-- We have to check if he changed seat meantime
driverCheckThread(currentVehicle)

Expand Down
7 changes: 4 additions & 3 deletions web/src/assets/Components/Speedo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {useSettingsStorageState} from "../Contexts/SettingsStorage";
const VehType = {
AIR:"AIR",
LAND:"LAND",
MOTO: "MOTO",
}

const defaultObject = {
Expand Down Expand Up @@ -285,7 +286,7 @@ export const Speedo = (props) =>{
}
setOnIndex(onIndex => !onIndex)
}
if(!indicators().seatbelt){
if(!indicators().seatbelt && vehType() !== VehType.MOTO){
if(!settings().IndicatorSeatbeltSound && show()){
if(!props?.template && !checkSound()){
SeatbeltAlertSound.play();
Expand Down Expand Up @@ -409,7 +410,7 @@ export const Speedo = (props) =>{
return(
<div class={`${props?.template ? 'template-main-container' : 'speedo main-container'} ${!show() && !props?.template ? 'slideOut' : ''}`}>

<Show when={!indicators().seatbelt} keyed>
<Show when={!indicators().seatbelt && vehType() !== VehType.MOTO} keyed>
<div class="w-10 h-10 absolute top-[26%] -left-[25%]">
<SeatbeltIcon state={seatbeltState}/>
</div>
Expand All @@ -421,7 +422,7 @@ export const Speedo = (props) =>{
<AirHud/>
</Show>

<Show when={vehType() === VehType.LAND} keyed>
<Show when={vehType() !== VehType.AIR} keyed>
<VehicleHud/>
</Show>

Expand Down

0 comments on commit c1eb6c8

Please sign in to comment.