Zyke Resources' Products
DiscordStore
  • Introduction
  • Common Issues
    • zyke_lib error
    • Lacking Entitlement
    • UI Not Working
    • Missing Files Via FTP
    • Resource Starting Sequence
    • Item Not Usable
    • Any other issues?
  • FAQ
  • Paid Resources
    • Consumables
      • Resource Description
      • Config
      • Exports & Events
      • Dependencies
      • Changelog
      • Guides
      • Setup
    • Smoking
      • Resource Description
      • Config
      • Exports & Events
      • Examples
      • Dependencies
      • Changelog
      • Test Server
      • Setup
    • Garages
      • Resource Description
      • Config
      • Exports & Events
      • Dependencies
      • Changelog
      • Setup
      • Common Issues
    • Drugdealer
      • Resource Description
      • Config
      • Exports & Events
      • Dependencies
      • Changelog
    • Crafting
      • Resource Description
      • Config
      • Exports & Events
      • Dependencies
      • Changelog
    • Plants
      • Resource Description
      • Config
      • Exports & Events
      • Dependencies
      • Changelog
    • Mugging
      • Resource Description
      • Config
      • Exports & Events
      • Changelog
    • Gangsystem
      • Resource Description
      • Config
      • Exports & Events
      • Examples
      • Dependencies
      • Changelog
  • Free Resources
    • Zyke Lib
      • Resource Description
      • Dependencies
      • Config
      • Setup
    • Status
      • Resource Description
      • Dependencies
      • Changelog
      • Setup
    • Propaligner
      • Resource Description
      • Exports & Events
      • Dependencies
      • Changelog
    • Vending Machines
      • Resource Description
      • Dependencies
      • Changelog
    • Sounds
      • Resource Description
      • Exports & Events
    • Key Minigame
      • Resource Description
      • Exports & Events
      • Changelog
    • Stabwheels
      • Resource Description
      • Dependencies
      • Changelog
    • Burncars
      • Resource Description
      • Dependencies
      • Changelog
    • Catalytic
      • Resource Description
      • Exports & Events
      • Config
      • Dependencies
      • Changelog
Powered by GitBook
On this page
  • Manage Gang Money From Player
  • Trigger Events
  • Get Turf
  • Get All Members
  • Get Members Online

Was this helpful?

  1. Paid Resources
  2. Gangsystem

Examples

A list of examples of how to use our exports & events.

Available Functions

All gang functions can be found open inside of server/unlocked/initialize_gang.lua. All parameters with documentation strings are unlocked and available to study. The examples below are just basic examples of frequent functions to get you going.

Manage Gang Money From Player

A common way to interact with players and gangs would be to manage a gang's money, which you would find from a player. Below you can see a very basic example of grabbing a player's gang and managing it's money. Example:

local playerId = <FETCHED PLAYER ID>
local gang = exports["zyke_gangphone"]:GetPlayerGang(playerId)
if (gang) then
    gang.functions.AddMoney(1000, nil, "server", "Robbery")
end

Trigger Events

You can easily trigger events for all members and pass in any arguments. Example:

local playerId = <FETCHED PLAYER ID>
local gang = exports["zyke_gangphone"]:GetPlayerGang(playerId)
if (gang) then
    gang.functions.TriggerClientEvent("some:event", "some argument", 500, true)
end

Get Turf

You can also grab any gang data directly without functions, such as their turf PolyZone vectors. Example:

local playerId = <FETCHED PLAYER ID>
local gang = exports["zyke_gangphone"]:GetPlayerGang(playerId)
if (gang) then
    local turf = gang.turf
end

Get All Members

Another example of grabbing the data directly, you can grab all members as is, with all their gang-related data, and then format them for a nice list. Example:

local playerId = <FETCHED PLAYER ID>
local gang = exports["zyke_gangphone"]:GetPlayerGang(playerId)
if (gang) then
    local members = gang.members
    local ranks = gang.ranks
    
    -- Perform some actions
    -- Perhaps displaying each member with their rank label
end

Get Members Online

If you want to fetch all the members that are currently online, you can do so. Example:

local playerId = <FETCHED PLAYER ID>
local gang = exports["zyke_gangphone"]:GetPlayerGang(playerId)
if (gang) then
    local members = gang.functions.GetOnlineMembers()
end
PreviousExports & EventsNextDependencies

Last updated 8 months ago

Was this helpful?