Player
A connected player. Getters read the latest state (synced from their game
~20 times a second); setters change it for them and everyone.
Identity and connection
|
|
id |
Slot number, unique among connected players (reused after they leave). |
name |
As given when joining. |
connected |
False once they've left. |
ip, viaProxy |
Their address (the forwarded one through a trusted proxy). |
connectHost, connectPort |
What they typed to connect. |
ping |
Round-trip time, ms. |
paused |
Pause menu open. |
focused |
False while alt-tabbed. |
data |
Your own per-player state. |
State
|
|
alive |
Alive in the world. |
position |
{ x, y, z } (their vehicle's while driving). |
heading |
Degrees. |
setPosition(position, heading?) |
Teleports them. |
health, armour |
Get/set. |
skin |
Ped model (0 is CJ), get/set. |
money, giveMoney(amount) |
The server's; their game shows exactly this. |
wantedLevel, maxWantedLevel |
0-6, get/set. |
world |
Virtual world, get/set. |
Vehicles
|
|
vehicle |
The one they're in, or null. |
seat |
0 driver, 1-8 passenger, null on foot. |
lastVehicle |
The one they last drove (kept from ambient cleanup). |
removeFromVehicle() |
Puts them out beside it. |
remoteControl(vehicle \| null, { detonate? }) |
They drive vehicle from where they stand, as an RC car. False if it can't be given. |
remoteVehicle |
The one they remote-control. |
radioNameHidden |
Hide radio station names on their screen. |
Weapons
|
|
weapons |
{ slot, weapon, ammo }[]. |
weapon |
In their hand; set to one they have (0 unarmed). |
giveWeapon(weapon, ammo) |
Into its slot, or adds ammo. |
setAmmo(weapon, ammo) |
|
removeWeapon(weapon), resetWeapons() |
|
Stats and movement
|
|
setStat(stat, value), getStat(stat), resetStat(stat) |
Stat; only the server changes stats. |
infiniteSprint |
Never tires. |
skinAnimations |
Walk and run like their skin (true) or CJ. |
Messages, scripts, map
|
|
send(text, color?) |
A message to them (0xRRGGBB). |
kick(reason?) |
Disconnects them. |
emit(channel, data?) |
Data to their client scripts (sagl.on(channel, fn)). |
map |
Their own GameMap. |