πŸ”—Exports

Important!


These functions are exports by the VIP system for other server scripts to use directly, making integration easier.


AddDiamonds(playerId, amount)

Adds a specified amount of diamonds to the player.

  • Updates the player's VIP data.

  • Sends an update to the client with the new data.

Usage:

exports['mg-vipsystem']:AddDiamonds(playerId, amount)

RemoveDiamonds(playerId, amount)

Removes a specified amount of diamonds from the player, never letting the value go below zero.

  • Updates and sends the updated data to the client.

Usage:

exports['mg-vipsystem']:RemoveDiamonds(playerId, amount)

SetVIP(playerId, tier)

Sets the player's VIP level to the specified tier (between 1 and the maximum defined in the config).

  • Updates the database and notifies the client.

Usage:

exports['mg-vipsystem']:SetVIP(playerId, tier)

RemoveVIP(playerId)

Removes the player's VIP status by setting the tier to nil. This is a shortcut for SetVIP(playerId, nil).

Usage:

exports['mg-vipsystem']:RemoveVIP(playerId)

CheckVIP(playerId)

Checks the player's VIP status and returns data if it exists:

  • tier (VIP level)

  • expiresAt (expiration timestamp)

  • active (boolean indicating if VIP is still active)

Usage:

local vipInfo = exports['mg-vipsystem']:CheckVIP(playerId)
if vipInfo and vipInfo.active then
    -- VIP is active
end

Last updated