Exports and Commands

๐Ÿ–ฅ๏ธ Server-Side Exports

AddAddiction

Purpose: Add addiction points to a player from server-side scripts.

Usage:

exports['envi-addictions']:AddAddiction(source, addictionType, points)

Parameters:

  • source (number): Player's server ID

  • addictionType (string): Type of addiction (must exist in config)

  • points (number): Amount of addiction points to add

Returns: boolean - Success status

Example:

-- Add 50 gambling addiction points to player
exports['envi-addictions']:AddAddiction(source, 'gambling', 50)

RemoveAddiction

Purpose: Remove addiction points from a player.

Usage:

Parameters:

  • source (number): Player's server ID

  • addictionType (string): Type of addiction

  • points (number): Amount of points to remove (-1 to remove all)

Returns: boolean - Success status

Example:


CureAddiction

Purpose: Completely cure a specific addiction (convenience function).

Usage:

Parameters:

  • source (number): Player's server ID

  • addictionType (string): Type of addiction to cure

Returns: boolean - Success status

Example:


GiveMaxAddiction

Purpose: Give maximum addiction level to a player.

Usage:

Parameters:

  • source (number): Player's server ID

  • addictionType (string): Type of addiction

Returns: boolean - Success status

Example:


UsedItem

Purpose: Trigger addiction effects when a player uses an item. - NOTE: IF YOU ARE USING OX_INVENTORY - YOU DO NOT NEED THIS!

Usage:

Parameters:

  • source (number): Player's server ID

  • itemName (string): Name of the item used

Returns: void

Example:


๐Ÿ’ป Client-Side Exports

AddAddiction

Purpose: Add addiction points from client-side scripts.

Usage:

Parameters:

  • addictionType (string): Type of addiction

  • points (number): Amount of addiction points to add

Returns: boolean - Success status

Example:


GiveMaxAddiction

Purpose: Give maximum addiction level from client.

Usage:

Parameters:

  • addictionType (string): Type of addiction

Returns: boolean - Success status

Example:


UpdatePlayerBlemishes

Purpose: Update player's visual effects based on current addictions.

Usage:

Parameters: None

Returns: void

Example:


ClearAllVisualEffects

Purpose: Clear all addiction-related visual effects.

Usage:

Parameters: None

Returns: void

Example:


๐Ÿงช Test Mode Settings

Config.SelfTestMode - Allows you to run Blood Tests / Stomach Pumping / Commit To Rehab on yourself for testing purposes

Config.TestCommands

Note: These commands are only available when Config.TestCommands = true

Server Test Mode Commands

/testaddiction

Test addiction level calculations.

/giveaddiction

Give addiction points to yourself.

/giveAllAddictions

Give all available addictions to yourself.

Client Test Mode Commands

/addcraving

Add craving points to a specific addiction.

/takeBloodFromSelf (when Config.SelfTestMode is true and on Authorised Job)

Take a blood sample from yourself.

/addAddiction

Test the AddAddiction export function.

/removeAddiction

Test the RemoveAddiction export function.

/cureAddiction

Test the CureAddiction export function.

/maxAddiction

Test the GiveMaxAddiction export function.

/updateBlemishes

Test the blemish system and update visual effects.

/clearBlemishes

Clear all visual effects manually.

/toggleFocus

Toggle NUI focus (bound to Left Alt by default).

Yoga Commands (if enabled in config)

Start yoga activity for time reduction in rehab.


๐Ÿ“– Usage Examples

Adding Gambling Addiction After Casino Activity

Drug Taking Consequences

Medical Treatment Script

Client-side Integration

Last updated