πŸ”¬
byK3 Docs
  • SCRIPT DOCS
    • πŸŽƒnkn_halloween
      • ‡️Installation
      • πŸ› οΈConfig
      • πŸ“Coords
      • 🎨UI (HTML/JS)
  • πŸŽ€nkn_dailyRewards
    • ‡️Installation
    • πŸ› οΈConfig
    • πŸ‘€See the Config
  • πŸŽ„nkn_advent
    • ‡️Installation
    • πŸ› οΈScript Configuration
    • πŸ‘€See the Config
  • βš’οΈnkn_craftingTable
    • ‡️Installation
    • πŸ› οΈScript Configuration
    • πŸ‘€See the Config
Powered by GitBook
On this page
  • CONFIG.LUA
  • LANGUAGE.LUA
  • discord-config.lua
  1. nkn_craftingTable

See the Config

See all configurable files

CONFIG.LUA

Config = {}

-- β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ•—β–‘β–‘β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ•—β–‘β–‘β–‘β–‘β–‘
-- β–ˆβ–ˆβ•”β•β•β•β•β•β–‘β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–‘β–‘
-- β–ˆβ–ˆβ•‘β–‘β–‘β–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–‘β–ˆβ–ˆβ•”β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–‘β–‘
-- β–ˆβ–ˆβ•‘β–‘β–‘β•šβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•β–‘β–‘β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β–‘β–‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–‘β–‘
-- β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–‘β•šβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–‘β–‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–‘β–‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—
-- β–‘β•šβ•β•β•β•β•β•β–‘β•šβ•β•β•β•β•β•β•β•šβ•β•β–‘β–‘β•šβ•β•β•β•šβ•β•β•β•β•β•β•β•šβ•β•β–‘β–‘β•šβ•β•β•šβ•β•β–‘β–‘β•šβ•β•β•šβ•β•β•β•β•β•β•

Config.Language = 'en' -- default: en/de  || more options in language.lua
Config.Framework = 'esx' -- esx or old-esx (esx = ESX LEGACY)
Config.Debug = false -- enable debug mode true/false (will print debug messages in console)

Config.ImgPath = 'your-inventory-image/html/img/items/' -- path to images (default: nkn-inventarasd\html\img)
Config.CheckInterval = 2500 -- crafting database timer check interval (default: 2500 in ms) (lower = faster but more performance usage, higher = slower but less performance usage)

Config.RenderDistance = 30.0 -- render distance for crafting tables marker & npc (default: 30.0) (lower = less performance usage, higher = more performance usage FOR client)
Config.InteractDistance = 2.0 -- interact distance for crafting tables (default: 2.0) 

Config.allowMultipleCrafting = true -- allow multiple crafting on other or same crafting table at the same time (true/false)
Config.allowOfflineProgress = true -- allow crafting while offline (true/false) (if false, player must be online to progress crafting duration)


Config.Admins = { -- this role will be able to use commands from Config.Commands
    "superadmin",
    "admin",
}

Config.Commands = {
    clearDatabase = 'clearDatabase', -- command to clear crafting database (usage: /clearDatabase [id or identifier])
    clearDatabaseAll = 'clearDatabaseAll', -- command to clear crafting database for all players (usage: /clearDatabaseAll) WARNING: THIS WILL CLEAR DATABASE OF CRAFTING FOR ALL PLAYERS (USE ONLY IF NEEDED)
}

-- β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ–ˆβ•—β–‘β–‘β–ˆβ–ˆβ•—
-- β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•‘β•šβ•β•β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ•‘
-- β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘β–‘β–‘β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–‘β–‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘
-- β–ˆβ–ˆβ•”β•β•β•β•β–‘β–ˆβ–ˆβ•‘β–‘β–‘β–ˆβ–ˆβ•‘β–‘β•šβ•β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–‘β–‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•‘
-- β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–‘β–‘β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘β–‘β•šβ–ˆβ–ˆβ–ˆβ•‘
-- β•šβ•β•β–‘β–‘β–‘β–‘β–‘β–‘β•šβ•β•β•β•β•β–‘β•šβ•β•β•β•β•β•β–‘β•šβ•β•β–‘β–‘β–‘β•šβ•β•β–‘β–‘β–‘β•šβ•β•β–‘β•šβ•β•β•β•β•β–‘β•šβ•β•β–‘β–‘β•šβ•β•β•

