Exports

Client Exports

Society Menu Management

-- Open society menu
exports['kossek_society']:openSocietyMenu(societyName, societyType, options)

-- Parameters:
-- societyName: string - Name of the society/job
-- societyType: string - 'job' or 'secondjob'
-- options: table (optional) - Configuration options

-- Example:
exports['kossek_society']:openSocietyMenu('police', 'job', {
    withAnimation = true,
    defaultRoute = '/dashboard'
})
-- Close society menu
exports['kossek_society']:closeSocietyMenu()

-- Example:
exports['kossek_society']:closeSocietyMenu()
-- Check if menu is open
local isOpen = exports['kossek_society']:isMenuOpen()

-- Example:
if exports['kossek_society']:isMenuOpen() then
    print("Society menu is currently open")
end
-- Get current society information
local currentSociety = exports['kossek_society']:getCurrentSociety()

-- Returns:
-- {
--     name = "police",
--     type = "job"
-- }

-- Example:
local society = exports['kossek_society']:getCurrentSociety()
if society.name then
    print("Current society: " .. society.name)
end

Server Exports

Society Management

-- Register a new society
exports['kossek_society']:registerSociety(name, label, account, datastore, inventory, data)

-- Parameters:
-- name: string - Society identifier
-- label: string - Display name
-- account: string - Bank account name
-- datastore: string - Datastore name (optional)
-- inventory: string - Inventory name (optional)
-- data: table - Additional data (optional)

-- Example:
exports['kossek_society']:registerSociety('police', 'Los Santos Police Department', 'society_police')
-- Get society object
local society = exports['kossek_society']:getSociety(societyName)

-- Example:
local police = exports['kossek_society']:getSociety('police')
if police then
    police:getMoney(function(money)
        print("Police money: $" .. money)
    end)
end

Banking Operations

-- Get society money
society:getMoney(callback)

-- Add money to society
society:addMoney(amount, callback)

-- Remove money from society
society:removeMoney(amount, callback)

-- Example:
local police = exports['kossek_society']:getSociety('police')
police:getMoney(function(currentMoney)
    print("Current balance: $" .. currentMoney)
    
    police:addMoney(5000, function(success)
        if success then
            print("Added $5000 to police account")
        end
    end)
end)

Permissions Management

-- Check if player has permission
local hasPermission = exports['kossek_society']:hasPermission(playerId, societyName, societyType, permissionType)

-- Example:
local canWithdraw = exports['kossek_society']:hasPermission(source, 'police', 'job', 'withdraw_money')
if canWithdraw then
    -- Allow withdrawal
end
-- Check if player is boss
local isBoss = exports['kossek_society']:isBoss(playerId, societyName, societyType)

-- Example:
local isPoliceChief = exports['kossek_society']:isBoss(source, 'police', 'job')
if isPoliceChief then
    -- Allow boss actions
end
-- Get player permissions
local permissions = exports['kossek_society']:getPlayerPermissions(playerId, societyName, societyType)

-- Example:
local permissions = exports['kossek_society']:getPlayerPermissions(source, 'police', 'job')
for _, permission in ipairs(permissions) do
    print("Player has permission: " .. permission)
end
-- Clear player permission cache
exports['kossek_society']:clearPlayerCache(identifier)

-- Example:
exports['kossek_society']:clearPlayerCache('license:abc123')

Upgrades Management

-- Get society upgrades
local upgrades = exports['kossek_society']:getSocietyUpgrades(societyName, societyType)

-- Example:
local policeUpgrades = exports['kossek_society']:getSocietyUpgrades('police', 'job')
print("Armory level: " .. (policeUpgrades.armory.currentLevel or 0))
-- Check upgrade permission
local hasUpgrade, level = exports['kossek_society']:hasUpgradePermission(societyName, societyType, upgradeType, requiredLevel)

-- Example:
local hasArmory, armoryLevel = exports['kossek_society']:hasUpgradePermission('police', 'job', 'armory', 1)
if hasArmory then
    print("Police has armory level " .. armoryLevel)
end
-- Get upgrade slots
local slots, hasUpgrade = exports['kossek_society']:getUpgradeSlots(societyName, societyType, upgradeType)

-- Example:
local armorySlots, hasArmoryUpgrade = exports['kossek_society']:getUpgradeSlots('police', 'job', 'armory')
if hasArmoryUpgrade then
    print("Armory has " .. armorySlots .. " slots")
else
    print("No armory upgrade")
end
-- Get organization level
local level = exports['kossek_society']:getOrganizationLevel(societyName, societyType)

-- Example:
local policeLevel = exports['kossek_society']:getOrganizationLevel('police', 'job')
print("Police organization level: " .. policeLevel)

Bonus Management

-- Get bonus settings
local settings = exports['kossek_society']:getBonusSettings(societyName, societyType)

-- Set bonus settings
exports['kossek_society']:setBonusSettings(societyName, societyType, settings)

-- Process payouts manually
exports['kossek_society']:processPayouts()

-- Example:
local policeSettings = exports['kossek_society']:getBonusSettings('police', 'job')
print("Member bonus: $" .. policeSettings.member_bonus)

-- Update settings
policeSettings.member_bonus = 10000
exports['kossek_society']:setBonusSettings('police', 'job', policeSettings)

History Management

-- Log action
local actionId = exports['kossek_society']:logAction(societyName, societyType, actionType, performedBy, performedByIdentifier, metadata)

-- Example:
exports['kossek_society']:logAction('police', 'job', 'custom_action', 'John Doe', 'license:abc123', {
    description = 'Custom action performed',
    amount = 5000,
    target = 'Jane Doe'
})

Last updated