Server API¶
Everything gamemodes use comes from @sagl/server:
import {
Server, Player, Vehicle, Ped, Zone, Garage, World, CullZone, GameMap,
ClientScripts, Channel, Console,
Weapon, Stat, BodyPart, Color, RadioStation, Weather, GarageType,
ZoneAttribute, AudioZone, DoorDamage, TyreDamage, PanelDamage,
} from "@sagl/server";
| Class | What it is |
|---|---|
| Server | The server: options, players, vehicles, peds, zones, worlds, time. |
| Events | Everything server.on() can listen to. |
| Player | A connected player. |
| Vehicle | A vehicle, yours or the ambient traffic's. |
| Ped | An NPC, yours or the ambient population's. |
| World and CullZone | A virtual world's time, weather and population; interior effect zones. |
| Zone and Garage | Watched areas; the game's garages. |
| GameMap | Markers and overlays on the pause menu's map. |
| ClientScripts and Channel | Client scripts, and talking to them. |
| Console | The operator console. |
| Constants | Weapon, Stat, Weather, ... |
Conventions¶
- Positions are metres in world coordinates:
{ x, y, z }(Vector3). - Headings are degrees, 0 north, increasing anticlockwise.
- Colours for messages are
0xRRGGBB; for the map and branding0xRRGGBBAAor"#RRGGBB[AA]". - Getters read the server's latest state (synced ~20 times a second); setters change it for everyone.
- Every
Player,Vehicle,PedandZonehasdata, a free-form object for your own state.