PlayerService
Noir.Services.PlayerService: NoirService
A service that wraps SW players in a class. Essentially makes players OOP.
Load players current in-game.
Gives data to a player.
Used internally.
Parameters
steam_id
: integer|stringname
: stringpeer_id
: integeradmin
: booleanauth
: boolean
Returns
NoirPlayer|nil
Removes data for a player.
Used internally.
Parameters
player
: NoirPlayer
Returns
boolean
: success - Whether or not the operation was successful
Returns whether or not a player is the server's host. Only applies in dedicated servers.
Used internally.
Parameters
peer_id
: integer
Returns
boolean
Mark a player as recognized to prevent onJoin being called for them after an addon reload.
Used internally.
Parameters
player
: NoirPlayer
Returns whether or not a player is recognized.
Used internally.
Parameters
player
: NoirPlayer
Returns
boolean
Clear the list of recognized players.
Used internally.
Mark a player as not recognized.
Used internally.
Parameters
player
: NoirPlayer
Returns all saved player properties saved in g_savedata.
Used internally. Do not use in your code.
Returns
NoirSavedPlayerProperties
Save a player's property to g_savedata.
Used internally. Do not use in your code.
Parameters
player
: NoirPlayerproperty
: string
Get a player's saved properties.
Used internally. Do not use in your code.
Parameters
player
: NoirPlayer
Returns
table<string, boolean>|nil
Removes a player's saved properties from g_savedata.
Used internally. Do not use in your code.
Parameters
player
: NoirPlayer
Returns all players.
This is the preferred way to get all players instead of using Noir.Services.PlayerService.Players
.
Parameters
usePeerIDsAsIndex
: boolean|nil - If true, the indices of the returned table will match the peer ID of the value (player) matched to the index. Having this as true is slightly faster
Returns
table<integer, NoirPlayer>
Returns a player by their peer ID.
This is the preferred way to get a player.
Parameters
ID
: integer
Returns
NoirPlayer|nil
Returns a player by their Steam ID.
Note that two players or more can have the same Steam ID if they spoof their Steam ID or join the server on two Stormworks instances.
Parameters
steam
: string
Returns
NoirPlayer|nil
Returns a player by their exact name.
Consider using :SearchPlayerByName()
if the player name only needs to match partially.
Parameters
name
: string
Returns
NoirPlayer|nil
Get a player by their character.
Parameters
character
: NoirObject
Returns
NoirPlayer|nil
Searches for a player by their name, similar to a Google search but way simpler under the hood.
Parameters
name
: string
Returns
NoirPlayer|nil
Returns whether or not two players are the same.
Parameters
playerA
: NoirPlayerplayerB
: NoirPlayer
Returns
boolean
Last updated