CreatorsServer exports
SetGang
Last updated on
Sets a character's primary gang and grade.
local res = exports.opx_infinity:SetGang(target, name, grade)Scope write · must be awaited — a synchronous call answers export.mustAwait before touching anything.
Parameters
-
target:
number | string— player id or citizen id -
name:
string -
grade?:
integer -
targetis a connected player id or a citizen id (a character nobody is playing). -
gradeis 0–255, default 0. -
Joins the gang (or regrades) and makes it primary.
-
Goes through the same function as the staff commands: the
gang:beforeSethook can veto it; a change raisesopx:on:character:gang. -
nameis 1–48 characters: letters, digits,_,-,..
Returns
- the new primary gang table
Errors
gang.notFound,gang.gradeNotFound,gang.vetoed,character.notFound,export.badArgument,error.unavailable
CreateThread(function()
local pending, why = Open77.exports.call('opx_infinity', 'SetGang', playerId, 'valentinos')
if not pending then return print('not sent: ' .. tostring(why)) end
local res = pending:await()
if not (res and res.ok) then return print('refused: ' .. tostring(res and res.error)) end
print('joined ' .. res.value.label)
end)