Coder Social home page Coder Social logo

tfnrp / seatbelt Goto Github PK

View Code? Open in Web Editor NEW
11.0 4.0 6.0 256 KB

Seatbelt script for FiveM, with LEO detection

Home Page: https://forum.cfx.re/t/4779995

License: MIT License

Lua 74.36% HTML 9.97% CSS 1.99% JavaScript 13.68%
fivem resource fivem-script lua

seatbelt's Introduction

Seatbelt

About

A modern realisation on seatbelt scripts, for additional roleplay and realism to your server.

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 Shift + F.
  • 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

Reports issues and create suggestions.
Improve code, fix issues and add 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.

seatbelt's People

Contributors

jackyfied avatar mrgriefs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

seatbelt's Issues

Yarn Issue

Couldn't start resource seatbelt
[ script:yarn] [yarn] yarn install v1.22.5
[ script:yarn] [yarn] [1/4] Resolving packages...
[ script:yarn] [yarn] [2/4] Fetching packages...
[ script:yarn] Error: [yarn] error [email protected]: The engine "node" is incompatible with this module. Expected version "4.18.0 || 6.14.0 || >=18.0.0". Got "16.9.1"
[ script:yarn] Error: [yarn] error Found incompatible module.

Tried these commands:
yarn upgrade
yarn install

no luck

Upon initiating the plugin, I encountered the following error.

[ script:yarn] [yarn] yarn install v1.22.5
[ script:yarn] [yarn] [1/4] Resolving packages...
[ script:yarn] [yarn] [2/4] Fetching packages...

txaReportResources
[ script:monitor] [txAdmin] Sending resources list to txAdmin.
[ script:yarn] Error: [yarn] error [email protected]: The engine "node" is incompatible with this module. Expected version "4.18.0 || 6.14.0 || >=18.0.0". Got "16.9.1"
[ script:yarn] Error: [yarn] error Found incompatible module.
[ script:yarn] [yarn] info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
[ citizen-server-impl] Building resource seatbelt failed.
[ citizen-server-impl] Error data: yarn failed!

No notifications

There is no notification about the seatbelt key nor does the seatbelt icon become visible whilst driving.

For some reason it cannot find the identifier?

Note I have it set to 2 which is seat position.

Line 162 is local identifier = GetPlayerIdentifier_(serverId, playerPed, vehicle)

	Line  19542: [   6465218] [b2699_GTAProce]             MainThrd/ ^1SCRIPT ERROR: @seatbelt/client.lua:162: attempt to call a nil value (global 'GetPlayerIdentifier_')^7
	Line  19543: [   6465218] [b2699_GTAProce]             MainThrd/ ^3> handler^7 (^5@seatbelt/client.lua^7:162)
	Line  19544: [   6465437] [b2699_GTAProce]             MainThrd/ ^1SCRIPT ERROR: @seatbelt/client.lua:162: attempt to call a nil value (global 'GetPlayerIdentifier_')^7
	Line  19545: [   6465437] [b2699_GTAProce]             MainThrd/ ^3> handler^7 (^5@seatbelt/client.lua^7:162)
	Line  19580: [   6475156] [b2699_GTAProce]             MainThrd/ ^1SCRIPT ERROR: @seatbelt/client.lua:162: attempt to call a nil value (global 'GetPlayerIdentifier_')^7
	Line  19581: [   6475156] [b2699_GTAProce]             MainThrd/ ^3> handler^7 (^5@seatbelt/client.lua^7:162)
	Line  19582: [   6477453] [b2699_GTAProce]             MainThrd/ ^1SCRIPT ERROR: @seatbelt/client.lua:162: attempt to call a nil value (global 'GetPlayerIdentifier_')^7
	Line  19583: [   6477453] [b2699_GTAProce]             MainThrd/ ^3> handler^7 (^5@seatbelt/client.lua^7:162)
	Line  19584: [   6478156] [b2699_GTAProce]             MainThrd/ ^1SCRIPT ERROR: @seatbelt/client.lua:162: attempt to call a nil value (global 'GetPlayerIdentifier_')^7
	Line  19585: [   6478156] [b2699_GTAProce]             MainThrd/ ^3> handler^7 (^5@seatbelt/client.lua^7:162)
	Line  19586: [   6480437] [b2699_GTAProce]             MainThrd/ ^1SCRIPT ERROR: @seatbelt/client.lua:162: attempt to call a nil value (global 'GetPlayerIdentifier_')^7
	Line  19587: [   6480437] [b2699_GTAProce]             MainThrd/ ^3> handler^7 (^5@seatbelt/client.lua^7:162)
	Line  19588: [   6481156] [b2699_GTAProce]             MainThrd/ ^1SCRIPT ERROR: @seatbelt/client.lua:162: attempt to call a nil value (global 'GetPlayerIdentifier_')^7
	Line  19589: [   6481156] [b2699_GTAProce]             MainThrd/ ^3> handler^7 (^5@seatbelt/client.lua^7:162)
	Line  19590: [   6483484] [b2699_GTAProce]             MainThrd/ ^1SCRIPT ERROR: @seatbelt/client.lua:162: attempt to call a nil value (global 'GetPlayerIdentifier_')^7
	Line  19591: [   6483484] [b2699_GTAProce]             MainThrd/ ^3> handler^7 (^5@seatbelt/client.lua^7:162)
	Line  19592: [   6484203] [b2699_GTAProce]             MainThrd/ ^1SCRIPT ERROR: @seatbelt/client.lua:162: attempt to call a nil value (global 'GetPlayerIdentifier_')^7
	Line  19593: [   6484203] [b2699_GTAProce]             MainThrd/ ^3> handler^7 (^5@seatbelt/client.lua^7:162)
	Line  19594: [   6486484] [b2699_GTAProce]             MainThrd/ ^1SCRIPT ERROR: @seatbelt/client.lua:162: attempt to call a nil value (global 'GetPlayerIdentifier_')^7
	Line  19595: [   6486484] [b2699_GTAProce]             MainThrd/ ^3> handler^7 (^5@seatbelt/client.lua^7:162)
	Line  19596: [   6489515] [b2699_GTAProce]             MainThrd/ ^1SCRIPT ERROR: @seatbelt/client.lua:162: attempt to call a nil value (global 'GetPlayerIdentifier_')^7

Suggestion: vehicle category instead of LEO status

Not an issue, more a suggestion: to make this script optionally framework independent, you could add an option to have the script check for vehicle type instead of framework LEO status and by doing 2 things:

  1. only show LEO observations to front right and left seat of emergency vehicles and
  2. exclude occupants of emergency vehicles from seatbelt observations in general

Sound signal

Hello,
I have a quick question please.
Is it possible to reduce or deactivate the sound signal?
I thank you in advance.

Does not start

ensure "seatbelt"
[ citizen-server-impl] Running build tasks on resource seatbelt - it'll restart once completed.
[ citizen-server-impl] Couldn't start resource seatbelt.
[ script:yarn] [yarn] yarn install v1.22.5
[ script:yarn] [yarn] [1/4] Resolving packages...
txaReportResources
[ script:monitor] [txAdmin] Sending resources list to txAdmin.
[ script:yarn] [yarn] [2/4] Fetching packages...
[ script:yarn] Error: [yarn] error [email protected]: The engine "node" is incompatible with this module. Expected version "4.18.0 || 6.14.0 || >=18.0.0". Got "16.9.1"
[ script:yarn] Error: [yarn] error Found incompatible module.
[ script:yarn] [yarn] info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
[ citizen-server-impl] Building resource seatbelt failed.
[ citizen-server-impl] Error data: yarn failed!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.