Skip to content

Bikers: Creating a gang

Bob74 edited this page Nov 15, 2021 · 3 revisions

This is all you need to setup your gang. Its name will be shown in the clubhouses as well as its emblem.
You can setup missions pinned on the wall and display your members pictures.

Getting the main object to interact with the gang:

BikerGang = exports['bob74_ipl']:GetBikerGangObject()

Object structure

BikerGang
  +-- Name
  |   +-- Colors
  |      +-- black
  |      +-- gray
  |      +-- white
  |      +-- orange
  |      +-- red
  |      +-- green
  |      +-- yellow
  |      +-- blue
  |   +-- Fonts
  |      +-- font1
  |      +-- font2
  |      +-- ...
  |      +-- font13
  |   +-- name
  |   +-- color
  |   +-- font
  |   +-- Set(name, color, font)
  +-- Emblem
  |   +-- Logo
  |      +-- eagle
  |      +-- skull
  |      +-- ace
  |      +-- brassKnuckles
  |      +-- UR
  |      +-- fox
  |      +-- city
  |      +-- dices
  |      +-- target
  |   +-- emblem
  |   +-- rot
  |   +-- Set(logo, rotation)


Set the gang's name

Setting the name parameters.

BikerGang.Name.Set(name, color, font)
Parameter Description Valid values
name Name of the gang any string (use \n to add a new line)
color Black BikerGang.Name.Colors.black
Gray BikerGang.Name.Colors.gray
White BikerGang.Name.Colors.white
Orange BikerGang.Name.Colors.orange
Red BikerGang.Name.Colors.red
Green BikerGang.Name.Colors.green
Yellow BikerGang.Name.Colors.yellow
Blue BikerGang.Name.Colors.blue
font Font uses to display the name from BikerGang.Name.Fonts.font1 to BikerGang.Name.Fonts.font13

Your name is set up, now you need to display it.

BikerGang.Clubhouse.ClubName.Enable(state)
Parameter Description Valid values
state Display the name or not true or false

Set the emblem

Setting the emblem parameters.

BikerGang.Emblem.Set(logo, rotation)
Parameter Description Valid values
logo Eagle BikerGang.Emblem.Logo.eagle
Skull BikerGang.Emblem.Logo.skull
Ace BikerGang.Emblem.Logo.ace
BrassKnuckles BikerGang.Emblem.Logo.brassKnuckles
UR BikerGang.Emblem.Logo.UR
Fox BikerGang.Emblem.Logo.fox
City BikerGang.Emblem.Logo.city
Dices BikerGang.Emblem.Logo.dices
Target BikerGang.Emblem.Logo.target
rotation Rotate the logo value from 0.0 to 360.0

Note that you can use other textures for the logo. Just send the string you want.

Your emblem is set up, now you need to display it.

BikerGang.Clubhouse.Emblem.Enable(state)
Parameter Description Valid values
state Display the emblem or not true or false

Example: How to use in your own resources

