Server


Crypto Exports

AddCryptoToPlayer

Adds cryptocurrency to a player's balance.

Location: server/crypto.lua

Parameters:

  • citizenid (string) - The citizenid of the player

  • cryptoCode (string) - The crypto code (SCRPT, GG, RACE)

  • amount (number) - The amount to add

Returns:

  • number|nil - The new balance, or nil if invalid parameters

Example:

local newBalance = exports['mad-crimetablet']:AddCryptoToPlayer('ABC12345', 'SCRPT', 100)
if newBalance then
    print("New balance: " .. newBalance)
end

RemoveCryptoFromPlayer

Removes cryptocurrency from a player's balance.

Location: server/crypto.lua

Parameters:

  • citizenid (string) - The citizenid of the player

  • cryptoCode (string) - The crypto code (SCRPT, GG, RACE)

  • amount (number) - The amount to remove

Returns:

  • boolean - true on success, false on failure

Example:

GetPlayerCryptoBalance

Gets a player's cryptocurrency balance.

Location: server/crypto.lua

Parameters:

  • citizenid (string) - The citizenid of the player

  • cryptoCode (string) - The crypto code (SCRPT, GG, RACE)

Returns:

  • number - The balance (returns 0.0 if not found or invalid)

Example:


Services Exports

IsServiceInCooldown

Checks if a service is currently in cooldown.

Location: server/services.lua

Parameters:

  • serviceType (string) - The service type identifier

Returns:

  • boolean - true if in cooldown, false otherwise

  • number - Remaining time in seconds (0 if not in cooldown)

Example:


StartServiceCooldown

Starts a cooldown period for a service.

Location: server/services.lua

Parameters:

  • serviceType (string) - The service type identifier

Returns:

  • boolean - true on success, false if service doesn't exist

Example:


ClearServiceCooldown

Manually clears a service cooldown (typically for admin use).

Location: server/services.lua

Parameters:

  • serviceType (string) - The service type identifier

Returns:

  • boolean - true on success, false if service doesn't exist

Example:


FormatTimeRemaining

Formats remaining time in a human-readable format.

Location: server/services.lua

Parameters:

  • seconds (number) - Time in seconds to format

Returns:

  • string - Formatted time (e.g., "2h 30m", "45m 30s", "30s")

Example:


PayForService

Processes payment for a service.

Location: server/services.lua

Parameters:

  • source (number) - The player's server ID

  • serviceType (string) - The service type identifier

Returns:

  • boolean - true if payment was successful, false otherwise

Example:


IsGroupInMission

Checks if a group is currently in an active mission.

Location: server/services.lua

Parameters:

  • groupID (number) - The group ID to check

Returns:

  • boolean - true if group has active mission, false otherwise

  • string|nil - The service type if in mission, nil otherwise

Example:


RegisterGroupMission

Registers an active mission for a group.

Location: server/services.lua

Parameters:

  • groupID (number) - The group ID

  • serviceType (string) - The service type identifier

  • missionData (table, optional) - Additional mission data

Returns:

  • boolean - true on success, false if group already has active mission

Example:


UnregisterGroupMission

Removes an active mission registration for a group.

Location: server/services.lua

Parameters:

  • groupID (number) - The group ID

Returns:

  • void

Example:


GetGroupMissionData

Gets the active mission data for a group.

Location: server/services.lua

Parameters:

  • groupID (number) - The group ID

Returns:

  • table|nil - Mission data table or nil if no active mission

Example:


Groups Exports

FindGroupByMember

Finds the group ID that a player belongs to.

Location: server/groups.lua

Parameters:

  • source (number) - The player's server ID

Returns:

  • number - The group ID, or 0 if player is not in a group

Example:


getGroupMembers

Gets all members of a group.

Location: server/groups.lua

Parameters:

  • groupID (number) - The group ID

Returns:

  • table - Array of player server IDs (leader first, then helpers)

Example:


IsGroupLeader

Checks if a player is the leader of their group.

Location: server/groups.lua

Parameters:

  • source (number) - The player's server ID

  • groupID (number) - The group ID

Returns:

  • boolean - true if player is the leader, false otherwise

Example:


GetGroupName

Gets the name of a group.

Location: server/groups.lua

Parameters:

  • groupID (number) - The group ID

Returns:

  • string|nil - The group name, or nil if group doesn't exist

Example:


CreateBlipForGroup

Creates a blip for all members of a group.

Location: server/groups.lua

Parameters:

  • groupID (number) - The group ID

  • name (string) - The blip name/identifier

  • data (table) - Blip data (sprite, color, coords, etc.)

Returns:

  • void

Example:


RemoveBlipForGroup

Removes a blip for all members of a group.

Location: server/groups.lua

Parameters:

  • groupID (number) - The group ID

  • name (string) - The blip name/identifier to remove

Returns:

  • void

Example:


GroupEvent

Triggers a client event for all members of a group.

Location: server/groups.lua

Parameters:

  • groupID (number) - The group ID

  • event (string) - The event name to trigger

  • args (table, optional) - Arguments to pass to the event

Returns:

  • void

Example:


Faction Exports

IsCompetitionInPausePeriod

Checks if the competition is currently in a pause period (between ending and restart).

Location: server/main.lua

Parameters:

  • None

Returns:

  • boolean - true if in pause period, false otherwise

Example:


GetFactionId

Gets the faction ID for a player based on their citizenid.

Location: server/main.lua

Parameters:

  • citizenid (string): The citizen ID of the player.

Returns:

  • string|nil: The faction ID if the player belongs to a faction, or nil if they don't belong to any faction.

Example:


AddFactionReputation

Adds reputation to a faction, with automatic zone radius updates and competition pause period checks.

Location: server/main.lua

Parameters:

  • factionId (string): The faction ID to add reputation to.

  • amount (number): The amount of reputation to add (can be negative to remove reputation).

Returns:

  • boolean: Returns true on success, false on failure (faction not found, competition in pause period, or invalid parameters).

Example:


AddFactionXP

Adds XP to a faction, with automatic level-up handling and territory buffs.

Location: server/main.lua

Parameters:

  • factionId (number) - The faction ID

  • xpAmount (number) - The amount of XP to add

  • citizenid (string, optional) - The citizenid of the player who earned the XP (for buff calculation)

Returns:

  • boolean - true on success, false on failure

  • boolean - true if faction leveled up, false otherwise

  • number - The new faction level

Example:


Territory Exports

GetPlayerTerritoryBuffs

Gets all territory buffs for a player based on their faction's controlled territories.

Location: server/territories.lua

Parameters:

  • source (number) - The player's server ID

Returns:

  • table - Table with buff types as keys and values as numbers

Example:


Delivery Race Exports

SetDeliveryRaceWaiting

Sets a delivery race team as waiting.

Location: server/delivery_race_server.lua

Parameters:

  • teamName (string) - The team name

  • groupID (number) - The group ID

Returns:

  • void

Example:


ClearDeliveryRaceWaiting

Clears the waiting state for delivery race.

Location: server/delivery_race_server.lua

Parameters:

  • None

Returns:

  • void

Example:


Notes

  • All server exports require the resource name: exports['mad-crimetablet']:ExportName()

  • Client exports can be called from any client-side script

  • Most exports include validation and will return safe defaults (like 0 or false) on invalid input

  • Group-related exports work with the internal group system and require valid group IDs

  • Crypto exports validate crypto codes against the configuration (SCRPT, GG, RACE)

  • Service cooldowns are global and affect all players

  • Territory buffs are calculated based on the player's faction's controlled territories


Support

For issues or questions, please refer to the main documentation or contact support.

Last updated