đ©âđ» Joueur
info
đ„ Authority: You cannot spawn or Destroy Players.
Les joueurs sont des entités qui représente l'individu derriÚre son clavier et sa souris. Les joueurs apparaissent automatiquement quand ils sont connectés au serveur.
Utilisationâ
-- Fait apparaĂźtre un personnage et donne la possession au joueur quand il rejoint le serveur.
Player.Subscribe("Spawn", function(player)
local new_char = Character()
player:Possess(new_char)
end)
-- Détruit le personnage quand le joueur quitte ke serveur
Player.Subscribe("Destroy", function(player)
local character = player:GetControlledCharacter()
if (character) then
character:Destroy()
end
end)
Functionsâ
Valeur retournée | Nom | Description | |
---|---|---|---|
Ban | Bannit le joueur du serveur | ||
Connect | Redirige le joueur sur un autre serveur | ||
Kick | Expulse le joueur du serveur | ||
Possess | Affecte un joueur Ă un personnage | ||
![]() | SetCameraLocation | Configure la position de la caméra du joueur | |
![]() | SetCameraRotation | Configure la rotation de la caméra du joueur | |
![]() | SetCameraSocketOffset | Sets the Playerâs Camera Socket Offset | |
![]() | SetCameraArmLength | Sets the Playerâs Camera Arm Length | |
![]() | AttachCameraTo | Attaches the Playerâs Camera to an Actor | |
![]() | ResetCamera | Resets the Playerâs Camera to the default state | |
![]() | Spectate | Spectates another Player | |
SetName | Change le nom du joueur | ||
![]() | SetValue | Place une valeur dans l'entitĂ©, qui peut ĂȘtre accĂ©dĂ©e par n'importe quel package | |
SetVOIPChannel | Configure le canal VOIP du joueur | ||
![]() | SetVOIPSetting | Configure les paramĂštres VOIP du joueur | |
![]() | SetVOIPVolume | Change le volume VOIP du joueur | |
UnPossess | Désaffecte le joueur du personnage | ||
![]() | string | GetSteamID | Accéder au Steam ID |
![]() | string | GetAccountID | Accéder à l'ID du compte nanos world |
![]() | string | GetAccountName | Accéder au nom du compte nanos world |
Vector | GetCameraLocation | Gets the Playerâs Camera Location | |
Rotator | GetCameraRotation | Gets the Playerâs Camera Rotation | |
![]() | Character | GetControlledCharacter | Returns the character of the player |
![]() | number | GetID | Gets the network ID of this entity |
string | GetIP | Gets the IP of this Player | |
![]() | string | GetName | Returns the playerâs name |
![]() | number | GetPing | Returns the ping of a player |
![]() | string | GetType | Returns the type of this Actor |
![]() | number | GetVOIPChannel | Returns the VOIP Channel of this Player |
![]() | any | GetValue | Gets a value given a key |
boolean | IsHost | Returns if this Player started the server from New Game | |
boolean | IsLocalPlayer | Returns if this is the LocalPlayer | |
![]() | boolean | IsValid | Returns if this entity is valid (i.e. wasnât destroyed and points to a valid entity) |
![]() | VOIPSetting | GetVOIPSetting | Returns this Player VOIP Setting |
![]() | function | Subscribe | Subscribes for an Event |
![]() | Unsubscribe | Unsubscribes from all subscribed Events in this Entity and in this Package |
Eventsâ
Nom | Description | |
---|---|---|
Destroy | Triggered when Player disconnects from the server | |
Possess | A Player was bound to a Character | |
Spawn | Triggered when Player connects to the server | |
Ready | Triggered when Player is ready (the client fully joined, loaded the map and all entities and is ready to play) | |
UnPossess | A Character was released from the Player | |
VOIP | When a Player starts/ends using VOIP |
Functions Detailedâ

Ban
â
Bannit le joueur du serveur
my_player:Ban(reason)
Type | Parameter | Description |
---|---|---|
string | reason |