Config.Coords = {
    ["Table 1"] = { -- dont use same name twice (copy paste and change values to make more spots)
        coords = vec3(-83.93, -835.70, 39.0), -- coords where DAILY Rewards Spot + the marker and blip will be
        allowedJob = {"all"}, -- allowed jobs to use this spot (all = all jobs)

        craftings = {
            ["Item 1"] = { -- dont use same name twice (copy paste and change values to make more items)
                output = 'phone', -- item name
                label = 'Phone', -- item label
                amount = 1, -- item amount
                duration = 1, -- crafting duration in ms
                resources = { -- resources needed to craft item
                    {item = 'water', label = 'Water', amount = 1},
                    {item = 'bread', label = 'Bread', amount = 1},
                },


            },

            ["Item 2"] = { -- dont use same name twice (copy paste and change values to make more items)
                output = 'bread', -- item name
                label = 'Bread', -- item label
                amount = 1, -- item amount
                duration = 1, -- crafting duration in ms
                resources = { -- resources needed to craft item
                    {item = 'gold', label = 'Gold', amount = 15},
                    {item = 'diamond', label = 'Diamond', amount = 3},
                },
            },
            
        },


        marker = { -- marker settings
            enable = true, -- enable marker true/false
            type = 1, -- marker type , check https://docs.fivem.net/docs/game-references/markers/ for more info about marker types
            size = { -- marker size
                x = 1.0, -- x = width
                y = 1.0, -- y = length 
                z = 1.0, -- z = height
            },

            color = { -- marker color, color picker: https://www.w3schools.com/colors/colors_picker.asp
                r = 255, -- r = red
                g = 204, -- g = green
                b = 0, -- b = blue
                a = 100, -- a = alpha (transparency)
            },
        },

        blip = { -- blip settings
            enable = true, -- enable blip true/false
            sprite = 781, -- blip sprite , check https://docs.fivem.net/docs/game-references/blips/ for more info about blip sprites
            color = 5, -- blip color , check https://docs.fivem.net/docs/game-references/blips/ for more info about blip colors
            scale = 1.0, -- blip scale / size
            name = 'CRAFTING TABLE 1', -- blip name (will be shown on map)
        },

        npc = { -- npc settings
            enable = true, -- enable npc true/false
            model = 'a_m_y_skater_01', -- npc model , check https://wiki.rage.mp/index.php?title=Peds for more info about peds
            coords = vec3(-83.93, -835.70, 39.6), -- npc coords
            heading = 150.23, -- npc heading
        },

    },

}



-- β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—
-- β•šβ•β•β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β•β•β–‘β–ˆβ–ˆβ•”β•β•β•β•β•β–‘β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•β•β•
-- β–‘β–‘β–‘β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–‘β–‘β–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ•‘β–‘β–‘β–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘
-- β–‘β–‘β–‘β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–‘β–‘β•šβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–‘β–‘β•šβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•β–‘β–‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–‘β•šβ•β•β•β–ˆβ–ˆβ•—
-- β–‘β–‘β–‘β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–ˆβ–ˆβ•‘β–‘β–‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–‘β–‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•
-- β–‘β–‘β–‘β•šβ•β•β–‘β–‘β–‘β•šβ•β•β–‘β–‘β•šβ•β•β•šβ•β•β–‘β•šβ•β•β•β•β•β•β–‘β–‘β•šβ•β•β•β•β•β•β–‘β•šβ•β•β•β•β•β•β•β•šβ•β•β–‘β–‘β•šβ•β•β•šβ•β•β•β•β•β•β–‘

-- Change trigger events to your own framework or script (if you dont know what you are doing, dont touch this)

function clientNotify(message)
    TriggerEvent("esx:showNotification", message)
end

function serverNotify(source, message)
    TriggerClientEvent("esx:showNotification", source, message)
end


function debug(msg)
    if Config.Debug then
        print(('^3[NKN-CRAFTINGTABLE]^0 %s'):format(msg))
    end
end


Config.Triggers = {
    playerLoaded = 'esx:playerLoaded', -- player loaded event
    setJob = 'esx:setJob', -- set job event
}

LANGUAGE.LUA

