Custom functions
Hook your own notifications, garage and HUD into client/custom.lua.
client/custom.lua is not escrowed and is loaded before the gang modules. It is the place for small changes that would otherwise require editing the resource.
Notifications#
Used when Config.Notification = 'custom'.
client/custom.luaLua
function Custom.Notify(message, notifyType, duration)
exports['my-notify']:Alert(message, notifyType, duration)
end- message:
string - notifyType:
'info','success','error'or'warning' - duration:
number- milliseconds
Garage#
The garage point checks the garage.use permission and the distance, then calls Custom.OpenGarage. Connect it to your garage script:
client/custom.luaLua
function Custom.OpenGarage(gang, coords)
exports['my-garage']:OpenSocietyGarage({
society = ('gang_%s'):format(gang.name),
label = gang.label,
spawn = vector4(coords.x, coords.y, coords.z, coords.w or 0.0),
})
end- gang:
table- same structure as GetGang - coords:
table-{ x, y, z, w }, the point placed in the creator,wbeingthe heading
Note
The default function triggers the cube_gang:client:openGarage client event, so you can also listen to it from another resource without touching this file.
Zone changes#
Called every time the player enters or leaves a territory.
client/custom.luaLua
function Custom.OnZoneChanged(zone)
if zone then
exports['my-hud']:SetZone(zone.label, zone.ownerLabel or 'Neutral')
else
exports['my-hud']:SetZone(nil)
end
end- zone:
tableornil- same structure as GetCurrentZone