Kartik Scripts

Seatbelt & Harness

📄 Config file: shared/seatbelt_config.lua

Kartik-Mechanic includes a built-in seatbelt and racing harness system designed for both realism and player safety during high-speed driving.


🔒 Seatbelt System

By default, all players in vehicles (excluding motorcycles, cycles, and other open vehicles) should wear their seatbelts to avoid being ejected during collisions.

  • Keybind: Players can toggle their seatbelt using the default key (B).
  • Indicator: A dedicated seatbelt icon appears on the mechanic HUD:
    • 🔴 Red: Seatbelt is unbuckled.
    • ⚪ White/Grey: Seatbelt is buckled.
  • Safety: Buckling the seatbelt prevents the player from flying through the windscreen during high-speed impacts.

🏎️ Racing Harness

For high-performance vehicles, mechanics can install a Racing Harness. This provides superior protection compared to a standard seatbelt.

Installation

Mechanics can install a racing harness by using the harness item while near a vehicle.

  • Requirement: The player must be a mechanic (or have the item if configured for civilian use).
  • Animation: A detailed installation animation and progress bar will trigger.
  • State: Once installed, the harness state is synchronized across all players using state bags (Entity(vehicle).state.hasHarness).

Harness Snapping (Damage System)

To maintain realism, racing harnesses are not invincible. Under extreme conditions, they can snap.

  • Impact Detection: The system monitors the vehicle's speed delta during collisions.
  • Snap Threshold: If the vehicle loses more than a certain amount of speed (e.g., 80 km/h) instantly, there is a chance the harness will snap.
  • Snap Chance: A configurable percentage chance (default 30%) determines if the harness breaks upon a major impact.
  • Notification: If the harness snaps, the player is notified, the item is removed from the vehicle, and the HUD indicator reverts to the standard seatbelt.

⚙️ Configuration

You can customize the seatbelt and harness behavior in shared/seatbelt_config.lua.

OptionDescription
Config.EnableSeatbeltEnable or disable the entire system.
Config.SeatbeltKeyThe default key used to buckle/unbuckle.
Config.SeatbeltSoundPlay a buckle/unbuckle sound effect.
Config.Seatbelt.bypassClassesVehicle classes that do not require seatbelts (e.g., bikes, boats).
Config.Seatbelt.harnessItemThe item name required for installation.
Config.Seatbelt.harnessSnapEnabledEnable the harness damage/snapping logic.
Config.Seatbelt.harnessSnapThresholdSpeed difference (km/h) required to trigger a snap check.
Config.Seatbelt.harnessSnapChancePercentage chance (0-100) of the harness breaking on impact.

On this page