Getting started with Commands
How chat commands will work in Alt:SA gamemodes, and what to use until they land.
Introduction#
Commands are the quickest way for a player to ask the server for something: type /weapon or /help in chat and the gamemode answers. Most San Andreas servers rely on them, so Alt:SA will have them, but the API isn't designed yet.
What to use today#
Godfather gives a gamemode two ways to take input from a player (and player.Message(text) to answer in chat):
- UI panels: a panel with fields and buttons. Callbacks run on the server.
- Events: react to what players do, such as joining or leaving. See Getting started with Events.
1var panel = UI.Panel(player, "Help");2panel.Text("Pick what you need.");3panel.Button("Respawn", () => { panel.Close(); player.Spawn(Spawn.Default); });4panel.Button("Close", () => panel.Close(), ButtonKind.Ghost);Follow progress#
The command API is tracked on the Godfather roadmap. When it ships it will be listed in the Godfather changelog and this tutorial will be written in full.
Next step#
Read Getting started with Client-side to learn what the player's game does and doesn't run.