[Release] Modern Seatbelt

Seatbelt

version codacy issues

About

A modern realisation on seatbelt scripts, for additional roleplay and realism to your server.
Hover over anything underlined or a question mark ? for extra info.

Installation

git clone https://github.com/TFNRP/seatbelt.git
  • (Optional) Copy config.default.lua, rename the copy to config.lua and edit it to your liking.
  • Add the following to your server.cfg:
    • ensure seatbelt
    • (Optional) add_ace group.police seatbelt.notify allow
      Replace police with your LEO group.
      This is optional if you don’t use ACL - read Configuration.

Features

Modern Seatbelt does the following:

  • Buckle up with /seatbelt or K.
  • Keybinds can be changed in FiveM keybind settings.
  • Quick unbuckle by pressing ShiftF.
  • ? Heftier consequences for MVAs.
  • ? Law enforcement notified of traffic violation
    when driving behind (or crossing infront).
  • ? Out-of-the-way notifications whilst driving
    without seatbelt.
  • Lightweight, out of the box.
  • Supports the TFNRP framework.
  • Realistic sound effects for buckling & driving w/o SB.

Coming Soon

Features that are planned for Modern Seatbelt:

  • Complimentary scripts for compatible UI support.

Configuration

Note: Do not edit config.default.lua

Copy config.default.lua and rename the copy to config.lua.
Check config.lua for better details.

property description
LeoCheck = 2 The method this script should use to check whether a player is an (on-duty) LEO.
1 = be inside a police vehicle; or
2 = have the seatbelt.notify ACL.
PlayerIdentifierType = 1 What type of LEO notifications should be shown?
1 = Player ID (i.e. “Player 7”)
2 = Seat position (i.e. “Driver”, “Passenger”, “Rear left passenger”, “Far rear left passenger”)
3 = Username (i.e. “Hagen Hyena”, “1D-32 Backer P.”)
Distance = 20 The amount of distance LEOs have to be to detect people not weaing a seatbelt.
DefaultKeybind = K The default seatbelt keybind.
Excluded A list of excluded vehicles and vehicle seats.

Contributing

Report issues and create suggestions.
Improve code, fix issues and implement suggestions.

Credits & Copyright

  • @TehRamsus for their Seatbelt script, which inspired me to create Modern Seatbelt.
  • @Mercy3 for providing and giving permission of use of static/assets/{buckle,chime,unbuckle}.ogg files.

Licensed under MIT License. No code or assets of the inspiring work has been used.
The author of Seatbelt stated they would rework their original work but has not done so since Oct 25th, '21, hence my release.

3 Likes

preview?

Not a whole lot to preview. Everything is as said in OP (hover over the question marks).

Please disregard the choppy imgur compression.

I’ve loaded the script but it not really working. Its starting in the log but when i enter a vehicle it doens’t work for some reason.Screenshot_2

Edit: I found this error in F8

1 Like

Error is due to some dependency with their framework GitHub - TFNRP/framework: TFNRP's own framework can just edit the code to remove their job checks and framework dependency.

This issue has been fixed in the latest commit e7572b7.
Please refrain from reporting bugs on this thread, create an issue on GitHub.

v1.0.0

Added a config.lua to allow customisation of the default keybind, distance and LEO alert.
Added custom vehicle config, remove seatbelts from seats or even make the script pretend they’re always wearing one for specific vehicles.

There’s now a more varied selection of LEO alerts (previews soon™️):

  • Player ID. Rough example: Player 7 is not wearing a seatbelt in AXZB893.
  • Seat name. Rough example: Rear left passenger is not wearing a seatbelt in DTY178X.
  • Player username. Rough example: 1K-37 Hagen H. is not wearing a seatbelt in BVYIFFX.

Update Now

Simply do git pull if you cloned the repository using Git.
If you did it the manual way, download from here.

Changelog

Feature

  • 62446d3 LEO alert customisation
  • 9fb24a6 customisable vehicle and seat seatbelt exclusions
  • fa43c34 configurable default keybind

Fixed

  • 23164c9 seatbelts not existing on non-excluded vehicles

Refactor

  • cc15466 prefer “rear” over “back” for seat names

Chore

How does it notify LEO? Is it based on the emergency category, custom vehicles, a command? Specifics would be appreciated.

1 Like

Please read the OP. Hover over the ? for further information.

1 Like

sorry I legit just saw that, apparently I didn’t catch it the first time, thanks!

Is there anyway to adjust the sensitivity of the ejection from the car? For example right now I feel as if very light crashes cause the player to fly out of their vehicle, would there be a way to make it so that it would need to be a more intense crash in order for them to be ejected from the car?

If you like unrealism, you can change the hardcoded minimum speed for ejection (which is 50kmh) on this line, by changing the integer 50 to your desired speed.
Note: This does not change the force of inertia or velocity required for an ejection to occur, but only the minimum speed of when it can occur.

Hi @Griefs, good script I like it, one thing im struggling with though is how to change the notification at the top left to say the key I just changed the seatbelt too? Are you able to help with where that would be?

Greetings, I just wanted to recommend a few things if your willing to work on this script still are sounds ever going to be implemented? I really like the script just wish there was unbuckling and buckling sounds and maybe some chimes when your seatbelt Isn’t on while driving? You could add it as a option in the config file as well. This is a really well made script love the detection system for LEO although id like to see a vehicle whitelist system to it rather then the entire emergency category to due fire/ems also getting seatbelt alerts when it should be primarily for LEO still works great! I feel like this would make it 10x better thanks for this amazing seatbelt script either way!

Sound will be implemented once I create them or find non-commercial licensed sounds online. Anyone can suggest sounds they’ve created or found online and I will implement them.

If you want alerts to be given to LEO only, you can create a pull request or issue with the framework you are using so it may be implemented. If you’re not using a common framework, you can monkey patch the code yourself: util.lua#L24

Thanks for the reply, I have sounds that could be used if your interested also I meant the alerts for vehicles in the sense when you open the Config.lua you could have a section called “alertvehiclewhitelist” or something similar and in that table you’d do “Vehiclespawnname”, etc if you understand what im trying to say by that I can provide images if you’d like so you have a better understanding.



Here are the sounds that could be used.

Can you link to the source of this media? I cannot add it without credits and license.

I made these sounds a while ago about 7 months ago I made them for my friend and his developers they needed sounds for their seatbelt and I decided to take it upon myself and create some for them at the time I have no use for them anymore and considering I have them unused I feel like it can save you some time then creating/searching for sounds and I’m not a expert when it comes to LUA so I cant implement this into the script.

Understandable. I’ll attribute the credits to your forum profile.
I appreciate the assistance and will implement this when available. OP will be updated and a reply sent proceeding the bump in version.