Electus LogoElectus Documentation

Code Examples

Examples of how to use different exports.

Add Capture Progress to a Zone

local zoneId = exports["electus_gangs"]:GetSourceZoneId(src)
local gangId = exports["electus_gangs"]:GetSourceGangId(src)
local progressToAdd = 5
local xpToAdd = 2
local repToAdd = 1

-- this can also be switch with exports["electus_gangs"]:RemoveProgressFromCapture(zoneId, gangId, amount)
exports["electus_gangs"]:AddProgressToCapture("drugCapture", zoneId, gangId, progressToAdd)

exports["electus_gangs"]:GainXP(gangId, xpToAdd)
exports["electus_gangs"]:ChangeGangRep(gangId, repToAdd)

Get All Data of a Gang

local gangId = exports["electus_gangs"]:GetSourceGangId(src)
local gangData = exports["electus_gangs"]:GetGang(gangId)

Get All Data of a Zone

local zoneId = exports["electus_gangs"]:GetSourceZoneId(src)
local zoneData = exports["electus_gangs"]:GetZoneById(zoneId)

Create New Task for a Gang

local gangId = exports["electus_gangs"]:GetSourceGangId(src)
local xpReward = 2
local minLevel = 1
local goalProgress = 5
local shouldRemove = true

exports["electus_gangs"]:CreateTask(gangId, "your_task_name", "your_task_label", "your_task_description", xpReward, minLevel, goalProgress, shouldRemove)

Add Progress to a custom task

local gangId = exports["electus_gangs"]:GetSourceGangId(src)
local progressToAdd = 5

exports["electus_gangs"]:AddProgressToTask(gangId, "your_task_name", progressToAdd)