Skip to main content

Website Installation

Step 1: Upload Files

  1. Download and extract the LonexMap ZIP file
  2. Upload the contents of the website/ folder to your web server
  3. Your folder structure should look like this:
public_html/ (or www/)
├── assets/
│   ├── css/
│   │   └── style.css
│   ├── js/
│   │   └── livemap.js
│   ├── img/
│   │   ├── logo.png
│   │   └── map.png (21MB)
│   └── lib/
│       ├── leaflet.js
│       ├── leaflet.css
│       └── images/
│           ├── marker-icon.png
│           ├── marker-icon-2x.png
│           └── marker-shadow.png
├── data/
├── views/
│   └── license-error.php
├── api.php
├── bootstrap.php
├── config.php
├── index.php
├── LonexLicense.php
├── push.php
└── version.php

Step 2: Configure License Key

  1. Open config.php in a text editor
  2. Enter your LonexLabs license key:
'license_key' => 'XXXX-XXXX-XXXX-XXXX',

Step 3: Configure Secret Key

Set a secure secret key that will be shared between the website and FiveM resource:
'secret_key' => 'your-secure-random-key-here',
Important: Use a long, random string. This key must match exactly in both config.php and your FiveM resource.

Step 4: Verify Installation

Visit your website URL. You should see the LonexMap interface with a “Connecting…” status until the FiveM resource is configured.

FiveM Resource Installation

Step 1: Upload Resource

  1. Copy the fivem-resource folder to your server’s resources/ directory
  2. Rename it to lonexmap (or your preferred name)
resources/
└── lonexmap/
    ├── client/
    │   └── main.lua
    ├── server/
    │   ├── main.lua
    │   └── blips.json
    └── fxmanifest.lua

Step 2: Configure the Resource

Open server/main.lua and update these settings:
-- Your website URL (no trailing slash)
local WebsiteURL = 'https://map.yourdomain.com'

-- Must match your website config.php secret_key
local SecretKey = 'your-secure-random-key-here'

-- Set to true if using LonexDiscordAPI
local UseLonexDiscordAPI = true

Step 3: Add to Server Config

Add the resource to your server.cfg:
ensure lonexmap

Step 4: Restart Server

Restart your FiveM server or start the resource:
refresh
ensure lonexmap

Step 5: Verify Connection

  1. Check your FiveM server console for:
    [LonexMap] Started - pushing to https://map.yourdomain.com
    
  2. Visit your website - the status should change from “Connecting…” to “Online”

Configuration

Website Configuration (config.php)

OptionDescriptionDefault
license_keyYour LonexLabs license keyRequired
secret_keyShared key with FiveM resourceRequired
stale_timeoutSeconds before showing offline10
site_nameShown in browser tabLonexMap
community_nameYour server nameLive Map
logoPath to logo imageassets/img/logo.png
refresh_rateMap update interval (ms)2000
default_zoomInitial zoom level4
lonex_api_enabledEnable duty statustrue

FiveM Configuration (server/main.lua)

OptionDescriptionDefault
WebsiteURLYour LonexMap website URLRequired
SecretKeyMust match website configRequired
PushIntervalUpdate frequency (ms)2000
UseLonexDiscordAPIEnable API integrationtrue
DebugEnable console loggingfalse

Custom Blips (server/blips.json)

Add custom location markers by editing blips.json:
[
    {"name": "Police Station", "x": 428, "y": -981, "z": 30.7},
    {"name": "Hospital", "x": 298, "y": -584, "z": 43.3},
    {"name": "Fire Station", "x": 213, "y": -1644, "z": 29.8}
]

LonexDiscordAPI Integration (Optional)

LonexMap integrates with LonexDiscordAPI for enhanced features:

Features When Enabled

  • Duty Status - Shows player department (LEO, Fire, EMS) with color-coded markers
  • 911/311 Calls - Display emergency calls on the map
  • AOP Indicator - Shows current Area of Play in the header
  • PeaceTime Indicator - Shows when PeaceTime is active
  • Siren Detection - Flashing red/blue markers when sirens are active

Setup

  1. Ensure LonexDiscordAPI is installed and running on your FiveM server
  2. Set UseLonexDiscordAPI = true in server/main.lua
  3. Set 'lonex_api_enabled' => true in config.php

Required Exports

LonexMap uses these LonexDiscordAPI exports:
ExportDescription
GetDutyInfo(source)Player duty status
GetAllActiveCalls()Active 911/311 calls
GetAOP()Current Area of Play
IsPeaceTime()PeaceTime status

Troubleshooting

”Connecting…” Never Changes to Online

Cause: FiveM resource can’t reach your website Solutions:
  1. Verify WebsiteURL in server/main.lua is correct (no trailing slash)
  2. Verify SecretKey matches in both config files (case-sensitive)
  3. Check FiveM console for errors
  4. Ensure your website is accessible from the internet
  5. Check if data/ folder is writable

HTTP 403 Error in FiveM Console

Cause: Secret key mismatch Solutions:
  1. Copy the exact same key to both files
  2. Check for extra spaces or quotes
  3. Ensure config.php is not encrypted

HTTP 500 Error

Cause: PHP error on website Solutions:
  1. Check PHP error logs on your web server
  2. Verify ionCube Loader is installed
  3. Ensure PHP 7.0+ is running
  4. Check all required files are uploaded

Map Shows But No Players

Cause: Data not being received or processed Solutions:
  1. Visit yoursite.com/api.php?endpoint=status to check data
  2. Verify FiveM resource is running (ensure lonexmap)
  3. Check for JavaScript errors in browser console (F12)

License Validation Failed

Cause: License key issues Solutions:
  1. Verify license key is entered correctly in config.php
  2. Check your license is active at lonexlabs.com
  3. Ensure data/ folder is writable (for license caching)
  4. Check server can reach lonexlabs.com

Map Image Not Loading

Cause: Missing or corrupted map.png Solutions:
  1. Verify assets/img/map.png exists (should be ~21MB)
  2. Re-download if file is corrupted
  3. Check file permissions