Shared Exports
GetTurfName
Description
This function retrieves the name or label of a turf (gang zone) based on its identifier.
Usage
exports['ant-gangsystem']:GetTurfName(turf_tag)
Parameters
- turf_tag: A string that represents the identifier of the gang zone (turf).
Returns
- label: The display name (label) of the turf if the identifier matches a predefined gang zone.
- nil: If the identifier does not match any predefined turf zone.
Example
local turf_name = exports['ant-gangsystem']:GetTurfName('ROCKF')
if turf_name then
print("The name of the turf is: " .. turf_name)
else
print("Turf not found")
end
This function is useful when scripts need to retrieve the name of a gang zone based on its identifier, which can then be used in UI displays, notifications, or other interactions.
IsCommunityTurf
Description
This function checks whether a given turf (gang zone) is classified as a community turf.
Usage
exports['ant-gangsystem']:IsCommunityTurf(turf_tag)
Parameters
- turf_tag: A string that represents the identifier of the gang zone (turf).
Returns
- community: A boolean indicating whether the turf is a community turf (
true
) or not (false
). - nil: If the identifier does not match any predefined turf zone.
Example
local is_community = exports['ant-gangsystem']:IsCommunityTurf('ROCKF')
if is_community then
print("This is a community turf.")
else
print("This is not a community turf.")
end
This function is useful for determining whether a gang zone is a community turf, enabling scripts to apply specific rules or interactions for community turfs.
GetGangZonePlayer
Description
The GetGangZonePlayer
export is designed to determine the gang zone in which a player is
located based on their coordinates. This function iterates through the predefined gang zones and their
respective parts to check if the given coordinates fall within any of these areas. If the coordinates
match a specific gang zone, the function returns the zone identifier, such as ROCKF
or
CHIL
; otherwise, it returns nil
.
Usage
exports['ant-gangsystem']:GetGangZonePlayer(coords)
Parameters
- coords: A table containing the x and y coordinates to check. Example:
{x = 123.45, y = 678.90}
.
Returns
- zone: The identifier of the gang zone if the coordinates match any predefined zone.
- nil: If the coordinates do not fall within any gang zone.
Example
local playerCoords = GetEntityCoords(PlayerPedId())
local gangZone = exports['ant-gangsystem']:GetGangZonePlayer(playerCoords)
if gangZone then
print("Player is in gang zone:", gangZone)
else
print("Player is not in any gang zone.")
end
This function is particularly useful for scripts that need to determine a player's location relative to gang territories, enabling tailored interactions or events based on the player's current gang zone.
GetGangZonePlayerIsIn
Description
This function determines which gang zone (turf) the player is currently in based on their coordinates.
Usage
exports['ant-gangsystem']:GetGangZonePlayerIsIn(source)
Parameters
- source: The player's server ID, typically provided in a server-side script.
Returns
- zone: The identifier of the gang zone the player is currently in, if they are inside a defined gang zone.
- nil: If the player is not located within any defined gang zone.
Example
local player_source = source
local gang_zone = exports['ant-gangsystem']:GetGangZonePlayerIsIn(player_source)
if gang_zone then
print("Player is in gang zone: " .. gang_zone)
else
print("Player is not in any gang zone.")
end
This function is useful for scripts that need to check if a player is within a specific gang zone, enabling features such as turf-based interactions, territory control mechanics, or event triggers.
GetGangZoneCoords
Description
This function retrieves the coordinates of a specified gang zone (turf) based on its identifier.
Usage
exports['ant-gangsystem']:GetGangZoneCoords(zone)
Parameters
- zone: A string that represents the identifier of the gang zone (turf).
Returns
- coords: A table containing the coordinates of the specified gang zone.
- nil: If the zone identifier does not match any predefined gang zone.
Example
local zone_coords = exports['ant-gangsystem']:GetGangZoneCoords('ballas')
if zone_coords then
print("The coordinates of the zone are: " .. zone_coords.x .. ", " .. zone_coords.y .. ", " .. zone_coords.z)
else
print("Zone not found.")
end
This function is useful for retrieving the specific coordinates of a gang zone, which can be utilized for teleportation, area checks, or map-related operations in scripts.
GetPrevalenceLevel
Description
This function retrieves the prevalence level of a gang when passed a number.
Usage
exports['ant-gangsystem']:GetPrevalenceLevel(prevalence)
Parameters
- prevalence: An integer that represents how much prevalence a Gang has.
Returns
- level: An integer (1-5) that represents the level of prevalence based on the number that was passed.
- zero: If the number was invalid, too large, or too small, returns
0
Example
local zone_level = exports['ant-gangsystem']:GetPrevalenceLevel(150)
if zone_level then
print("The prevalence level of the zone is: " .. zone_level)
else
print("Zone not found.")
end
This function is useful for retrieving the prevalence level of a gang.
AllowedByPrevalence
Description
This function checks if a specific action is allowed based on the numerical prevalence level within a gang zone.
Usage
exports['ant-gangsystem']:AllowedByPrevalence(prevalence, action)
Parameters
- prevalence: A number representing the prevalence of a gang, which determines whether certain actions are allowed.
- action: A string representing the action to check against the prevalence level. Supported actions include:
"Gifts"
"Missions"
"Presence"
"Drugs"
"Heist1"
"Heist2"
"Heist3"
Returns
- true: If the action is allowed based on the prevalence level.
- false: If the action is not allowed due to insufficient prevalence level.
Example
local canDoAction = exports['ant-gangsystem']:AllowedByPrevalence(50, 'Missions')
if canDoAction then
print("Action is allowed.")
else
print("Action is not allowed.")
end
This function is useful for controlling access to specific actions based on the numerical prevalence level, ensuring that only actions matching the current influence or prevalence level can be performed.