Studio PLAYERS
  • Studio PLAYERS
  • 📦QB/QBX SCRIPTS
    • 💸SA-MONEY
      • 💡Introduction
      • ⚙️Installation
        • ⚙️Installation
        • ⚙️Migration
        • ⚙️Add new currency
      • 🗃️Displays $ in inventory
      • 📚HUD Implementations
        • 📗17mov_Hud
        • 📗wais-hudv5
    • 💰SA-MONEYWASH
      • 💡Introduction
      • ⚙️Installation
    • 🕐SA-PLAYTIME
      • 💡Introduction
      • ⚙️Installation
      • ✈️Exports
    • ☠️SA-CHARACTERKILL
      • 💡Introduction
      • ⚙️Installation
    • 🧊SA-BOXE
      • 💡Introduction
      • 💡Usage
      • ⚙️Installation
    • 🚦SA-TRAFFICLIGHTSPRIORITY
      • 💡Introduction
      • ⚙️Installation
  • 📦ESX SCRIPTS
    • 🕐SA-PLAYTIME
      • 💡Introduction
      • ⚙️Installation
      • ✈️Exports
    • ☠️SA-CHARACTERKILL
      • 💡Introduction
      • ⚙️Installation
    • 🚦SA-TRAFFICLIGHTSPRIORITY
      • 💡Introduction
      • ⚙️Installation
  • 🛠️FAQ
    • 🛠️General Issues
    • 🛠️SA-Money-V2
Powered by GitBook
On this page
  1. ESX SCRIPTS

SA-PLAYTIME

To count player's playtime on the server.

Last updated 9 months ago

This script show up player ingame playtime. You can setup in this script translate and also you can define how that command will be called.

In default are these commands

“/playtime” (for players) - It show up player playtime of himself “/playtime acc ID” (for admins) - It show up player playtime “/playtime char” (for players) - It show up player playtime on his character “/playtime char ID” (for admins) - It show up player playtime on his character

Configuration

You will find everything you need in config.lua

Language /locale/en.lua

To change notify system /server/functions.lua

Features

  • Resmon - 0.00ms

  • Configurable - locale/language, config (commands)

  • Easy-to-Configure!

We are using Asset Escrow system

📦
🕐
Page cover image
https://github.com/Studio-PLAYERS/TEBEX-Doc/blob/main/SA-PlayTime/previews/functions.lua
local function NotifySystem(src, text, typ)

    if ESX then

        -- ESX

        local xPlayer = ESX.GetPlayerFromId(src)

        if not xPlayer then return end

        xPlayer.showNotification(text) 

    else

        -- QB-Core

        TriggerClientEvent('QBCore:Notify', src, text, typ)

    end

end



function Notify(event, src, data)

    if event == 'WrongID' then

        NotifySystem(src, Translations.notifications.wrongid, 'error')

    elseif event == 'AccountAdminCommand' then

        NotifySystem(src, 'ID: ' .. data.ID .. Translations.notifications.playtimeplayer .. data.playtime .. Translations.notifications.acc, 'success')

    elseif event == 'AccountPlayerCommand' then

        NotifySystem(src, Translations.notifications.playtime .. data.playtime .. Translations.notifications.acc, 'success')

    elseif event == 'PlayerAdminCommand' then

        NotifySystem(src, 'ID: ' .. data.ID .. Translations.notifications.playtimeplayer .. data.playtime .. Translations.notifications.char, 'success')

    elseif event == 'PlayerCommand' then

        NotifySystem(src, Translations.notifications.playtime .. data.playtime .. Translations.notifications.char, 'success')

    end

end
https://github.com/Studio-PLAYERS/TEBEX-Doc/blob/main/SA-PlayTime/previews/config.lua
Config = {}



Config.Framework = 'esx'  -- qb-core/esx | Don't touch this. Change it only if you have renamed qb or you use ESX

Config.Debug = false --Command for me to debug script. It print to console passes trough conditions. true/false



Config.Language = 'en' --Language: 'en' or 'cs'

Config.ThreadIncrease = 1 --This value mean how often is playtime increased 1 = 1min, default 5 = 5min, that means every 5 minutes will be added 5 minutes to playtime



Config.Command = 'playtime' -- Command which will display playtime



-- ---------------

-- VVV PLAYERS VVV

-- ---------------

-- Usage: '/playtime char' It shows playtime of the player's character

-- Usage: '/playtime acc' It shows playtime of the player's account



Config.Permissions = {

    'admin',

    'god',

}

-- -------------

-- VVV ADMIN VVV

-- -------------

-- Usage: '/playtime char ID' for example '/playtime char 1' will display playtime of Player with ID 1 on his character

-- Usage: '/playtime acc ID' for example '/playtime acc 1' will display playtime of Player with ID 1 on his account



Config.VersionCheck = true
https://github.com/Studio-PLAYERS/TEBEX-Doc/blob/main/SA-PlayTime/previews/en.lua
if Config.Language == 'en' then

    Translations = {

        notifications = {

            playtime = "You've played ",

            wrongid = "Wrong ID or Player isn't online",

            playtimeplayer = " has played ",

            acc = " (Account)",

            char = " (Character)",

        },

        time = {

            days = "days",

            hours = "hours",

            minutes = "minutes",

        },

        utils = {

            descriptions = "Displays player's playtime",

            IDPlayer = "Player ID (Admin Only)",

            Char_Acc = "Player's playtime on character (char) / playtime on account (acc)"

        },

    }

end