GameServer
Last updated
Last updated
GameServer is a singleton instance. To fetch use, use the following lua:
Interact with the GameServer After obtaining the game server instance, you can call methods from the GameServer
class using the colon operator (:) . For example:
Send a chat message To send a chat message from the server to a specific player, use the SendChatMessage
method:
Name | Description | Usage |
---|---|---|
NOTE: SendChatMessage
and SendGlobalChatMessage
are automatically sanitized to remove any HTML tags
get()
Get the GameServer instance
GameServer:get()
Kill()
Shut down server
GameServer:get():Kill()
Kick(int)
Kick the player with the given Connection Id
GameServer:get():Kick(player:GetConnectionId())
GetTick()
Get the server's current tick value
GameServer:get():GetTick()
SendChatMessage(int, string)
Send a message to the given Connection Id
GameServer:get():SendMessage(player:getConnectionId(), "This is a message")
SendGlobalChatMessage(string)
Send a message to all connected players
GameServer:get():SendGlobalChatMessage("This is a global message")
SetTime(int hours, int minutes, float timeScale)
Set the world's time to the specified hour and minutes at the given time scale (default time scale is whatever the current world time scale
GameServer:get():SetTime(11, 15, 20) -- Set time to 11:15 AM at a time scale of 20