Jump to content

Server Events: PlayerConnected, PlayerDisconnected, PlayerSpawned, PlayerDied


Konijima

Recommended Posts

Suggestion to make it a bit easier for server mods to handle some of the situation.
Most of it is doable in a hacky way but having those in the core engine would just make it cleaner and more efficient for us.
 

EVENTS:
 

OnServerPlayerConnected (playerObj, isNewPlayer)

When the player officially connected to the server, passing a parameter to inform if it's a brand new player.

Use cases:

  1. Show a message, an existing player has connected.
  2. Show a message, a new player has connected.
  3. Do something every time a player join.
  4. Do something one-time only when a new player joined for the first time.
     

___________________________________________
 

OnServerPlayerDisconnected (playerObj, reason)

When the player has left the server, passing a parameter to inform the reason of leaving. (Logged Out, Kicked, Banned, Unknown/Crash)

Use cases:

  1. Show a message, a player has left and why.
  2. Do something special when a player disconnect based on the reason.


___________________________________________

 

OnServerPlayerSpawned (playerObj, isNewCharacter)

Similar to OnServerPlayerConnected but also trigger after re-spawning a new character (after death).

Use cases:

  1. Do something every time a player spawn.
  2. Do something when a player spawn with a new character.

 

___________________________________________
 

OnServerPlayerDied (playerObj, reason)

Trigger when a player has died, potentially add the cause of the death.
 

Use cases:

  1. Show a message, when a player died and why.
  2. Do something every time a player died.

 

Edited by Konijima
Added use cases. Fixed typo.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...