Jota Dev Coins System

Here you can see the documentation to learn how to install our store's coin system.

How to start the script for its correct operation:

Put in your server.cfg

# JotaDev Coins System
ensure jc_coins

This is the script configuration:

Config = Config or {}
Config.Framework = "esx" -- qb, esx 

Config.CoinsName = 'coins'

Config.HourlyCoins = 1 -- Cantidad de coins por hora normal

Config.CommnadNameConsultarCoins = 'coins' -- Comando para consultar cuantas coins tienes y tiempo que te queda para poder obtener el siguiente beneficio

Config.CommnadNameAdministrador = 'givecoins' -- [ID] [CANTIDAD] Comando para entregar coin a jugador especifico.

Config.CommnadNameAdministradorRetirarCoins = 'removecoins' -- [ID] [CANTIDAD] Comando para retirar coins a un jugador especifico.

Config.RGBColors = {162, 51, 255} -- Colores para el Chat
Config.ServerName = 'Server Name' -- Nombre de tu server

Config.Notification = "Has recibido %s coins por jugar 1 hora en el servidor." -- Mensaje de notificación
Config.NoPerms = "No tienes permisos para acceder al comando"

-- PERMISOS ESX
Config.Rangos = { 'god', 'superadmin', 'admin', 'mod' }


Config.TimeToEarn = 3600 -- Tiempo en segundos para recibir las coins (1 hora)
Config.ClientOption = true -- Esta opcion podras activar el dar coins por hora de jugabilidad de el jugador.

Config.DiscordWebhook ''

if Config.Framework == 'qb' then
    QBCore = exports['qb-core']:GetCoreObject()
elseif Config.Framework == 'esx' then
    ESX = exports["es_extended"]:getSharedObject()
else
    print '^1[^6jc_coins^1] ^2Framework No encontrada, ingrese esx o qb^0'
    return
end


To register coins according to your framework, follow these steps:

1

Add currency to your framework:

Search your es_extended config for "Config.Accounts" and configure the coin name to your liking:

Config.Accounts = {
    bank = {
        label = TranslateCap("account_bank"),
        round = true,
    },
    black_money = {
        label = TranslateCap("account_black_money"),
        round = true,
    },
    money = {
        label = TranslateCap("account_money"),
        round = true,
    },
    coins = {
        label = 'Jota Dev Coins',
        round = true,
    },
}

Server Exports Config:

AddCoins

exports['jc_coins']:AddCoins(source, ammount)

-- Example
RegisterCommand("darcoins", function(source, args)
    local targetId = tonumber(args[1])
    local cantidad = tonumber(args[2])

    if targetId and cantidad then
        local success = exports['jc_coins']:AddCoins(targetId, cantidad)

        if success then
            print(("Se dieron %s coins al jugador ID %s"):format(cantidad, targetId))
        else
            print("No se pudo dar coins. ¿Está conectado el jugador?")
        end
    else
        print("Uso: /darcoins [ID] [cantidad]")
    end
end, true)

RemoveCoins

exports['jc_coins']:RemoveCoins(source, ammount)

-- Example:
RegisterCommand("quitarcoins", function(source, args)
    local targetId = tonumber(args[1])
    local cantidad = tonumber(args[2])

    if targetId and cantidad then
        local success = exports['jc_coins']:RemoveCoins(targetId, cantidad)

        if success then
            print(("Se quitaron %s coins al jugador ID %s"):format(cantidad, targetId))
        else
            print("No se pudo quitar coins. ¿Está conectado el jugador?")
        end
    else
        print("Uso: /quitarcoins [ID] [cantidad]")
    end
end, true)

GetCoins

exports['jc_coins']:GetCoins(source)

-- Example:
RegisterCommand("vercoins", function(source, args)
    local targetId = tonumber(args[1]) or source

    local coins = exports['jc_coins']:GetCoins(targetId)

    print(("El jugador ID %s tiene %s coins"):format(targetId, coins))
end, true)
If you have any questions or problems, do not hesitate to contact us:

Last updated