Examples

Practical code examples demonstrating Framework Core features and exports.

Zone & Prompt System

A complete example showing how to create zones and prompt groups for player interactions.

Citizen.CreateThread(function()
    -- Create a circular zone
    exports.core:AddCircleZone('shop_zone', vector3(-223.7, -1536.3, 31.6), 2.0, {
        useZ = true,
        data = {
            shopType = 'general'
        }
    })

    -- Create a prompt group for shop interactions
    ShopPrompt = exports.core:CreatePromptGroup({
        {
            Id = 'open_shop',
            Complete = function()
                -- Open shop menu
                TriggerEvent('shops:client:openShop', 'general')
                exports.core:HidePromptGroup(ShopPrompt)
            end,
            Title = 'Open Shop',
            Icon = 'fas fa-shopping-cart',
            AutoComplete = false
        },
        {
            Id = 'restock_shop',
            Complete = function()
                -- Restock shop (admin only)
                TriggerServerEvent('shops:server:restock', 'general')
                exports.core:HidePromptGroup(ShopPrompt)
            end,
            Title = 'Restock Shop',
            Icon = 'fas fa-box',
            AutoComplete = false
        }
    })

    -- Show prompts when entering zone
    exports.core:AddPolyZoneEnterHandler('shop_zone', function(data)
        if exports.core:HasJob('police') then
            -- Show all prompts for police
            exports.core:ShowPromptGroup(ShopPrompt)
        else
            -- Only show shop prompt for regular players
            exports.core:ShowPromptGroup(ShopPrompt, { 'open_shop' })
        end
    end)

    -- Hide prompts when leaving zone
    exports.core:AddPolyZoneExitHandler('shop_zone', function()
        if exports.core:IsPromptGroupVisible(ShopPrompt) then
            exports.core:HidePromptGroup(ShopPrompt)
        end
    end)
end)

Progress Bar with Cancel Option

Example of a progress bar with cancellation support and movement restrictions.

Notification System

Various notification examples for different scenarios.

Creating and managing interactive menus.

Prop Animation

Attaching props to players with animations.

Entity Management

Managing entities and coordinates.

Server-Side Reputation System

Managing player reputation on the server.

Player Management

Server-side player management examples.

Notification System (Server)

Sending notifications from server to client.

UI Integration

Updating HUD and sending messages to React NUI.

Routing Buckets

Managing routing buckets for isolation.

Item System

Registering and using items.

Animation Loading

Loading animations and models properly.

Metadata Integration

For proper integration with food and drink systems, Framework Core supports multiple methods of updating hunger and thirst:

Method 2: Event-Based Updates

Method 3: StateBag Integration

Checking Rep

This is a example usage of how to check reputation levels using our

Last updated