Skip to main content

Events

Client Events

NameDescription
scriptInitCalled after the player has connected to the server, joined the default session for the first time and all scripts have been loaded.
sessionInitCalled when the player has joined a session.
sessionJoinCalled for the host player when a player joins the session.
sessionEndCalled when the player starts to leave the session.
chatCommandCalled when a command is entered in the chat.

Server Events

NameDescription
playerDisconnectCalled when a player disconnects.

scriptInit

Called after the player has connected to the server, joined the default session for the first time and all scripts have been loaded.

scriptInit()

Example:

Events.Subscribe("scriptInit", function()
Chat.AddMessage("Welcome to my server.")
end)

sessionInit

Called when the player has joined a session.

sessionInit()


sessionJoin

Called for the host player when a player joins the session.

sessionJoin()


sessionEnd

Called when the player starts to leave the session.

sessionEnd()


chatCommand

Called when a command is entered in the chat.

chatCommand(string fullChatMessage)

info

This event will be only called if the default chat is activated in the server settings.

Example:

Events.Subscribe("chatCommand", function(command)
if command == "/testcmd" then
Chat.AddMessage("Test Command!")
end
end)

playerDisconnect

Called when a player disconnects.

playerDisconnect(int serverID, string playerName, int reason)

Example:

Events.Subscribe("playerDisconnect", function(id, name, reason)
Chat.BroadcastMessage("{0000FF}" .. name .. " {FFFFFF}has left the server.")
end)