ktoxktox docs

Customization

Framework hooks and localization for ktx_fishing.

Customization

ktx_fishing ships with ESX support out of the box. Adapt it to any framework by editing the files in custom/.

Server Hooks

custom/server.lua contains four exports that handle framework-specific logic.

getPlayerIdentifier

Returns the player's unique identifier from the framework.

function getPlayerIdentifier(source)
    local xPlayer = ESX.GetPlayerFromId(source)
    if not xPlayer then return nil end
    return xPlayer.getIdentifier()
end

For QBx/QB-Core, replace with Player.PlayerData.citizenid or equivalent.

playerHasItem

Checks if the player has a specific item in their inventory.

function playerHasItem(source, itemName)
    local xPlayer = ESX.GetPlayerFromId(source)
    if not xPlayer then return false end
    local item = xPlayer.getInventoryItem(itemName)
    return item and item.count > 0
end

canPlayerReceiveItem

Checks if the player has inventory space for the reward.

function canPlayerReceiveItem(source, itemName, amount)
    local xPlayer = ESX.GetPlayerFromId(source)
    if not xPlayer then return false end
    return xPlayer.canCarryItem(itemName, amount)
end

addItemToPlayer

Gives an item to the player.

function addItemToPlayer(source, itemName, amount)
    local xPlayer = ESX.GetPlayerFromId(source)
    if not xPlayer then return false end
    xPlayer.addInventoryItem(itemName, amount)
    return true
end

Client Hooks

custom/client.lua contains notification handlers.

showNotification

Standard notification shown to the player.

function showNotification(message, type, title, duration)
    ESX.ShowNotification(message, type, duration, title)
end
  • message - notification text
  • type - "success", "error", "info", or a custom string your framework supports
  • title - optional title shown above the message
  • duration - display time in milliseconds

showHelpNotification

Contextual help text shown near interaction points.

function showHelpNotification(key, message)
    ESX.ShowHelpNotification(message)
end
  • key - a stable identifier for the prompt (lets your framework dedupe repeated prompts)
  • message - the help text to display

Localization

Translation files live in locales/. The resource ships with en.json and de.json.

To add a new language:

  1. Copy locales/en.json to locales/{code}.json (e.g. fr.json)
  2. Translate all string values
  3. Set "Locale": { "language": "fr" } in static/config.json

Keys must stay the same. Only translate the values.