๐Ÿ“Configuration

Client Config

Config = {}

RegisterCommand('orgpanel', function()
    openPanel()
end)

Config.tabletEntity = nil -- DO NOT CHANGE
Config.tabletModel = "prop_cs_tablet"
Config.tabletDict = "amb@world_human_seat_wall_tablet@female@base"
Config.tabletAnim = "base"

Config.startTabletAnimation = function()
    lib.requestAnimDict(Config.tabletDict)
    if Config.tabletEntity then
        Config.stopTabletAnimation()
    end
    lib.requestModel(Config.tabletModel)
    Config.tabletEntity = CreateObject(GetHashKey(Config.tabletModel), 1.0, 1.0, 1.0, 1, 1, 0)
    AttachEntityToEntity(Config.tabletEntity, cache.ped, GetPedBoneIndex(cache.ped, 57005), 0.12, 0.10, -0.13, 25.0, 170.0, 160.0, true, true, false, true, 1, true)
    TaskPlayAnim(cache.ped, Config.tabletDict, Config.tabletAnim, 8.0, -8.0, -1, 50, 0, false, false, false)
end


Config.stopTabletAnimation = function()
	if Config.tabletEntity then
		StopAnimTask(cache.ped, Config.tabletDict, Config.tabletAnim ,8.0, -8.0, -1, 50, 0, false, false, false)
		DeleteEntity(Config.tabletEntity)
		Config.tabletEntity = nil
	end
end

Config.showNotification = function(msg)
    lib.notify({
        title = 'Organization Panel',
        description = msg,
        type = 'inform'
    })
end

Config.peds = { -- peds where you can create organization
    {
        coords = vec3(939.5922, -1490.5969, 30.0927),
        model = 'a_m_m_og_boss_01',
        heading = 180.0
    }
}

Config.pedinteraction = function(ped)
    exports.ox_target:addBoxZone({
        coords = ped.coords,
        size = vec3(1, 1, 2),
        rotation = 340,
        debug = drawZones,
        options = {
            {
                icon = 'fas fa-sitemap',
                label = 'Create an organization',
                distance = 2.0,
                onSelect = function(data)
                    Framework.TriggerServerCallback('pp-orgpanel:getorganization', function(isinorganization) 
                        Config.createOrganization(isinorganization)
                    end)
                end
            },
            {
                icon = 'fas fa-dollar-sign',
                label = "Deposit cash into the organization's account",
                distance = 2.0,
                onSelect = function(data)
                    Framework.TriggerServerCallback('pp-orgpanel:getorganization', function(isinorganization) 
                        Config.depositCash(isinorganization)
                    end)
                end
            },
        }
    })
end

Config.createOrganization = function(isinorganization)
    if isinorganization then
        return Config.showNotification('You are already in organization!')
    end
    local input = lib.inputDialog('Create organization', {
        {type = 'input', label = 'Organization name', description = 'Cost: 40.000$', required = true, max = 10},
    })
    if not input then return end
    TriggerServerEvent('pp-orgpanel:createneworg', input[1])
end

Config.depositCash = function(isinorganization)
    if not isinorganization then
        return Config.showNotification('You are not in any organization!')
    end
    local input = lib.inputDialog('Deposit cash', {
        {type = 'number', label = 'Deposit amount', required = true, min = 0},
    })
    if not input then return end
    TriggerServerEvent('pp-orgpanel:sendmoney', input[1])
end

lib.callback.register('rc-orgpanel:addmember', function(orgname, name)
    local alert = lib.alertDialog({
        header = 'Atention!',
        content = name .. ' invited you to join organization ' .. orgname .. ', do you want to join?',
        centered = true,
        cancel = true
    })
    return alert == 'confirm' and true or false
end)

Config.createStash = function(stash)
    exports.ox_target:addBoxZone({
        coords = stash.coords,
        size = stash.size,
        rotation = stash.rotation,
        debug = false,
        options = {
            {
                icon = 'fa-solid fa-hands',
                label = t('backend.open_stash'),
                distance = 2.0,
                onSelect = function()
                    exports.ox_inventory:openInventory('stash', 'orgstash_' .. stash.name)
                end
            }
        }
    })
end

Server Config

Was this helpful?