= Documentation - FiveM License System - Secure Your FiveM Scripts

Documentation

Everything you need to integrate and use our FiveM licensing system

Getting Started

Quick Start Guide

Learn how to integrate our licensing system into your FiveM script in just 5 minutes. The system uses a simple HTTP request to verify licenses based on your server IP address.

Code Example
-- Add this code to your server.lua or client.lua
-- Replace 'YOUR_FILE_CODE' with your 6-digit file code from the dashboard

PerformHttpRequest("https://vf1.host/api/verify/YOUR_FILE_CODE", function (err, text, head)
    if string.match(text, "Sorry,") then
        -- License is invalid
        print("^1[License] Invalid license!")
        -- Stop your resource or handle invalid license
            while true do
           end
        else
        -- License is valid
        print("^2[License] License verified successfully!")
    -- Your script code here
    end
end)

Create Your First File

Before you can use the licensing system, you need to create a file in your dashboard and get your 6-digit file code.

Code Example
1. Sign up or log in at https://vf1.host
2. Go to Dashboard
3. Click "Create New File"
4. Enter your script name
5. Copy your 6-digit File ID
6. Use this File ID in your script's verification code

Activate License for Server IP

After creating a file, you need to activate a license for your server IP address. The system automatically detects your server IP when verifying.

Code Example
1. Go to Dashboard > Files
2. Click on your file
3. Click "Activate License"
4. Enter your server IP address
5. Click "Activate"
6. Your license is now active for that IP

API Reference

License Verification Endpoint

The main API endpoint for verifying licenses. This endpoint automatically detects your server IP address and checks if a valid license exists for that IP.

Code Example
-- Endpoint: https://vf1.host/api/verify/:fileCode
-- Method: GET
-- Parameters: fileCode (6-digit code from dashboard)

-- Example:
PerformHttpRequest("https://vf1.host/api/verify/123456", function (err, text, head)
    if string.match(text, "Sorry,") then
        -- Invalid license response
        print("License invalid: " .. text)
    else
        -- Valid license (returns "Valid")
        print("License verified!")
    end
end)

Response Format

Understanding the API response format and how to handle different responses.

Code Example
-- Valid License Response:
-- Returns: "Valid"

-- Invalid License Responses:
-- "Sorry, Invalid license" - File code not found
-- "Sorry, IP address required" - IP detection failed
-- "Sorry, License not found or inactive" - No active license for this IP
-- "Sorry, License expired" - License has expired
-- "Sorry, Server error" - Internal server error

-- Example handling:
PerformHttpRequest("https://vf1.host/api/verify/123456", function (err, text, head)
    if text == "Valid" then
        print("^2License is valid!")
    elseif string.find(text, "Sorry,") then
        print("^1License error: " .. text)
        -- Handle invalid license
    end
end)

IP Address Detection

The system automatically detects your server IP from the request headers. No need to manually send your IP address.

Code Example
-- The API automatically detects your server IP from:
-- 1. X-Forwarded-For header (if behind proxy/Cloudflare)
-- 2. X-Real-IP header
-- 3. Direct connection IP

-- You don't need to send IP manually, just use:
PerformHttpRequest("https://vf1.host/api/verify/YOUR_FILE_CODE", function (err, text, head)
    -- IP is automatically detected
end)

Integration Examples

Complete Lua Example

Full example of integrating license verification in a FiveM resource with proper error handling.

Code Example
-- server.lua
-- Replace '123456' with your actual 6-digit file code from dashboard

local FILE_CODE = "123456" -- Your file code from https://vf1.host/dashboard

Citizen.CreateThread(function()
    Citizen.Wait(2000) -- Wait for server to fully start
    
    PerformHttpRequest("https://vf1.host/api/verify/" .. FILE_CODE, function (err, text, head)
        if err ~= 200 then
            print("^1[License] Error connecting to license server")
            return
        end
        
        if string.match(text, "Sorry,") then
            print("^1[License] Invalid license: " .. text)
            print("^1[License] Stopping resource...")
            Citizen.Wait(2000)
            StopResource(GetCurrentResourceName())
        else
            print("^2[License] License verified successfully!")
            print("^2[License] Resource is now active!")
            -- Your script code here
        end
    end, 'GET', '')
end)

Client-Side Verification

Example of verifying license on client-side (less secure, but useful for UI checks).

Code Example
-- client.lua
local FILE_CODE = "123456"

