- Add to
.env.local:FIVEM_SERVER_IP=your-ip:30120 FIVEM_API_SECRET=your-strong-secret
-
Edit
server.lualines 4-10:local DISCORD_BOT_TOKEN = "YOUR_BOT_TOKEN" local DISCORD_GUILD_ID = "YOUR_GUILD_ID" local DISCORD_WEBHOOK_URL = "YOUR_WEBHOOK" local WEBSITE_API_URL = "https://your-site.com/api/fivem/generate-token" local WEBSITE_API_SECRET = "same-as-env-FIVEM_API_SECRET"
-
Edit
config.lua:Config.EnableTokenAuth = true -- Require website connections Config.MaxPlayers = 32 -- Your server max players
-
Update Discord Role IDs in
config.lua:Config.DiscordRoles = { ['owner'] = 'YOUR_OWNER_ROLE_ID', ['admin'] = 'YOUR_ADMIN_ROLE_ID', -- etc... }
-
Add to
server.cfg:sv_endpointprivacy true ensure fivem-queue-web
- Start Next.js website:
npm run dev - Start FiveM server
- Open
http://localhost:3000/connect - Login with Discord
- Click "Connect to Server"
- FiveM should launch
- Check FiveM console for token validation logs
# Check if API endpoints work
curl http://localhost:3000/api/fivem/queue-status- Check server console for:
[QUEUE] Advanced Queue System loaded - Type command:
queueto see queue status - Check for Discord API connection messages
| Issue | Solution |
|---|---|
| "Invalid token" | Check API_SECRET matches in both .env and server.lua |
| FiveM won't launch | Ensure FiveM is installed, try manual connect URL |
| Discord roles not working | Verify bot token and guild ID are correct |
| Token expired | Generate new token (5 min limit) |
| Server shows offline | Check server.cfg has ensure fivem-queue-web |
Before going live:
- Use HTTPS for website (required)
- Generate strong API secret (32+ characters)
- Test with multiple users
- Configure all Discord role IDs
- Set up Discord webhook for monitoring
- Test crash queue reconnection
- Test priority queue with different roles
- Monitor server logs for errors
- Add rate limiting to API endpoints
- Set up database for token persistence (optional)
Players can now connect ONLY through your website at /connect page!
✅ Discord authentication required
✅ Token-based secure connection
✅ Priority queue by Discord roles
✅ Admin bypass queue
✅ Crash queue (exact position restore)
✅ Unlimited queue size
✅ Real-time server status
✅ Beautiful UI
Next: Customize the /connect page design to match your branding!