πŸ”₯All scripts on our website are 50% off!πŸ”₯
Logo

Triggers & Exports

Client Triggers

Give Gang Points

Award points to a gang member for completing an action.

TriggerClientEvent("bit-gangs:givePoints", playerID, action, points)

Parameters:

  • playerID: Server ID of the player
  • action: Name of the action performed
  • points: Amount of points to award

Example:

TriggerClientEvent("bit-gangs:givePoints", source, "custom_action", 100)

Start Murder Contract

Initiate a contract killing mission for a gang member.

TriggerClientEvent("bit-gangs:startMurderContract", playerID)

Parameters:

  • playerID: Server ID of the player

Example:

RegisterCommand('startcontract', function(source)
    TriggerClientEvent("bit-gangs:startMurderContract", source)
end)

Start Smuggling

Initiate a smuggling mission for a gang member.

TriggerClientEvent("bit-gangs:startSmuggling", playerID)

Parameters:

  • playerID: Server ID of the player

Example:

RegisterCommand('startsmuggle', function(source)
    TriggerClientEvent("bit-gangs:startSmuggling", source)
end)

Start Illegal Persons

Initiate an illegal person transportation mission.

TriggerClientEvent("bit-gangs:startIllegalPersons", playerID)

Parameters:

  • playerID: Server ID of the player

Example:

RegisterCommand('startpeople', function(source)
    TriggerClientEvent("bit-gangs:startIllegalPersons", source)
end)

Server Triggers

Open Options Menu

Open the gang options menu for a player.

TriggerServerEvent("bit-gangs:openOptionsMenu", playerID)

Parameters:

  • playerID: Server ID of the player

Exports

Check Player Gang

Check if a player belongs to a gang and get the gang name.

local hasGang, gangName = exports['bit-gangs']:hasGang(playerID)

Parameters:

  • playerID: Server ID of the player

Returns:

  • hasGang (boolean): True if player is in a gang, false otherwise
  • gangName (string): Name of the gang (nil if not in a gang)

Example:

local playerGang, gangName = exports['bit-gangs']:hasGang(source)

if playerGang then
    print("Player is in gang: " .. gangName)
else
    print("Player is not in a gang")
end

Integration Examples

Custom Action with Points

Create a custom gang action that awards points:

RegisterCommand('customaction', function(source)
    local playerGang, gangName = exports['bit-gangs']:hasGang(source)
    
    if playerGang then
        -- Perform custom action
        -- ...
        
        -- Award points
        TriggerClientEvent("bit-gangs:givePoints", source, "Custom Action", 50)
        
        TriggerClientEvent('chat:addMessage', source, {
            args = {"GANG", "You earned 50 points for " .. gangName}
        })
    else
        TriggerClientEvent('chat:addMessage', source, {
            args = {"GANG", "You must be in a gang to do this"}
        })
    end
end)

Restrict Feature to Gang Members

Allow only gang members to access a feature:

RegisterCommand('gangonly', function(source)
    local playerGang, gangName = exports['bit-gangs']:hasGang(source)
    
    if playerGang then
        -- Allow access
        TriggerClientEvent('myresource:openMenu', source)
    else
        -- Deny access
        TriggerClientEvent('chat:addMessage', source, {
            args = {"ERROR", "This feature is for gang members only"}
        })
    end
end)

Gang-Based Economy

Give discounts or bonuses based on gang membership:

RegisterServerEvent('shop:purchase')
AddEventHandler('shop:purchase', function(item, price)
    local playerGang, gangName = exports['bit-gangs']:hasGang(source)
    local finalPrice = price
    
    if playerGang then
        -- 10% discount for gang members
        finalPrice = price * 0.9
    end
    
    -- Process purchase with finalPrice
end)

Scheduled Gang Missions

Automatically trigger missions for all gang members:

-- Run every hour
Citizen.CreateThread(function()
    while true do
        Citizen.Wait(3600000) -- 1 hour
        
        local players = GetPlayers()
        for _, player in ipairs(players) do
            local playerGang, gangName = exports['bit-gangs']:hasGang(player)
            
            if playerGang then
                -- Give mission to gang members
                TriggerClientEvent("bit-gangs:startSmuggling", player)
            end
        end
    end
end)

Gang Territory Notifications

Notify when entering another gang's territory:

-- Client-side
RegisterNetEvent('gangs:enterTerritory')
AddEventHandler('gangs:enterTerritory', function(territoryGang)
    local playerGang, gangName = exports['bit-gangs']:hasGang(GetPlayerServerId(PlayerId()))
    
    if playerGang and gangName ~= territoryGang then
        -- Warn player
        TriggerEvent('chat:addMessage', {
            args = {"WARNING", "You are entering " .. territoryGang .. " territory!"}
        })
    end
end)

Commands

Player Commands

-- Open gang menu
/gang

-- Create graffiti
/spray <text>

-- Start contract killing (if enabled)
/gangkill

-- Start smuggling (if enabled)
/gangsmuggling

-- Start illegal people transport (if enabled)
/gangpeople

Admin Commands

-- Open admin panel
/admingangs

[!NOTE] Commands can be customized in the configuration file.