Exports
Create, remove and read STG Advanced Warning Zone zones from your own scripts, for example to mark a robbery automatically when it starts.
Other resources can create and remove zones, for example to mark a bank automatically when a robbery starts. Zones made through an export behave like zones made in the menu: every player sees the blip, gets the enter and leave warnings, and STG.Announce runs.
Zones live in memory only and are cleared when the resource or the server restarts.
Server exports
addZone
local zoneId = exports['stg-warnzone']:addZone(vector3(150.2, -1040.5, 29.3), 'Fleeca Robbery', '3', 50, 10, 'Vespucci Blvd')Prop
Type
Returns the id of the new zone.
removeZone
exports['stg-warnzone']:removeZone(zoneId)Removes the zone for every player. Returns true when the zone existed, otherwise false.
getZones / getZoneById
local zones = exports['stg-warnzone']:getZones()
local zone = exports['stg-warnzone']:getZoneById(zoneId)getZones returns every active zone, keyed by zone id. getZoneById returns one zone, or nil when it does not exist. Each zone has these fields:
Prop
Type
Client exports
addZone
local zoneId = exports['stg-warnzone']:addZone('Fleeca Robbery', '3', 50, 10)Prop
Type
The street name for the announcement is taken from the coordinates. Waits for the server and returns the id of the new zone.
removeZone
exports['stg-warnzone']:removeZone(zoneId)Removes the zone for every player.
getZones / getZoneById
local zones = exports['stg-warnzone']:getZones()
local zone = exports['stg-warnzone']:getZoneById(zoneId)Return the zones this client knows about, keyed by zone id. Each one has blip (the map blip handle), coord (centre), meters (zone size as passed in) and radius (the radius used for the blip and the enter warning).
openMenu
exports['stg-warnzone']:openMenu()Opens the zone menu, for example from a police tablet or a radial menu. The same job check as the command applies.
Still having trouble?
Open a ticket on our Discord. Our team answers around 15 hours a day.