if api.client.x then before calling on other games.
Getters
| Call | Returns | What it tells you |
|---|---|---|
getWeapon() / getWeaponName() | string? | The item name of your equipped firearm. nil if empty-handed or not holding a firearm. |
getHydration() | number | Your current hydration. |
getEnergy() | number | Your current energy. |
getVelocity() | Vector3 | Your current velocity. |
isThirdPerson() | boolean | true while in third person. |
getVehicle() | Model? | The vehicle you’re in, or nil. |
getMaxHealth() is always 100 (the game’s base) and getHealthFraction() is relative to that. isSpectating() is always false. getTeam() reflects the local team string only.
Inventory
Read your gear and nearby loot, then move items around. Item ids come from the read calls; pass an item’sid to the action calls. These are the same moves you can do by hand, so the server still enforces space, valid slots, and so on.
| Call | Returns | What it gives you |
|---|---|---|
getItems() | { Item } | Everything in your carried containers. |
getNearbyLoot() | { Item } | Items in open bodies / containers / ground nearby (each also has container and source). |
getEquipment() | { Item } | Your equipped gear, each tagged with equipSlot. |
equipItem(id, slot?) | Equip an item (optionally into a specific slot). | |
useItem(id) | Use / consume an item (heal, eat, drink). | |
dropItem(id, rotated?) | Drop an item to the ground. | |
pickupItem(id, containerId?) | Pick up loot. The container is found for you if omitted. | |
craftItem(id, sourceId) | Combine sourceId into id (top up a mag / ammo box). | |
fillAmmo(id) | Fill a magazine from your loose ammo. | |
unloadAmmo(id) | Unload a magazine into loose ammo. | |
slotUtility(id) | Slot a utility (flashlight, binoculars, etc.). | |
removeAttachment(id, parentId?) | Detach an attachment. The parent is found for you if omitted. |