👩💻 Joueur
Players are Entities that represents the individual behind the mouse and keyboard. Players are spawned automatically when connected to the server.
👪Inheritance
This class shares methods and events from Base Entity.
🧑💻API Source
This page is auto-generated! The Functions, Properties and Events described here are defined in our GitHub's API Repository! Feel free to commit suggestions and changes to the source .json API files!
Authority
🟥 You cannot spawn or Destroy Players.
🎒 Examples
-- Spawns and possess a Character when a Player joins the server
Player.Subscribe("Spawn", function(player)
local new_char = Character(Vector(), Rotator(), "nanos-world::SK_Male")
player:Possess(new_char)
end)
-- Destroys the Character when the Player leaves the server
Player.Subscribe("Destroy", function(player)
local character = player:GetControlledCharacter()
if (character) then
character:Destroy()
end
end)
🗿 Static Functions
Inherited Entity Static Functions
Player inherits from Base Entity Class, sharing it's methods and functions:
Base Entityscripting-reference/classes/base-classes/Entity
Base Entityscripting-reference/classes/base-classes/Entity
Returns | Name | Description | |
---|---|---|---|
table of Base Entity | GetAll | Returns a table containing all Entities of the class this is called on | |
Base Entity | GetByIndex | Returns a specific Entity of this class at an index | |
integer | GetCount | Returns how many Entities of this class exist | |
table of table | GetInheritedClasses | Gets a list of all directly inherited classes from this Class created with the Inheriting System | |
iterator | GetPairs | Returns an iterator with all Entities of this class to be used with pairs() | |
table or nil | GetParentClass | Gets the parent class if this Class was created with the Inheriting System | |
table | Inherit | Inherits this class with the Inheriting System | |
boolean | IsChildOf | Gets if this Class is child of another class if this Class was created with the Inheriting System | |
function | Subscribe | Subscribes to an Event for all entities of this Class | |
function | SubscribeRemote | Subscribes to a custom event called from server | |
Unsubscribe | Unsubscribes all callbacks from this Event in this Class within this Package, or only the callback passed |