Cube Scripts

Robberies & activities

Reward gangs from your robbery, graffiti or any activity script.

Cube Gang cannot guess when a player robs a store - your robbery script has to tell it. A single server-side line is enough.

Robberies#

1

Enable the robbery types#

config.luaLua
Config.Influence = {
    robberies = {
        enabled = true,
        zoneOnly = false,
        types = {
            store = { influence = 3.0, points = 5 },
            house = { influence = 2.0, points = 3 },
            atm = { influence = 1.0, points = 1 },
            vehicle = { influence = 1.0, points = 1 },
            bank = { influence = 8.0, points = 15 },
            jewelry = { influence = 6.0, points = 10 },
        },
    },
}
  • influence is added in the territory where the robbery happens.
  • points are added to the gang score. With zoneOnly = true, only robberies

    inside a territory give points.

You can add any type you need, the name is free.

2

Call the export when the robbery succeeds#

Lua
exports.cube_gang:AddRobbery(source, 'store')

Call it on the server, once the loot is given. The player's gang and current territory are resolved automatically. Players without a gang are ignored.

Danger

Never expose this export behind a net event that a client can trigger freely. Call it from the server code that already validated the robbery.

server.luaLua
RegisterNetEvent('mystorerobbery:finished', function(storeId)
    local source = source

    if not IsRobberyValid(source, storeId) then return end

    GiveLoot(source, storeId)
    exports.cube_gang:AddRobbery(source, 'store')
end)

Any other activity#

For anything that is not a robbery, use the generic exports:

ExportUse it for
AddPlayerInfluence(source, amount, reason)Activities done inside a territory: graffiti, gang fights, drug labs...
AddPlayerPoints(source, amount, reason)Score rewards that do not depend on a territory: events, races...
AddZoneInfluence(zone, gangId, amount, reason)Admin tools, scheduled events, zones chosen by name
server.luaLua
RegisterNetEvent('mygraffiti:server:painted', function(coords)
    local source = source

    if #(GetEntityCoords(GetPlayerPed(source)) - coords) > 5.0 then return end

    exports.cube_gang:AddPlayerInfluence(source, 2.0, 'graffiti')
end)
Tip

The reason you pass is sent with the cube_gang:influence:added event, so your own logs can tell where every influence point came from.