| GetZoneFromID (identifier) |
GetZoneFromID function. |
| DeleteZone (identifier) |
DeleteZone function. |
| IsCoordsInAnyZones (coords) |
GetZones function. |
| IsPlayerInZone (player, zone) |
IsPlayerInZone function. |
| GetPlayersInZone (zone) |
GetPlayersInZone function. |
| GetAmountOfPlayersInZone (zone) |
GetAmountOfPlayersInZone function. |
| IsAnyPlayerInZone (zone) |
IsAnyPlayerInZone function. |
| GetPlayerZones (player) |
GetPlayerZones function. |
| TriggerEventInZone (zone, event, ...) |
TriggerEventInZone function. |
| AddPropToZone (zone, id, propData) |
AddPropToZone function. |
| RemovePropFromZone (zone, id) |
RemovePropFromZone function. |
| UpdatePropModelInZone (zone, id, model) |
UpdatePropModelInZone function. |
| UpdatePropCoordsInZone (zone, id, coords, offsets) |
UpdatePropCoordsInZone function. |
| GetPropsFromZone (zone) |
GetPropsFromZone function. |
| AddVehicleToZone (zone, id, vehData) |
AddVehicleToZone function. |
| RemoveVehicleFromZone (zone, id) |
RemoveVehicleFromZone function. |
| UpdateVehicleInZone (zone, id, VehicleData) |
UpdateVehicleInZone function. |
| UpdateVehicleTextInZone (zone, id, text) |
UpdateVehicleTextInZone function. |
| UpdateVehicleModelInZone (zone, id, model) |
UpdateVehicleModelInZone function. |
| GetVehicleFromZone (zone, id) |
GetVehicleFromZone function. |
| GetVehiclesFromZone (zone) |
GetVehiclesFromZone function. |
| AddPedToZone (zone, id, pedData) |
AddPedToZone function. |
| RemovePedFromZone (zone, id) |
RemovePedFromZone function. |
| GetPedsFromZone (zone) |
GetPedsFromZone function. |
| GetPedFromZone (zone, id) |
GetPedFromZone function. |
| TriggerEvent (eventName, ...) |
TriggerEvent sub-function. |
-
GetZoneFromID (identifier)
-
GetZoneFromID function.
If the zone or circle with the identifier "central_park" exists, it will be stored in the variable 'zone'.
If no such zone or circle exists, 'zone' will be nil.
Parameters:
- identifier
A unique identifier for the zone or circle
Returns:
The zone or circle corresponding to the identifier, or nil if no such zone or circle exists
Usage:
local zone = exports.sd_util:GetZoneFromID("central_park")
-
DeleteZone (identifier)
-
DeleteZone function.
This function deletes a zone or circle with the given identifier.
If the zone or circle exists and has members, it will make each member leave the zone or circle.
It then removes the zone or circle from the zones and circles tables.
If the zone or circle does not exist, it prints a message to the console.
This will delete the zone or circle with the identifier "central_park" if it exists.
Parameters:
- identifier
A unique identifier for the zone or circle
Usage:
exports.sd_util:DeleteZone("central_park")
-
IsCoordsInAnyZones (coords)
-
GetZones function.
This function checks if the given coordinates are inside any of the defined zones or circles.
It iterates over all zones and checks if the coordinates are inside the zone using the GetInside function.
It also iterates over all circles and checks if the coordinates are within the circle's distance from its center.
If the coordinates are inside a zone or a circle, it adds the zone or circle's id to the currentZones table.
It returns the currentZones table which contains the ids of all zones and circles the coordinates are inside of.
Parameters:
- coords
A table containing x, y, and z coordinates
Returns:
table containing the ids of all zones and circles the coordinates are inside of.
Usage:
local zones = exports.sd_util:IsCoordsInAnyZones({x = 100, y = 200, z = 300})
-
IsPlayerInZone (player, zone)
-
IsPlayerInZone function.
This function checks if the given player is inside the given zone or circle.
Parameters:
- player
The player's server id
- zone
The zone or circle's id
Returns:
boolean
Usage:
local isPlayerInZone = exports.sd_util:IsPlayerInZone(1, "central_park")
-
GetPlayersInZone (zone)
-
GetPlayersInZone function.
This function returns a table containing the server ids of all players inside the given zone or circle.
Parameters:
- zone
The zone or circle's id
Returns:
table
Usage:
local players = exports.sd_util:GetPlayersInZone("central_park")
-
GetAmountOfPlayersInZone (zone)
-
GetAmountOfPlayersInZone function.
This function returns the amount of players inside the given zone or circle.
Parameters:
- zone
The zone or circle's id
Returns:
number
Usage:
local amount = exports.sd_util:GetAmountOfPlayersInZone("central_park")
-
IsAnyPlayerInZone (zone)
-
IsAnyPlayerInZone function.
This function checks if there are any players inside the given zone or circle.
Parameters:
- zone
The zone or circle's id
Returns:
boolean
Usage:
local isAnyPlayerInZone = exports.sd_util:IsAnyPlayerInZone("central_park")
-
GetPlayerZones (player)
-
GetPlayerZones function.
This function returns a table containing the ids of all zones and circles the given player is inside.
Parameters:
- player
The player's server id
Returns:
table
Usage:
local zones = exports.sd_util:GetPlayerZones(1)
-
TriggerEventInZone (zone, event, ...)
-
TriggerEventInZone function.
This function triggers an event in the given zone or circle.
Parameters:
- zone
The zone or circle's id
- event
The event to be triggered
- ...
The arguments to be passed to the event
Usage:
exports.sd_util:TriggerEventInZone("central_park", "event_name", ...)
-
AddPropToZone (zone, id, propData)
-
AddPropToZone function.
This function adds a prop to the given zone or circle.
Parameters:
- zone
The zone or circle's id
- id
A unique identifier for the prop
- propData
A table containing the prop's data
{
model: string,
x: number,
y: number,
z: number,
h: number,
offsets: vector3
interaction: {
["interaction_id"] = {
name: string,
icon: string,
id: string,
condition: function
}
}
See also:
Usage:
exports.sd_util:AddPropToZone("central_park", "prop-1", {model = "prop_bench_01a", x = 100, y = 200, z = 300, h = 0, offsets = vector3(0.0, 0.0, 0.0)})
-
RemovePropFromZone (zone, id)
-
RemovePropFromZone function.
This function removes a prop from the given zone or circle.
Parameters:
- zone
The zone or circle's id
- id
The prop's unique identifier
Usage:
exports.sd_util:RemovePropFromZone("central_park", "prop-1")
-
UpdatePropModelInZone (zone, id, model)
-
UpdatePropModelInZone function.
This function updates the model of a prop in the given zone or circle.
Parameters:
- zone
The zone or circle's id
- id
The prop's unique identifier
- model
The prop's new model
Usage:
exports.sd_util:UpdatePropModelInZone("central_park", "prop-1", "prop_bench_01b")
-
UpdatePropCoordsInZone (zone, id, coords, offsets)
-
UpdatePropCoordsInZone function.
This function updates the coordinates of a prop in the given zone or circle.
Parameters:
- zone
The zone or circle's id
- id
The prop's unique identifier
- coords
A table containing the prop's new coordinates
- offsets
A vector3 containing the prop's new offsets
Usage:
exports.sd_util:UpdatePropCoordsInZone("central_park", "prop-1", {x = 100, y = 200, z = 300})
-
GetPropsFromZone (zone)
-
GetPropsFromZone function.
This function returns a table containing all the props in the given zone or circle.
Parameters:
- zone
The zone or circle's id
Returns:
table
See also:
Usage:
local props = exports.sd_util:GetPropsFromZone("central_park")
-
AddVehicleToZone (zone, id, vehData)
-
AddVehicleToZone function.
This function adds a vehicle to the given zone or circle.
Parameters:
- zone
The zone or circle's id
- id
A unique identifier for the vehicle
- vehData
A table containing the vehicle's data
See also:
Usage:
exports.sd_util:AddVehicleToZone("central_park", "vehicle-1", {model = "adder", x = 100, y = 200, z = 300, h = 0, props = {}})
-
RemoveVehicleFromZone (zone, id)
-
RemoveVehicleFromZone function.
This function removes a vehicle from the given zone or circle.
Parameters:
- zone
The zone or circle's id
- id
The vehicle's unique identifier
Usage:
exports.sd_util:RemoveVehicleFromZone("central_park", "vehicle-1")
-
UpdateVehicleInZone (zone, id, VehicleData)
-
UpdateVehicleInZone function.
This function updates the model and props of a vehicle in the given zone or circle.
Parameters:
- zone
The zone or circle's id
- id
The vehicle's unique identifier
- VehicleData
A table containing the vehicle's new props
See also:
Usage:
exports.sd_util:UpdateVehicleInZone("central_park", "vehicle-1", {model = "adder", props = {}})
-
UpdateVehicleTextInZone (zone, id, text)
-
UpdateVehicleTextInZone function.
This function updates the display text of a vehicle in the given zone or circle.
Parameters:
- zone
The zone or circle's id
- id
The vehicle's unique identifier
- text
The vehicle's new display text
Usage:
exports.sd_util:UpdateVehicleTextInZone("central_park", "vehicle-1", "Vehicle Name")
-
UpdateVehicleModelInZone (zone, id, model)
-
UpdateVehicleModelInZone function.
This function updates the model of a vehicle in the given zone or circle.
Parameters:
- zone
The zone or circle's id
- id
The vehicle's unique identifier
- model
The vehicle's new model
Usage:
exports.sd_util:UpdateVehicleModelInZone("central_park", "vehicle-1", "adder")
-
GetVehicleFromZone (zone, id)
-
GetVehicleFromZone function.
This function returns a table containing the vehicle in the given zone or circle.
Parameters:
- zone
The zone or circle's id
- id
The vehicle's unique identifier
Returns:
VehicleData
See also:
Usage:
local vehicle = exports.sd_util:GetVehicleFromZone("central_park", "vehicle-1")
-
GetVehiclesFromZone (zone)
-
GetVehiclesFromZone function.
This function returns a table containing all the vehicles in the given zone or circle.
Parameters:
- zone
The zone or circle's id
Returns:
table
containing all the vehicles in the given zone or circle.
See also:
Usage:
local vehicles = exports.sd_util:GetVehiclesFromZone("central_park")
-
AddPedToZone (zone, id, pedData)
-
AddPedToZone function.
This function adds a ped to the given zone or circle.
Parameters:
- zone
The zone or circle's id
- id
A unique identifier for the ped
- pedData
A table containing the ped's data
See also:
Usage:
exports.sd_util:AddPedToZone("central_park", "ped-1", {model = "a_m_m_beach_01", x = 100, y = 200, z = 300, h = 0})
-
RemovePedFromZone (zone, id)
-
RemovePedFromZone function.
This function removes a ped from the given zone or circle.
Parameters:
- zone
The zone or circle's id
- id
The ped's unique identifier
Usage:
exports.sd_util:RemovePedFromZone("central_park", "ped-1")
-
GetPedsFromZone (zone)
-
GetPedsFromZone function.
This function returns a table containing all the peds in the given zone or circle.
Parameters:
- zone
The zone or circle's id
Returns:
table
See also:
Usage:
local peds = exports.sd_util:GetPedsFromZone("central_park")
-
GetPedFromZone (zone, id)
-
GetPedFromZone function.
This function returns a table containing the ped in the given zone or circle.
Parameters:
- zone
The zone or circle's id
- id
The ped's unique identifier
Returns:
PedData
See also:
Usage:
local ped = exports.sd_util:GetPedFromZone("central_park", "ped-1")
-
TriggerEvent (eventName, ...)
-
TriggerEvent sub-function.
This function triggers an event in the zone or circle.
Parameters:
- eventName
The event to be triggered
- ...
The arguments to be passed to the event
Usage:
exports.sd_util:GetZoneFromID("central_park").TriggerEvent("event_name", ...)
-
CreatePolyZone (identifier, points, minZ, maxZ, enterCallback, leaveCallback, ZoneData)
-
CreatePolyZone function.
This function creates a zone or circle with the given identifier.
Parameters:
- identifier
A unique identifier for the zone or circle
- points
A table containing the zone or circle's points vector2 coordinates
- minZ
The zone or circle's minimum z coordinate
- maxZ
The zone or circle's maximum z coordinate
- enterCallback
The function to be called when a player enters the zone or circle
- leaveCallback
The function to be called when a player leaves the zone or circle
- ZoneData
A table containing the zone or circle's metadata
See also:
Usage:
exports.sd_util:CreatePolyZone("central_park", {{x = 100, y = 200}, {x = 300, y = 400}, {x = 500, y = 600}}, -100, 100, function(src) print(src) end, function(src) print(src) end, {})
-
SetName (name)
-
SetName sub-function.
This function sets the zone or circle's name.
Parameters:
- name
The zone or circle's name
Usage:
exports.sd_util:GetZoneFromID("central_park").SetName("Central Park")
-
GetName ()
-
GetName sub-function.
This function returns the zone or circle's name.
Returns:
string
Usage:
local name = exports.sd_util:GetZoneFromID("central_park").GetName()
-
GetIdentifier ()
-
GetIdentifier sub-function.
This function returns the zone or circle's identifier.
Returns:
string
Usage:
local identifier = exports.sd_util:GetZoneFromID("central_park").GetIdentifier()
-
Enter (src)
-
Enter sub-function.
This function makes the given player enter the zone or circle.
Parameters:
- src
The player's server id
Usage:
exports.sd_util:GetZoneFromID("central_park").Enter(1)
-
Leave (src)
-
Leave sub-function.
This function makes the given player leave the zone or circle.
Parameters:
- src
The player's server id
Usage:
exports.sd_util:GetZoneFromID("central_park").Leave(1)
-
Update (src)
-
Update sub-function.
This function updates the zone or circle.
Parameters:
- src
The player's server id
Usage:
exports.sd_util:GetZoneFromID("central_park").Update()
-
CreateCircleZone (identifier, position, distance, height, enterCallback, leaveCallback, ZoneData)
-
CreateCircleZone function.
This function creates a circle with the given identifier.
Parameters:
- identifier
A unique identifier for the circle
- position
A vector3 containing the circle's position
- distance
The circle's distance
- height
The circle's height
- enterCallback
The function to be called when a player enters the circle
- leaveCallback
The function to be called when a player leaves the circle
- ZoneData
A table containing the circle's metadata
See also:
Usage:
exports.sd_util:CreateCircleZone("central_park", vector3(100, 200, 300), 100.0, 100.0, function(src) print(src) end, function(src) print(src) end, {})
-
SetName (name)
-
SetName sub-function.
This function sets the circle's name.
Parameters:
Usage:
exports.sd_util:GetZoneFromID("central_park").SetName("Central Park")
-
GetName ()
-
GetName sub-function.
This function returns the circle's name.
Returns:
string
Usage:
local name = exports.sd_util:GetZoneFromID("central_park").GetName()
-
Enter (src)
-
Enter sub-function.
This function makes the given player enter the circle.
Parameters:
- src
The player's server id
Usage:
exports.sd_util:GetZoneFromID("central_park").Enter(1)
-
Leave (src)
-
Leave sub-function.
This function makes the given player leave the circle.
Parameters:
- src
The player's server id
Usage:
exports.sd_util:GetZoneFromID("central_park").Leave(1)
-
Update (src)
-
Update sub-function.
This function updates the circle.
Parameters:
- src
The player's server id
Usage:
exports.sd_util:GetZoneFromID("central_park").Update()
-
GetSize ()
-
GetSize sub-function.
This function returns the circle's distance and height.
Returns:
-
float The circle's distance
-
float The circle's height
Usage:
local distance, height = exports.sd_util:GetZoneFromID("central_park").GetSize()
-
TriggerEvent (eventName, ...)
-
TriggerEvent sub-function.
This function triggers an event in the circle.
Parameters:
- eventName
The event to be triggered
- ...
The arguments to be passed to the event
Usage:
exports.sd_util:GetZoneFromID("central_park").TriggerEvent("event_name", ...)