Skip to content

FiveM Projects

Integrate abystrixLicense into your FiveM resource using Lua.

Resource Structure

your-resource/
├── fxmanifest.lua
└── client.lua

fxmanifest.lua

lua
fx_version 'cerulean'
game 'gta5'

author 'Your Name'
description 'FiveM resource with abystrixLicense integration'
version '1.0.0'

client_scripts {
    'client.lua'
}

Client-Side Validation

lua
local API_URL = "https://your-server.com/api/v1/validate"
local LICENSE_KEY = "XXXXX-XXXXX-XXXXX-XXXXX"
local PRODUCT_ID = 1

Citizen.CreateThread(function()
    local hwid = GetPlayerIdentifiers(PlayerId())[1] or "unknown"
    
    PerformHttpRequest(API_URL, function(status, body, headers)
        if status == 200 then
            local response = json.decode(body)
            if response.valid then
                print("^2License validated successfully!")
            else
                print("^1Invalid license! Disabling resource.")
                StopResource(GetCurrentResourceName())
            end
        else
            print("^1License validation failed!")
            StopResource(GetCurrentResourceName())
        end
    end, 'POST', json.encode({
        licenseKey = LICENSE_KEY,
        productId = PRODUCT_ID,
        hwid = hwid
    }), {['Content-Type'] = 'application/json'})
end)

Server-Side Validation

lua
-- server.lua
RegisterCommand('checklicense', function(source, args)
    local licenseKey = args[1]
    if not licenseKey then
        TriggerClientEvent('chat:addMessage', source, { args = { "Usage: /checklicense <key>" } })
        return
    end
    
    PerformHttpRequest(API_URL, function(status, body)
        if status == 200 then
            local resp = json.decode(body)
            if resp.valid then
                TriggerClientEvent('chat:addMessage', source, { args = { "License is valid!" } })
            else
                TriggerClientEvent('chat:addMessage', source, { args = { "License is invalid!" } })
            end
        end
    end, 'POST', json.encode({
        licenseKey = licenseKey,
        productId = PRODUCT_ID,
        hwid = GetPlayerIdentifiers(source)[1]
    }), {['Content-Type'] = 'application/json'})
end, false)

Best Practices

  • Use server-side validation for security
  • Store license keys in server config files, not client scripts
  • Implement HWID locking to prevent key sharing
  • Cache results to avoid excessive API calls

Released under the MIT License.