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#
Enable the robbery types#
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 },
},
},
}influenceis added in the territory where the robbery happens.pointsare added to the gang score. WithzoneOnly = true, only robberiesinside a territory give points.
You can add any type you need, the name is free.
Call the export when the robbery succeeds#
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.
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.
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)Reward every gang member who took part.
local function OnHeistSuccess(participants)
for _, playerId in ipairs(participants) do
exports.cube_gang:AddRobbery(playerId, 'bank')
end
endAddEventHandler('myhouserobbery:server:looted', function(source)
exports.cube_gang:AddRobbery(source, 'house')
end)Any other activity#
For anything that is not a robbery, use the generic exports:
| Export | Use 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 |
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)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.