Citizen.CreateThread(function()
    BikerGang = exports['bob74_ipl']:GetBikerGangObject()

    -- Name
    -------
    -- Lets give our gang a cool and fashioned name
    BikerGang.Name.Set("LS Dark turbo riders of Doom", BikerGang.Name.Colors.red, BikerGang.Name.Fonts.font11)
    -- Don't forget to enable it
    BikerGang.Clubhouse.ClubName.Enable(true)
    

    -- Emblem
    ---------
    -- Choosing the logo and rotating it from 90°
    BikerGang.Emblem.Set(BikerGang.Emblem.Logo.ace, 90.0)

    -- and enabling it
    BikerGang.Clubhouse.Emblem.Enable(true)


    -- Missions wall
    ----------------
    -- Enabling the wall, it doesn't show any missions by default
    BikerGang.Clubhouse.MissionsWall.Enable(true)

    -- Setting the first mission (left)
    -- Here I choose to use existing missions ("By the pound")
    BikerGang.Clubhouse.MissionsWall.SetMission(BikerGang.Clubhouse.MissionsWall.Position.left, BikerGang.Clubhouse.MissionsWall.Missions.Titles.byThePound, BikerGang.Clubhouse.MissionsWall.Missions.Descriptions.byThePound, BikerGang.Clubhouse.MissionsWall.Missions.Pictures.byThePound, -423.0253, -1681.888)

    -- Here is a custom mission containing the mugshot of the player
    local pedheadshotTexture = exports['bob74_ipl']:GetPedheadshotTexture(GetPlayerPed(-1))
    if (pedheadshotTexture ~= nil) then
        BikerGang.Clubhouse.MissionsWall.SetMission(BikerGang.Clubhouse.MissionsWall.Position.middle, "Objective:", "Find a new president.", pedheadshotTexture, 3000.0, 3000.0)
    end

    -- And there is no third mission
    BikerGang.Clubhouse.MissionsWall.SelectMission(BikerGang.Clubhouse.MissionsWall.Position.none)
    
    --[[
        Note:

        Be careful when you use Ped headshots (mugshots):
        You must call SetStreamedTextureDictAsNoLongerNeeded(mugshotTexture) before reloading your resource.
        Otherwise, the texture will be lost but it will stay in memory and will take one mughost texture slot for nothing.

        if (mugshotTexture ~= "") then
            SetStreamedTextureDictAsNoLongerNeeded(mugshotTexture)
        end
    ]]


    -- Members pictures
    -------------------
    -- We need a curently loaded Ped to get its mugshot.
    -- That's why we are going to spawn Peds under the ground and remove them later.
    
    -- Coordinates to spawn the Ped
    x, y, z = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))

    -- Requesting the Ped model
    RequestModel("cs_bradcadaver")
    while not HasModelLoaded("cs_bradcadaver") do Wait(1) end

    -- Spawning the Ped underground and freezing it
    local presidentPed = CreatePed(4, "cs_bradcadaver", x, y, z - 500.0, 0.0, false, true)
    FreezeEntityPosition(presidentPed, true)

    -- Setting the picture by sending the Ped to the function
    BikerGang.Clubhouse.Members.President.Set(presidentPed)
    -- We enable the picture to see it
    BikerGang.Clubhouse.Members.President.Enable(true)

    -- We don't need the Ped anymore, clean up.
    SetPedAsNoLongerNeeded(presidentPed)
    DeletePed(presidentPed)
    

    RequestModel("mp_m_exarmy_01")
    while not HasModelLoaded("mp_m_exarmy_01") do Wait(1) end
    local vicePresidentPed = CreatePed(4, "mp_m_exarmy_01", x, y, z - 505.0, 0.0, false, true)
    FreezeEntityPosition(vicePresidentPed, true)
    BikerGang.Clubhouse.Members.VicePresident.Set(vicePresidentPed)
    BikerGang.Clubhouse.Members.VicePresident.Enable(true)
    SetPedAsNoLongerNeeded(vicePresidentPed)
    DeletePed(vicePresidentPed)

    RequestModel("hc_gunman")
    while not HasModelLoaded("hc_gunman") do Wait(1) end
    local roadCaptainPed = CreatePed(4, "hc_gunman", x, y, z - 510.0, 0.0, false, true)
    FreezeEntityPosition(roadCaptainPed, true)
    BikerGang.Clubhouse.Members.RoadCaptain.Set(roadCaptainPed)
    BikerGang.Clubhouse.Members.RoadCaptain.Enable(true)
    SetPedAsNoLongerNeeded(roadCaptainPed)
    DeletePed(roadCaptainPed)

    RequestModel("hc_driver")
    while not HasModelLoaded("hc_driver") do Wait(1) end
    local enforcerPed = CreatePed(4, "hc_driver", x, y, z - 515.0, 0.0, false, true)
    FreezeEntityPosition(enforcerPed, true)
    BikerGang.Clubhouse.Members.Enforcer.Set(enforcerPed)
    BikerGang.Clubhouse.Members.Enforcer.Enable(true)
    SetPedAsNoLongerNeeded(enforcerPed)
    DeletePed(enforcerPed)

    RequestModel("mp_m_niko_01")
    while not HasModelLoaded("mp_m_niko_01") do Wait(1) end
    local sergeantAtArmsPed = CreatePed(4, "mp_m_niko_01", x, y, z - 520.0, 0.0, false, true)
    FreezeEntityPosition(sergeantAtArmsPed, true)
    BikerGang.Clubhouse.Members.SergeantAtArms.Set(sergeantAtArmsPed)
    BikerGang.Clubhouse.Members.SergeantAtArms.Enable(true)
    SetPedAsNoLongerNeeded(sergeantAtArmsPed)
    DeletePed(sergeantAtArmsPed)
end)
Clone this wiki locally