> For the complete documentation index, see [llms.txt](https://shift-studios.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://shift-studios.gitbook.io/docs/new/editor-7.md). Agents can also search and read this documentation through its [MCP server](https://shift-studios.gitbook.io/docs/~gitbook/mcp).

# Playtime

Transform Your Server With Shift Studios — Powerful, Optimized, And Reliable Resources Built To Improve Every Experience.

<figure><img src="https://4062160621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fgqh3gjuJzDAWNXTD9sEE%2Fuploads%2FbD2M5lKQJ9BTXZ58qC2B%2Fa29537fe-5af7-4ac7-b1d1-c93254550b3a.png?alt=media&amp;token=fbaab4c0-5ff7-4812-b0d3-2f9d94443bb3" alt=""><figcaption></figcaption></figure>

### Installation

{% stepper %}
{% step %}

### Playtime

Read Everything Below To Install
{% endstep %}

{% step %}

### Drag & Drop

Drag & Drop The Resource Into Your FiveM Server
{% endstep %}

{% step %}

### Ensure The Resource

Make Sure To Ensure shift-playtime In Your Server CFG.
{% endstep %}

{% step %}

### Install The SQL Table

```sql
CREATE TABLE IF NOT EXISTS `shift_playtime` (
    `identifier` VARCHAR(100) NOT NULL,
    `player_name` VARCHAR(100) DEFAULT NULL,
    `seconds` BIGINT UNSIGNED NOT NULL DEFAULT 0,
    `unlock_notified` TINYINT(1) NOT NULL DEFAULT 0,
    `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    PRIMARY KEY (`identifier`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

```

{% endstep %}

{% step %}

### Configure Resource

Make Sure To Configure The Resource To Your Liking

You Can Configure Your Discord Logs In server/config.discord.lua

The Config Also Includes en.lua, discord.lua, interface.lua, notificaitons.lua, permissions.lua & utils.lua

{% code expandable="true" %}

```lua
-- ⚫ ███████╗██╗  ██╗██╗███████╗████████╗    ███████╗████████╗██╗   ██╗██████╗ ██╗ ██████╗ ███████╗ ⚫
-- ⬛ ██╔════╝██║  ██║██║██╔════╝╚══██╔══╝    ██╔════╝╚══██╔══╝██║   ██║██╔══██╗██║██╔═══██╗██╔════╝ ⬛
-- ⚫ ███████╗███████║██║█████╗     ██║       ███████╗   ██║   ██║   ██║██║  ██║██║██║   ██║███████╗ ⚫
-- ⬛ ╚════██║██╔══██║██║██╔══╝     ██║       ╚════██║   ██║   ██║   ██║██║  ██║██║██║   ██║╚════██║ ⬛
-- ⚫ ███████║██║  ██║██║██║        ██║       ███████║   ██║   ╚██████╔╝██████╔╝██║╚██████╔╝███████║ ⚫
-- ⬛ ╚══════╝╚═╝  ╚═╝╚═╝╚═╝        ╚═╝       ╚══════╝   ╚═╝    ╚═════╝ ╚═════╝ ╚═╝ ╚═════╝ ╚══════╝ ⬛

Config = Config or {}

Config.Debug = false
Config.Locale = 'en'

Config.Framework = {
    -- auto | esx | qbcore | qbox | standalone
    Name = 'auto',

    -- Character mode uses framework character identifiers where possible.
    -- Account mode uses a FiveM account identifier such as license2/license.
    IdentityMode = 'character', -- character | account

    -- Used by account mode and Standalone mode, in priority order.
    IdentifierPriority = { 'license2', 'license', 'fivem' },

    -- Initialization retries cover framework character loading after playerJoining.
    InitializationRetries = 30,
    InitializationRetryMs = 1000
}

Config.Playtime = {
    RequiredMinutes = 10,

    -- The timer is based on actual elapsed server seconds. Changing these intervals
    -- never changes how quickly playtime is earned.
    TickSeconds = 5,
    SyncSeconds = 10,
    SaveSeconds = 300,
    MaxTickDeltaSeconds = 120,

    -- If false, the timer will be loaded/saved but will not increase.
    TrackingEnabled = true,

    -- Sends a notification once when a player crosses the requirement.
    NotifyOnUnlock = true,

    -- Prevents duplicate unlock notifications after reconnecting.
    PersistUnlockNotification = true
}

Config.Commands = {
    Playtime = 'playtime',

    Admin = {
        Enabled = true,
        Set = 'setplaytime',
        Add = 'addplaytime',
        Reset = 'resetplaytime'
    },

    Manager = {
        Enabled = true,
        Command = 'manageplaytime',
        PageSize = 50,
        MaxDays = 36500
    }
}

Config.Restrictions = {
    Enabled = true,

    -- Keeps weapons/items intact. It only blocks use and optionally switches the
    -- current selection to unarmed while access is locked.
    ForceUnarmed = true,
    DisableFiring = true,
    DisableAim = true,
    DisableWeaponWheel = true,
    DisableMelee = true,
    DisableReload = false,
    DisableWeaponHotkeys = true,

    -- Cancels networked damage/projectile events server-side for locked players.
    -- This requires normal FiveM server event support and is an extra guard, not
    -- a replacement for the client control restrictions.
    ServerDamageGuard = true,
    ServerProjectileGuard = true,

    Controls = {
        attack = { 24, 257 },
        aim = { 25 },
        weaponWheel = { 37 },
        melee = { 140, 141, 142, 143, 263, 264 },
        reload = { 45 },
        weaponHotkeys = { 157, 158, 159, 160, 161, 162, 163, 164, 165 }
    }
}

Config.Exports = {
    -- Server exports are always available:
    -- GetPlaytime(source, unit), HasRequiredPlaytime(source), IsWeaponLocked(source),
    -- AddPlaytime(source, seconds), SetPlaytime(source, seconds), ResetPlaytime(source)
    --
    -- Client exports are always available:
    -- GetPlaytime(unit), HasRequiredPlaytime(), IsWeaponLocked(), OpenPlaytime()
}

```

{% endcode %}
{% endstep %}

{% step %}

### Restart / Start Your Server

Ensure Everything Is Working Well & Enjoy !!
{% endstep %}
{% endstepper %}
