Skip to main content
Server exports allow you to interact with Zyra Store scripts from the server side of your FiveM resource. Through these functions you can register players, read and write data, verify permissions, and access the script configuration, all without modifying Zyra Store’s source code. Remember that the standard syntax for invoking any export in Lua is:
All exports documented on this page must be called exclusively from server-side scripts (server.lua).

RegisterPlayer(source, data)

Registers or updates a player’s data in the script’s system. Call this function when a player connects or when you need to force an update of their information.
number
required
The FiveM server ID of the player (the source value in server events).
table
required
Table with the player data to register. Recommended fields:
boolean
true if the registration was successful; false in case of error.
other-resource/server.lua

GetConfig()

Returns the script’s complete configuration table as defined in config.lua. Useful for reading script settings from an external resource without duplicating configuration values.
none
This function receives no parameters.
table
The script’s complete Config table, including all its fields and current values.
other-resource/server.lua

SetPlayerData(source, key, value)

Sets the value of a specific field in the data stored by the script for a player. You can use this function to write custom fields or update existing values in real time.
number
required
The FiveM server ID of the target player.
string
required
The name of the data field you want to modify (for example, 'customField').
any
required
The new value to assign to the field. Can be of any type compatible with Lua.
boolean
true if the field was updated correctly; false if the player does not exist or there was an error.
other-resource/server.lua

GetPlayerData(source)

Returns the data stored on the server for a specific player. Returns nil if the player is not registered or is not connected.
number
required
The FiveM server ID of the player whose information you want to obtain.
table | nil
A table with the player’s data, or nil if the player was not found.
other-resource/server.lua

HasPermission(source, level)

Checks whether a player has a specific permission level according to the script’s permission configuration. Use this function before executing restricted actions to make sure the player is authorized.
number
required
The FiveM server ID of the player you want to verify.
string
required
The permission level to check. Accepted values: 'admin', 'mod', 'vip'.
boolean
true if the player has the indicated permission level; false otherwise.
other-resource/server.lua

Server exports can only be invoked from scripts that run on the server side (server.lua or files marked as server in the fxmanifest.lua). Calling a server export from a client script will cause a runtime error and the code will not execute correctly.

To see the available server-side events, visit the server events reference.