Server exports
Each export below is expandable. Open one to see description, arguments, return value, and example code.
Old resource name
exports['fs_safezonecreator'] still works for scripts written before the rename, but use fwb_safezonecreator in new code.
Safezone
IsPlayerInsideSafezone(playerId)
Checks whether a specific player is currently inside a safezone.
Arguments
playerId- server ID of the player
Returns
trueif the player is inside a safezonefalseif the player is not inside a safezone
Example
local inside = exports['fwb_safezonecreator']:IsPlayerInsideSafezone(source)
if inside then
print('This player is inside a safezone')
endGetPlayerSafezone(playerId)
Returns a copy of the safezone a specific player is in.
Arguments
playerId- server ID of the player
Returns
- safezone table (
id,name,settings,polyzone) when the player is inside a safezone nilwhen the player is not inside a safezone
Example
local safezone = exports['fwb_safezonecreator']:GetPlayerSafezone(source)
if safezone then
print(('Player is inside safezone: %s'):format(safezone.name))
endBridge
These read data through the script's built-in framework and inventory bridge, so they work the same on ESX, QBCore, and Qbox.
GetFrameworkName()
Returns the framework the bridge is using.
Returns
'esx','qbcore'or'qbox'
Example
print(exports['fwb_safezonecreator']:GetFrameworkName())GetPlayerData(playerId)
Returns basic data for one player.
Arguments
playerId- server ID of the player
Returns
- table with
source,name,identifier,group,job,jobLabel,jobGrade
Example
local data = exports['fwb_safezonecreator']:GetPlayerData(source)
print(data.name, data.job)GetPlayerJob(playerId)
Returns a player's job.
Arguments
playerId- server ID of the player
Returns
- table with
name,label,grade,gradeLabel,duty(unemployedwhen the player has no job)
Example
local job = exports['fwb_safezonecreator']:GetPlayerJob(source)
if job.name == 'police' then
print('Police officer, grade', job.grade)
endGetActivePlayerSources()
Returns the server IDs of all loaded players.
Returns
- array of server IDs
Example
for _, playerId in ipairs(exports['fwb_safezonecreator']:GetActivePlayerSources()) do
print(playerId)
endGetAllActivePlayers()
Returns GetPlayerData for every loaded player.
Returns
- array of player data tables (see
GetPlayerData)
GetWeaponItems()
Returns the weapons known to the active inventory (or the framework's item list).
Returns
- array of
{ name, label, hash }
Example
for _, weapon in ipairs(exports['fwb_safezonecreator']:GetWeaponItems()) do
print(weapon.name, weapon.label)
end