local languages = {
    ['en'] = {
        ['pressE'] = "Press ~INPUT_CONTEXT~ to open crafting table", -- message when player is near the marker
        ['collect'] = "You collected %s x%s",
        ['crafting'] = "You started to craft %s x%s",
        ['missingResources'] = "You are missing resources to craft this item",
        ['warningMessage'] = "To clear the crafting database for all players, please confirm the command by typing: " .. Config.Commands.clearDatabaseAll .. " yes",
        ['databaseAllDeleteMessage'] = "Successfully cleared the crafting database for all players",
        ['clearDatabasePlayer'] = "Successfully cleared the crafting database for player %s",
        ['clearDatabaseNoEntry'] = "No entry found for this player",
        ['error'] = "Error, please try again or contact an admin",
    },
    ['de'] = {
        ['pressE'] = "DrΓΌcke ~INPUT_CONTEXT~ um die Werkbank zu ΓΆffnen", -- message when player is near the marker
        ['collect'] = "Du hast %s x%s erhalten",
        ['crafting'] = "Du hast angefangen %s x%s herzustellen",
        ['missingResources'] = "Dir fehlen die Ressourcen um dieses Item herzustellen",
        ['warningMessage'] = "Um die Crafting Datenbank fΓΌr alle Spieler zu lΓΆschen, bestΓ€tige bitte den Befehl mit: " .. Config.Commands.clearDatabaseAll .. " yes",
        ['databaseAllDeleteMessage'] = "Die Crafting Datenbank fΓΌr alle Spieler wurde erfolgreich gelΓΆscht",
        ['clearDatabasePlayer'] = "Die Crafting Datenbank fΓΌr Spieler %s wurde erfolgreich gelΓΆscht",
        ['clearDatabaseNoEntry'] = "Kein Eintrag fΓΌr diesen Spieler gefunden",
        ['error'] = "Fehler, bitte versuche es erneut oder kontaktiere einen Admin",
    },
    ['tr'] = {
        ['pressE'] = "Crafting açmak için ~INPUT_CONTEXT~ tuşuna basın",
        ['collect'] = "x%s - %s topladΔ±nΔ±z",
        ['crafting'] = "%s x adet %s craft başladınız",
        ['missingResources'] = "Bu crafti yapmak için gereken itemlere sahip değilsiniz",
        ['warningMessage'] = "Tüm oyuncular için crafting database'i temizlemek için, lütfen komutu şu şekilde onaylayın: " .. Config.Commands.clearDatabaseAll .. " evet",
        ['databaseAllDeleteMessage'] = "Tüm oyuncular için crafting database'i başarıyla temizlendi",
        ['clearDatabasePlayer'] = "Oyuncu %s için crafting database'i başarıyla temizlendi",
        ['clearDatabaseNoEntry'] = "Bu oyuncu için giriş bulunamadı",
        ['error'] = "Hata, lütfen tekrar deneyin veya bir admin ile iletişime geçin",
    }
}



-- DONT TOUCH !!!!!! --
function Translate(key, ...)
    local lang = Config.Language or 'en'
    local translation = languages[lang][key] or "Translation Error"
    if select("#", ...) > 0 then
        return string.format(translation, ...)
    else
        return translation
    end
end

discord-config.lua

Discord = {}

Discord.Webhook = ""
Discord.WebhookDebug = ""
Discord.botName = "NKN-CraftingTable"

Discord.Settings = { -- identifiers to log (true = enabled, false = disabled)
    xbl = true,
    discord = true,
    steam = true,
    ip = true,
    license = true,
    fivem = true,
}


-- Function for discord logging (dont touch if you dont know what you are doing)
local DiscordColors = {
    red = 16711680,
    green = 65280,
    blue = 255,
    yellow = 16776960,
    purple = 8388736,
}

function getPlayerIdentifiers(xPlayer)
    local identifiers = {}
    for _, id in ipairs(GetPlayerIdentifiers(xPlayer.source)) do
        if string.match(id, "xbl:") and Discord.Settings.xbl then
            identifiers.xbox = id
        elseif string.match(id, "discord:") and Discord.Settings.discord then
            identifiers.discord = id
        elseif string.match(id, "steam:") and Discord.Settings.steam then
            identifiers.steam = id
        elseif string.match(id, "ip:") and Discord.Settings.ip then
            identifiers.ip = id
        elseif string.match(id, "license:") and Discord.Settings.license then
            identifiers.license = id
        elseif string.match(id, "fivem:") and Discord.Settings.fivem then
            identifiers.fivem = id
        end
    end
    return identifiers
end

function logToDiscord(title, message, color, channel, xPlayer)
    local webhook = channel == 'debug' and Discord.WebhookDebug or Discord.Webhook
    local embedColor = DiscordColors[color] or DiscordColors["green"] -- Default color is green for success messages

    local identifiers = xPlayer and getPlayerIdentifiers(xPlayer) or {}

    local function extractID(id)
        return id and string.match(id, ":(.+)") or "N/A"
    end

    local function createCodeBlock(id)
        return string.format('`%s`', extractID(id)) or "`N/A`"
    end

    local function createField(name, value, inline)
        return {name = name, value = value or "`N/A`", inline = inline or true}
    end

    local fields = {
        createField("Name", xPlayer and xPlayer.getName()),
        createField("Rockstar ID", createCodeBlock(xPlayer and xPlayer.identifier)),
        createField("Xbox License", createCodeBlock(identifiers.xbox)),
        createField("Discord ID", createCodeBlock(identifiers.discord)),
        createField("Steam", createCodeBlock(identifiers.steam)),
        createField("IP", createCodeBlock(identifiers.ip)),
        createField("License", createCodeBlock(identifiers.license)),
        createField("FiveM", createCodeBlock(identifiers.fivem)),
        createField("Discord Mention", identifiers.discord and "<@" .. extractID(identifiers.discord) .. ">", false),
    }

    local embeds = {{
        title = "**"..title.."**",
        description = message,
        type = "rich",
        color = embedColor,
        footer = { text = os.date("%Y.%m.%d ||| %X") },
        fields = fields,
    }}

    PerformHttpRequest(webhook, function(err, text, headers) end, 'POST', json.encode({username = Discord.botName, embeds = embeds}), { ['Content-Type'] = 'application/json' })
end

PreviousScript Configuration

Last updated 1 year ago

βš’οΈ
πŸ‘€