arrow-down-from-lineExports

Criminal Stats

Description

Sets the current jail time for the player and increments their arrest count in the lone_leaderboard tracking system. Designed to be used in police or law enforcement job scripts when a player is sent to jail.

Client-Side Export

exports["lone_leaderboard"]:SetJail(time) --time in minutes

Parameters

Name
Type
Description

time

number

Jail time in minutes (integer).


Usage Example

exports["lone_leaderboard"]:SetJail(15) -- Sets 15 minutes jail time and increments arrest count

Behavior

  • Sends a triggers a client event to:

    1. Add the jail time (in minutes) to the player's total jail time in the database.

    2. Increment the player's arrest count (times_arrested) by 1.

  • Saves the updated values in the lone_leaderboard table (via server).


Custom Job Stats

Description

Updates the job-based statistic for a specific player in the lone_leaderboard database table. Adds a given amount to the existing stat for the provided job.

Config Dependency

Ensure Config.JobStats is defined like this:

🔧 Parameters:

Parameter
Type
Description

src

string

The player's source/server ID (source)

jobName

string

The job key as defined in your Config.JobStats

amount

number

The amount to add to the job stat

📎 Notes:

  • The job must be listed in Config.JobStats or it will return without updating.

  • This export is server-side only and must be used from a server script.

  • Automatically handles fetching the player's identifier and updating the database.

  • job_stats is stored as a JSON object per player.

Usage Example


Custom Stats

Description

Updates a player's custom stat value in the lone_leaderboard table for a given stat name by a specified amount. This allows dynamic, configurable stat tracking like completed missions, heists, jobs, etc.

Config Dependency

Ensure Config.CustomStats is defined like this:

Parameters

Name
Type
Description

src

number

The player source ID (source in server context).

stat

string

The name/key of the custom stat to update. Must be defined in the config.

amount

number

The amount to add to the current stat value (can be negative to subtract).

Notes

  • This function prevents injection of arbitrary keys by only updating stats defined in Config.CustomStats.

  • custom_stats is stored as a JSON object per player.

  • This function is exported using exports() for use across other server-side resources.

Usage Example


Get Player Data

Description

Fetches the full leaderboard data for a given player from the lone_leaderboard database table using their identifier. Primarily used to retrieve a player's stored stats (playtime, kills, deaths, etc.).

Example

Parameters

Name
Type
Description

src

number

The server-side player source ID (e.g., source)


Returns

  • table (player data row) – if the player exists in the leaderboard table.

  • nil – if no data is found or if the identifier is invalid.


Last updated