📦Installation

Download the Resource

  • Download the trafficlights resource package

  • Extract the files to your server's resources directory

File Structure

Verify the resource contains the following files:

  • fxmanifest.lua - Resource manifest

  • config.lua - Configuration settings

  • server.lua - Server-side logic

  • client.lua - Client-side logic and hacking mechanics

Add to Server Configuration

1. Add Resource to server.cfg

Open your server.cfg file and add the following line to ensure the resource starts:

ensure trafficlights

2. Configure Dependencies

Ensure the following resources are running before tmc-trafficlights:

  • TMC Framework Core - Required for framework functions

  • statuseffects (Optional) - For luck-based reward system

Add Hacking Item to Inventory

Add the required hacking device item to your inventory system:

Make sure to add the corresponding image file to your inventory's image directory.

Add Reward Items to Inventory

Add all potential reward items to your inventory system:

Electronics/Components

Configure Reputation System (Optional)

If using the reputation reward system, ensure your TMC Framework has the following reputation types configured:

  • crime - Criminal reputation configurable

  • hackedtrafficlights - Tracks number of traffic lights hacked (automatically added)

The script automatically extends player data to track hacked traffic lights count.

Configure Cryptocurrency (Optional)

If using crypto rewards, ensure your TMC Framework has cryptocurrency support and the following crypto type configured:

  • primetoken - Default crypto reward type (configurable)

Configure Radial Menu Integration

The script automatically integrates with the radial menu system. To verify it's working:

  1. Ensure radialmenu resource is installed and running

  2. The script adds a "Hack Traffic Light" option to the "General" radial menu

  3. This option only appears when:

    • You're not in a vehicle

    • You're near a traffic light

    • You have the required hacking device

No additional configuration is needed for radial menu integration.

Test the Installation

1. Start the Server

Start your server and verify the resource loads without errors:

2. Test as Player

  • Join your server

  • Give yourself the hacking device: /giveitem [your_id] jammer 1

  • Find a traffic light (look for traffic signals at intersections)

  • Stand near the traffic light

  • Open radial menu and look for "Hack Traffic Light" option

3. Test Hacking Process

  • Select "Hack Traffic Light" from the radial menu

  • Wait for the preparation progress bar

  • Complete the Bruteforce minigame (3-5 rounds)

  • Verify rewards are received

  • Check that the traffic light starts cycling rapidly

4. Verify Sync and Effects

  • Have another player nearby

  • Hack a traffic light

  • Verify the other player sees:

    • The traffic light cycling colors

    • Sparking particle effect

    • Sound effect (if interactsound is installed)

5. Test Police Requirements (If Enabled)

  • Enable police requirements in config: Config.PoliceSettings.enabled = true

  • Try hacking without required police online

  • Verify you get the "Not enough police" notification

  • Have police come online and verify it works

Configure Police Settings

Set up police job requirements in config.lua:

Troubleshooting

Resource Won't Start

  • Verify TMC Framework core is loaded first

  • Check console for specific error messages

  • Ensure all dependencies are installed

  • Verify file structure is intact

Minigame Not Appearing

  • Verify tmc_minigames resource is installed and running

  • Check that the minigame resource is named exactly tmc_minigames

  • Ensure the 'Bruteforce' minigame exists in your minigames resource

Radial Menu Option Not Showing

  • Verify radialmenu resource is installed and running

  • Check that you're near a traffic light

  • Ensure you have the required hacking device in your inventory

  • Make sure you're not in a vehicle

No Rewards Received

  • Check server console for errors

  • Verify reward items exist in your inventory system

  • Check that reward chances in config are above 0%

Traffic Light Not Changing

  • Verify another player is nearby to see the sync

  • Check console for sync errors

  • Ensure traffic light entity exists and is valid

  • Try with a different traffic light model

Particle Effects Not Showing

  • This is normal if players are too far away

  • Effects are synced only to nearby players for performance

Performance Optimization

The script is optimized for performance with:

  • Efficient proximity checks for traffic lights

  • Distance-based particle effect rendering

  • Automatic cleanup of hacked lights state

  • Minimal server-side threads

Next Steps

Once installation is complete, proceed to the Configuration section to customize hacking difficulty, rewards, police requirements, and more, or check the FAQ for common questions.

Last updated