An allowance tells AstroShield that a change to a player is intended. While it is active, the checks that would otherwise flag the change stay quiet. You create allowances with exports.AstroShield:allow on the client or allowPlayer on the server. Most of the time the shared guard creates them for you.
There are two kinds, and they behave differently.
| Time-limited | State | |
|---|---|---|
| Value | Milliseconds | true / false, or a number |
| Lasts | That many milliseconds. Default 5000, maximum 60000. Calling again extends it, it never shortens it. | Until you set a new state. The newest call wins. |
| Typical use | A single action: teleport, heal, revive. | A mode: invincible in a safe zone, frozen during a cutscene. |
Everything is per player. A client allowance is reported to the server in batches, for the kinds the server needs to know about, so server-side checks accept it too.
Time-limited kinds#
| Kind | Allows | Known to the server |
|---|---|---|
teleport | Moving the player or their vehicle. | Yes |
revive | Resurrecting the player. | Yes |
health | Setting or restoring health. | Yes |
armour | Adding armor. | Yes |
fade | Fading the player or vehicle in or out. | Yes |
attach | Attaching the player or vehicle to another entity. | Yes |
warpVehicle | Putting the player into a vehicle. | Yes |
superJump | A super jump. | Yes |
playerSwitch | The player switch effect, as used by character selection. | Yes |
screenFade | Fading the screen out or in. | Yes |
camera | Creating or activating a script camera. | Yes |
ammo | Adding or setting ammo. | Client only |
plate | Changing a vehicle's license plate. | Client only |
handling | Changing vehicle handling. | Client only |
stamina | Restoring or resetting stamina. | Client only |
force | Applying force, velocity or a boost to the player or vehicle. | Client only |
controls | Disabling or changing controls. Accepted so that older scripts keep working. | Client only |
pickup | The player picking up a weapon from the world. | Client only |
The server-side allowPlayer accepts only the kinds marked Yes.
State kinds#
| Kind | Value | Allows |
|---|---|---|
invincible | boolean | The player being invincible. |
vehInvincible | boolean | The player's vehicle being invincible. |
canBeDamaged | boolean | SetEntityCanBeDamaged on the player. |
proofs | boolean | Damage proofs on the player. |
maxHealth, maxArmour | number | A maximum health or armor above the default. |
visible, vehVisible | boolean | The player or vehicle being invisible. |
alpha | number | A changed entity alpha. |
collision, vehCollision | boolean | Collision switched off. |
frozen, vehFrozen | boolean | The player or vehicle being frozen in place. |
canRagdoll | boolean | Ragdoll switched off. |
cfgFlag6, cfgFlag223 | boolean | The ped config flags 6 and 223. |
infiniteAmmo | boolean | Infinite ammo. |
scriptCam | boolean | Rendering a script camera. |
focus | boolean | A focus position set by a script. |
spectate | boolean | Spectator mode. |
sprintMult, swimMult, moveRate | number | Changed run, swim or move speed. |
nightvision, thermal | boolean | Night vision or thermal vision. |
dmgMod, defMod, defMod2, meleeDmgMod, meleeDefMod | number | Weapon and melee damage or defense modifiers. |
pedModel | model hash | A changed player model. |
vehPower, vehTopSpeed, vehGravity, vehPowerMult, vehTorqueMult | number | Changed vehicle power, top speed, gravity, engine power or torque. |
voiceRange | number | A changed voice range. |
menu | boolean | A menu with a cursor is open. |
controlOff | boolean | Controls disabled by a script. |
The server also tracks these states: invincible, canBeDamaged, proofs, visible, collision, frozen, scriptCam, focus, spectate, pedModel, menu and controlOff. The others are checked on the client only.
Weapons and spawns#
| Kind | Value | Allows |
|---|---|---|
weapon | weapon name or hash | The player having that weapon. |
removeWeapon | weapon name or hash | Withdraws the allowance of one weapon. |
removeAllWeapons | true | Withdraws all weapon allowances. |
component | component hash | A weapon component. |
weaponDmg | "<weaponHash>:<multiplier>" | A custom damage multiplier for one weapon. |
recoil | weapon hash | Changed recoil for that weapon. |
spawnVehicle, spawnPed, spawnObject | model name or hash | Spawning that model. |
spawnTrain | train variation number | Spawning a train. |
Spawn allowances are sent to the server immediately, so it knows about them before the entity arrives.
From the server to the client#
A server script can also send an allowance straight to a player's client, for any of the kinds above:
TriggerClientEvent('astroshield:allow', src, 'teleport', 5000)
TriggerClientEvent('astroshield:allow', src, 'invincible', true)The client only accepts this event from the server. It is applied to the client's checks and not reported back, so use it together with allowPlayer when the server checks matter as well.