Citizen.CreateThread(function()
    PerformHttpRequest("https://vf1.host/api/verify/" .. FILE_CODE, function (err, text, head)
        if text == "Valid" then
            -- License is valid, show UI or enable features
            TriggerEvent('license:verified')
        else
            -- License invalid, show error message
            TriggerEvent('license:invalid', text)
        end
    end, 'GET', '')
end)

-- Listen for license verification
RegisterNetEvent('license:verified')
AddEventHandler('license:verified', function()
    print("License verified on client!")
    -- Enable client features
end)

Resource Startup Check

Best practice: Check license when resource starts and stop if invalid.

Code Example
-- server.lua
local FILE_CODE = "123456"
local licenseVerified = false

-- Check license on resource start
Citizen.CreateThread(function()
    PerformHttpRequest("https://vf1.host/api/verify/" .. FILE_CODE, function (err, text, head)
        if text == "Valid" then
            licenseVerified = true
            print("^2[License] Verified - Resource active")
        else
            print("^1[License] Invalid - Stopping resource")
            Citizen.Wait(2000)
            StopResource(GetCurrentResourceName())
        end
    end, 'GET', '')
end)

-- Protect your events
RegisterNetEvent('your:event')
AddEventHandler('your:event', function()
    if not licenseVerified then
        return -- Don't process if license not verified
    end
    -- Your event code here
end)

Discord Bot - Obfuscation

Using the Obfuscation Bot

Our Discord bot can obfuscate your Lua scripts for free. You must be logged in to the website with Discord to use the bot.

Code Example
1. Log in to https://vf1.host using Discord
2. Join our Discord server: https://discord.gg/GMhpuwVtkP
3. Send a direct message (DM) to the bot
4. Use command: !ob
5. Attach your .lua or .zip file
6. Wait for obfuscated file

The bot supports:
- Single .lua files
- ZIP files containing multiple scripts
- Automatic syntax fixing
- Multiple obfuscation presets

Bot Commands

Available commands and how to use the obfuscation bot.

Code Example
Command: !ob

Usage:
1. Open DM with the bot
2. Type: !ob
3. Attach your .lua or .zip file
4. Wait for processing

Requirements:
- Must be logged in at https://vf1.host with Discord
- File must be .lua or .zip format
- File size limits apply

The bot will:
- Clean your code
- Fix common syntax errors
- Obfuscate with best preset
- Return obfuscated file

Obfuscation Presets

The bot automatically tries different presets to find the best obfuscation level for your code.

Code Example
Presets (in order of attempt):
1. Medium - Balanced obfuscation (default)
2. Weak - Light obfuscation (fallback)
3. Minify - Minimal obfuscation (last resort)

The bot will:
- Try Medium first
- Fall back to Weak if errors
- Use Minify as last option
- Send cleaned file if all fail

All presets use LuaU format for maximum compatibility.

Troubleshooting

Common Issues

Solutions to the most common problems developers face.

Code Example
Issue: License returns "Sorry, Invalid license"
Solution: 
- Check your file code is correct (6 digits)
- Make sure file exists in dashboard
- Verify you're using the right file code

Issue: License returns "Sorry, License not found or inactive"
Solution:
- Go to dashboard and activate license for your server IP
- Make sure license is active (not expired)
- Check IP address matches your server

Issue: License returns "Sorry, IP address required"
Solution:
- This is rare, usually means proxy issue
- Try accessing API directly
- Contact support if persists

Bot Issues

Common issues with the Discord obfuscation bot and how to fix them.

Code Example
Issue: Bot says "Access denied"
Solution:
- Make sure you're logged in at https://vf1.host
- Log in using Discord (same account)
- Try logging out and back in

Issue: Bot says "User not found"
Solution:
- Sign up at https://vf1.host using Discord
- Make sure you completed Discord login
- Check your Discord account is linked

Issue: Obfuscation fails
Solution:
- Check your Lua code has no syntax errors
- Try with a simpler file first
- Make sure file is valid Lua code
- Bot will send cleaned file if obfuscation fails

Testing Your License

How to test if your license verification is working correctly.

Code Example
-- Test script to verify your setup
local FILE_CODE = "YOUR_FILE_CODE"

PerformHttpRequest("https://vf1.host/api/verify/" .. FILE_CODE, function (err, text, head)
    print("^3[License Test] Response: " .. tostring(text))
    print("^3[License Test] Error: " .. tostring(err))
    
    if text == "Valid" then
        print("^2[License Test] SUCCESS - License is valid!")
    else
        print("^1[License Test] FAILED - " .. tostring(text))
    end
end, 'GET', '')

-- Check console output:
-- Should see "Valid" if license is active
-- Should see "Sorry, ..." if there's an issue