Connect
â
Redirige le joueur sur un autre serveur
my_player:Connect(IP, password = "")
Type | Parameter | Default Value | Description |
---|---|---|---|
string | IP | IP du serveur | |
string | password | "" | Mot de passe du serveur |

Kick
â
Expulse le joueur du serveur
my_player:Kick(reason)
Type | Parameter | Description |
---|---|---|
string | reason |

Possess
â
Makes a
Player
to possess and control aCharacter
my_player:Possess(new_character, blend_time, exp)
Type | Parameter | Description |
---|---|---|
Character | new_character | |
number | blend_time | 0 |
number | exp | 0 |

SetCameraLocation
â
Sets the Player's Camera Location (only works if not possessing any Character)
my_player:SetCameraLocation(location)
Type | Parameter | Default | Description |
---|---|---|---|
Vector | location |

SetCameraRotation
â
Sets the Player's Camera Rotation
my_player:SetCameraRotation(rotation)
Type | Parameter | Default | Description |
---|---|---|---|
Rotator | rotation |

TranslateCameraTo
â
Smoothly moves the Player's Camera Location (only works if not possessing any Character)
my_player:TranslateCameraTo(location, time, exp)
Type | Parameter | Default | Description |
---|---|---|---|
Vector | location | ||
number | time | Time to interp from current camera location to target location | |
number | exp | 0 | Exponential used to smooth interp, use 0 for linear movement |

RotateCameraTo
â
Smoothly moves the Player's Camera Rotation
my_player:RotateCameraTo(rotation, time, exp)
Type | Parameter | Default | Description |
---|---|---|---|
Rotator | rotation | ||
number | time | Time to interp from current camera rotation to target rotation | |
number | exp | 0 | Exponential used to smooth interp, use 0 for linear movement |

SetCameraSocketOffset
â
Sets the Playerâs Camera Socket Offset (Spring Arm Offset)
my_player:SetCameraSocketOffset(socket_offset)
Type | Parameter | Default | Description |
---|---|---|---|
Vector | socket_offset |

SetCameraArmLength
â
Sets the Playerâs Camera Arm Length (Spring Arm length)
my_player:SetCameraArmLength(length)
Type | Parameter | Default | Description |
---|---|---|---|
number | length |

