Skip to content

S4 Carcontrol V2

s4-carcontrol Lua Exports & Config Documentation#

This document describes the available exports in the Lua codebase and explains the configuration options in config.lua.


Lua Exports#

Exports allow other resources or scripts to interact with s4-carcontrol's functionality.

client/client.lua#

  • OpenMenu(mini: boolean)
    • Opens the car control menu. If mini is true, opens the mini menu.
    • Usage: exports['s4-carcontrol']:OpenMenu(true)
  • IsMenuOpen()
    • Returns whether the car control menu is currently open.
    • Usage: local open = exports['s4-carcontrol']:IsMenuOpen()

client/neon.lua#

  • SetNeon(state, animation, speed, rainbow, color)
    • Enables/disables neon lights, sets animation type, speed, rainbow effect, and color.
    • Usage: exports['s4-carcontrol']:SetNeon(true, "wave", 150, false, "#ff00ff")
  • setNeonColor(r, g, b)
    • Sets neon color directly using RGB values.
    • Usage: exports['s4-carcontrol']:setNeonColor(255, 0, 255)

client/hl.lua#

  • setHeadlightColor(r, g, b)
    • Sets the vehicle's headlight color using RGB values.
    • Usage: exports['s4-carcontrol']:setHeadlightColor(255, 255, 0)

client/musicPlayer_cl.lua#

  • (No direct exports, interacts via NUI and server events.)

config.lua Options#

config.lua contains settings to customize the resource's behavior:

  • Config.OpenKey: Keyboard key to open the main menu (default: "o").
  • Config.OpenKeyMini: Keyboard key to open the mini menu (default: "m").
  • Config.SportModeMultiplier: Multiplier for sport mode vehicle power (default: 10.0, set to 0.0 to disable).
  • Config.OnlyHearMusicInVehicle: If true, music is only audible inside vehicles.
  • Config.Lang: Language code for UI and notifications (e.g., "en", "tr", "de", etc.).
  • Config.AllowedVehicleClasses: Table specifying which vehicle classes can use car control features (indexed by class ID, true/false).

For further details, see the comments and usage examples in each Lua file.