Server-side exports

isInOrg

Does exactly the same thing as the client sided export, returns true if player is in an organization, false if else, the only difference is you can pass a player server id

exports['cs_crime']:isInOrg(source)

getOrgData

Returns all data of a specified organization, searches by organization ID

exports['cs_crime']:getOrgData(OrgId)

Example data returned from this export

{
    success = true,
    data = {
        id = 1,
        name = "Los Santos Familia",
        announcements = {
            {
                id = 1,
                content = "Meeting tonight at 20:00",
                author = "char1:123456",
                authorName = "John Doe",
                timestamp = 1703425200,
                pinned = false
            }
        },
        members = {
            ["char1:123456"] = {
                grade = 5,
                gradeName = "Leader",
                name = "John Doe",
                last_seen = "2023-12-24 20:00:00"
            },
            ["char1:654321"] = {
                grade = 3,
                gradeName = "Officer",
                name = "Jane Smith",
                last_seen = "2023-12-24 19:30:00"
            }
        },
        grades = {
            ["0"] = { name = "Recruit", permissions = {} },
            ["1"] = { name = "Member", permissions = {"groupStash"} },
            ["3"] = { name = "Officer", permissions = {"groupStash", "addMember"} },
            ["5"] = { name = "Leader", permissions = {"*"} }
        },
        account_number = "123456789",
        balance = 50000,
        upgrades = {
            organization = {
                ["1"] = 2,
                ["2"] = 1 
            },
            base = {
                ["1"] = 1
            }
        },
        market_access = true,
        market_slots = 5,
        hideout = {
            id = 1,
            coords = vector3(100.0, 200.0, 30.0),
            streetName = "Grove Street",
            purchasedAt = "2023-12-01 12:00:00",
            furniture = {
                completed = true,
                items = {
                    stash = {
                        coords = vector3(101.0, 201.0, 30.0),
                        heading = 90.0,
                        type = "member_stash"
                    }
                }
            }
        },
        active_missions = {
            {
                id = 1,
                name = "Bank Heist",
                started_at = "2023-12-24 18:00:00",
                duration = 3600,
                reward = 100000
            }
        },
        completed_missions = {
            {
                id = 2,
                name = "Store Robbery",
                completed_at = "2023-12-23 15:00:00",
                reward = 25000
            }
        },
        transactions = {
            {
                id = "tx_123",
                amount = 25000,
                type = "deposit",
                description = "Mission reward",
                timestamp = "2023-12-23 15:00:00",
                metadata = {
                    source = "mission_complete",
                    reference = "mission_2"
                }
            }
        },
        activeMembers = {
            {
                name = "John Doe",
                grade = 5,
                gradeName = "Leader"
            }
        }
    }
}

getOrgDataFromIdentifier

Works the same way getOrgData does, with a minor difference, returns organization data based on a players identifier, additionally returns a "self" json object which contains player data from the specified identifier

getOrgOnlineMembers

Returns all online members of a specified organization by organization id, if nothing passed returns every online organization player and passes additional data such as org_name and org_id, if a string is passed it searches the database for a organization with an exact match in name column and returns online members from that organization.

Example returned data from this export

getOrgMembers

Returns all organization members, by organization id, if nothing passed returns every organization player and passes additional data such as org_name and org_id, if a string is passed it searches the database for a organization with an exact match in name column and returns members from that organization.

Example returned data from this export

addBalance

Adds balance to an organizations account, please don't use it in unprotected server events - it will be exploited by cheaters, it's up to you to add security precautions when triggering it

removeBalance

Deducts balance from an organizations account - again, please don't use it in unprotected server events - it will be exploited by cheaters, it's up to you to add security precautions when triggering it

addNewMission

Adds a new active mission to an organization

cancelMission

Cancels a specified mission by mission id

completeMission

Sets the mission as completed, selected by mission id, runs the function from /server/editable.lua called onMissionComplete, feel free to change the logic if you need to. On completion it moves an active mission to completed missions and adds balance to the organizations account (adds the mission.reward amount)

getActiveMissions

Lists all active missions of an organization by organization id

notify

Returns notification logic defined in /server/editable.lua

Suggested security precautions

When triggering addBalance/removeBalance add comprehensive serverside checks, if you have problems with securing your events open a ticket and explain your implementation, we will help with securing your missions from cheaters

Last updated