Teams

Role selection and organization system.

Functions

impulse.Teams.Define(teamData)

View source »

Creates a new team, should run on both client and server.

Parameters

  • teamData

    teamsData, see teamData structure.

Returns

  • teamID

    Teams identifier, save this as a global variable.

impulse.Teams.DefineGroup(name)

View source »

Defines a group, this generates a Player method, see usage.

Parameters

  • name string

    The name of the group, this is used in codegen.

Returns

  • int

    The group ID, for alternative use with Player:InGroup(int)

Example Usage

impulse.Teams.DefineGroup("Police"); Player(10):IsPolice() -- This function was generated!

impulse.Teams.GetAllWhitelists(team, callback)

View source »

Get all player a whitelist has.

Parameters

  • team string

    The whitelists name

  • callback function

    Executed when DB has a result.

impulse.Teams.GetAllWhitelistsPlayer(steamid, callback)

View source »

Get all whitelists a player has.

Parameters

  • steamid string

    The SteamID32 of the player

  • callback function

    Executed when DB has a result.

impulse.Teams.GetWhitelist(steamid, team, callback)

View source »

Get whitelist of a player. Use GetTeamWhitelist

Parameters

  • steamid string

    The SteamID32 of the player

  • callback function

    Executed when DB has a result.

impulse.Teams.SetWhitelist(steamid, team, level)

View source »

Sets the whitelist of a user, or creates on if none exist.

Parameters

  • steamid string

    The SteamID32 of the player

  • level int

    The whitelist level to set the player to

Player:CanBecomeTeam(teamID, notify)

View source »

Returns if a player can become a part of a team, internally also runs hook CanPlayerChangeTeam.

Parameters

  • teamID int

    ID of team wanting to join.

  • notify boolean

    Should automatically notify the player.

Returns

  • bool

    Can player become team.

Player:CanBecomeTeamClass(classID, notify)

View source »

Returns if a player can join a team's class.

Parameters

  • classID int

    ID of class wanting to join.

  • notify boolean

    Should automatically notify the player.

Returns

  • bool

    Can player become class.

Player:CanBecomeTeamRank(rankID, notify)

View source »

Returns if a player can join a team's rank.

Parameters

  • rankID int

    ID of rank wanting to join.

  • notify boolean

    Should automatically notify the player.

Returns

  • bool

    Can player become rank.

Player:GetTeamClass()

View source »

Returns the players class ID.

Returns

  • int

    classID of the player.

Player:GetTeamClassData()

View source »

Retrieves the players class data table.

Returns

Player:GetTeamClassName()

View source »

Returns the players rank name.

Returns

  • string

    class name of the player.

Player:GetTeamRank()

View source »

Returns the players rank ID.

Returns

  • int

    rankID of the player.

Player:GetTeamRankData()

View source »

Retrieves the players rank data table.

Returns

Player:GetTeamRankName()

View source »

Returns the players rank name.

Returns

  • string

    rank name of the player.

Player:GetTeamWhitelist(team)

View source »

Returns if the player has a whitelist for the specified team and level

Parameters

  • team string optional

    The whitelist identifier (doesn't really need to be a team.) Defaults to player's active team whitelist.

Returns

  • int

    Whitelist level

Player:HasTeamWhitelist(team, level)

View source »

Returns if the player has a whitelist for the specified team and level

Parameters

  • team string

    The whitelist identifier (doesn't really need to be a team.)

  • level int

    The level to check for

Returns

  • bool

    Has whitelist

Player:InGroup(group)

View source »

Alternative to using codegen, works identical but you have to supply the group id.

Parameters

  • group int

    Group ID.

Returns

  • boolean

    In group or not.

Player:IsCP()

Deprecated

This is a deprecated function! You are able to use it, but you risk breaking code when the function is eventually removed..

View source »

Returns if they have the CP flag on their team. Removed as of 25 October 2022. Use groups!

Returns

  • bool

    Whether they have the .cp team flag or not.

Player:SetTeam(teamID)

View source »

Sets the player to a team.

Parameters

  • teamID int

    The ID of the team to switch to.

Player:SetTeamClass(classID, skipLoadout)

View source »

Changes the player's class.

Parameters

  • classID int

    the ID of the team's class.

  • skipLoadout boolean optional

    Should it skip giving the player items / weapons?

Player:SetTeamRank(rankID)

View source »

Changes the player's rank.

Parameters

  • rankID int

    the ID of the team's rank.

Player:SetupWhitelists()

Internal

This is an internal function! You are able to use it, but you risk unintended side effects if used incorrectly.

View source »

Initializes the whitelists for a user