NRG Scripts
  • NRGScripts Documentation
  • About FiveM Escrow
  • NRG RESOURCES
    • NRG SimCard
      • Installation
      • Exports
      • Config
  • NRG AlcoEffect
    • Installation
    • Database
    • Expotrs
  • NRG Hud
    • Installation
    • Expotrs
Powered by GitBook
On this page
  • ๐Ÿป Saving Player's Alcohol Intoxication State to the Database
  • ๐Ÿง  System Overview
  • ๐Ÿ’พ Saving to the Database
  • ๐Ÿ”„ Reading on Rejoin
  • โœ… Final Conditions
  • ๐Ÿ“ Summary
  1. NRG AlcoEffect

Database

๐Ÿป Saving Player's Alcohol Intoxication State to the Database

๐Ÿง  System Overview

This system ensures a realistic gameplay experience by saving and restoring the player's alcohol intoxication state. Even after leaving the server, the playerโ€™s condition is preserved and updated upon rejoining.


๐Ÿ’พ Saving to the Database

When a player leaves the server while intoxicated:

  • ๐Ÿงช Their current blood alcohol level (in โ€ฐ) is saved.

  • ๐Ÿ•’ The exact time of disconnect is also recorded.

This data is stored in a database to be referenced when the player reconnects.


๐Ÿ”„ Reading on Rejoin

When the player rejoins the server:

  1. ๐Ÿ” The system checks if there's a saved intoxication state.

  2. โฑ๏ธ It calculates how much time has passed since the player left.

  3. โš™๏ธ Based on the configuration file, the sobering rate is determined.

  4. โž– The amount of alcohol to be reduced is calculated according to the elapsed time.

  5. ๐Ÿงฎ The new intoxication level is applied, and the corresponding effects are reactivated.


โœ… Final Conditions

  • โ›” If the player has been offline long enough to fully sober up, no effect is applied.

  • โœ… Otherwise, the reduced alcohol level is assigned, and the appropriate visual or gameplay effect is triggered.


๐Ÿ“ Summary

This system adds immersion by preventing players from bypassing the consequences of intoxication simply by logging out. It maintains full continuity of the player's state between sessions.

PreviousInstallationNextExpotrs

Last updated 1 month ago