AttachCameraTo
â
Attaches the Player`s Camera to an Actor
my_player:AttachCameraTo(actor, socket_offset, blend_speed)
Type | Parameter | Default | Description |
---|---|---|---|
Actor | actor | ||
Vector | socket_offset | ||
number | blend_speed |

ResetCamera
â
Resets the Camera to default state (Unspectate and Detaches)
my_player:ResetCamera()

Spectate
â
Spectates other Player
my_player:Spectate(player, blend_speed)
Type | Parameter | Default | Description |
---|---|---|---|
Player | player | ||
number | blend_speed |

SetName
â
Sets the player's name
my_player:SetName(new_name)
Type | Parameter | Description |
---|---|---|
string | new_name |

SetValue
â
Sets a value in this entity, which can be accessed by any package (optionally sync on clients if called from server)
Please refer to Entity Values for more information
my_player:SetValue(key, value, sync_on_clients)
Type | Parameter | Default Value | Description |
---|---|---|---|
string | key | Key | |
any | value | Valeur | |
boolean | sync_on_clients | false | Server side parameter, if enabled will sync this value through all clients |

SetVOIPChannel
â
Sets the VOIP Channel of this Player (will only communicate with other players in the same channel)
my_player:SetVOIPChannel(channel)
Type | Parameter | Description |
---|---|---|
number | channel |

SetVOIPSetting
â
Configure les paramĂštres VOIP du joueur
my_player:SetVOIPSetting(setting)
Type | Parameter | Description |
---|---|---|
VOIPSetting | setting |

SetVOIPVolume
â
Change le volume VOIP du joueur
my_player:SetVOIPSetting(volume)
Type | Parameter | Description |
---|---|---|
number | volume |

UnPossess
â
Release the
Player
from the :ref:Character
my_player:UnPossess()

GetSteamID
â
Accéder au Steam ID
Returns string
my_player:GetSteamID()

GetAccountID
â
Accéder à l'ID du compte nanos world
Returns string
my_player:GetAccountID()

GetAccountName
â
Accéder au nom du compte nanos world
Returns string
my_player:GetAccountName()

GetCameraLocation
â
Gets the Player's Camera Location
Returns Vector
my_player:GetCameraLocation()

GetCameraRotation
â
Gets the Player's Camera Rotation
Returns Rotator
my_player:GetCameraRotation()

GetControlledCharacter
â
Returns the character of the player. If the player has not yet been assigned a character, nil is returned
Returns Character or nil
my_player:GetControlledCharacter()

GetID
â
Gets the network ID of this entity (same in both client and server)
Returns number
my_player:GetID()

GetIP
â
Gets the IP of this Player
Returns string
my_player:GetIP()

GetName
â
Returns the player's name
Returns string
my_player:GetName()

GetPing
â
Returns the ping of a player
Returns number
my_player:GetPing()

GetType
â
Returns the type of this Actor
Returns string
my_player:GetType()

GetVOIPChannel
â
Returns the VOIP Channel of this Player
Valeur retournée VOIPChannel
my_player:GetVOIPChannel()

GetValue
â
Gets a value given a key. Please refer to Entity Values for more information
Returns any
my_player:GetValue(key, fallback)
Type | Parameter | Default Value | Description |
---|---|---|---|
string | key | Key | |
any | fallback | Fallback Value if key doesn't exist |

IsHost
â
Returns if this Player started the server from New Game menu
Returns boolean
my_player:IsHost()

IsLocalPlayer
â
Returns if this is the LocalPlayer
Returns boolean
my_player:IsLocalPlayer()

IsValid
â
Returns if this entity is valid (i.e. wasn't destroyed and points to a valid entity)
Returns boolean
my_player:IsValid()

GetVOIPSetting
â
Returns this Player VOIP Setting
Valeur retournée VOIPSetting
my_player:GetVOIPSetting()

Subscribe
â
Subscribes for an Event
Returns the function callback itself
my_player:Subscribe(event_name, callback)
Type | Parameter | Default Value | Description |
---|---|---|---|
string | event_name | ||
function | function |

Unsubscribe
â
Unsubscribes from all subscribed Events in this Entity and in this Package, optionally passing the function to unsubscribe only that callback
my_player:Unsubscribe(event_name, callback)
Type | Parameter | Default Value | Description |
---|---|---|---|
string | event_name | ||
function | function | nil |
Events Detailedâ
Destroy
â
Triggered when Player disconnects from the server
Player.Subscribe("Destroy", function(self)
end)
Type | Parameter | Description |
---|---|---|
Player | self |
Possess
â
A Player is now controlling a Character
Player.Subscribe("Possess", function(self, character)
end)
Type | Parameter | Description |
---|---|---|
Player | self | |
Character | character |
Spawn
â
Triggered when Player connects to the server
Player.Subscribe("Spawn", function(self)
end)
Type | Parameter | Description |
---|---|---|
Player | self |

Ready
â
Triggered when Player is ready (the client fully joined, loaded the map and all entities and is ready to play)
Player.Subscribe("Ready", function(self)
end)
Type | Parameter | Description |
---|---|---|
Player | self |
UnPossess
â
A Character was released from the
Player
Player.Subscribe("UnPossess", function(self, character)
end)
Type | Parameter | Description |
---|---|---|
Player | self | |
Character | character |
VOIP
â
When a Player starts/ends using VOIP
Player.Subscribe("VOIP", function(self, is_talking)
end)
Type | Parameter | Description |
---|---|---|
Player | self | |
boolean | is_talking |