These exports are available to client scripts. They tell AstroShield that something your script just did, or is about to do, is legitimate. See Developer overview for how to call them.
With the shared guard installed, AstroShield already recognizes the common natives your scripts call. Use these exports for what it does not see. A time-limited allowance lasts a number of milliseconds. A state allowance stays until you change it again, and the newest call wins.
Generic#
allow#
exports.AstroShield:allow(kind, value?)Allows one thing. kind is a name from the allowance reference and value depends on it:
| Kind of allowance | value |
|---|---|
Time-limited, like teleport or health | Milliseconds. Default 5000, maximum 60000. |
State, like invincible or frozen | true or false, or a number for values like vehGravity. |
weapon, removeWeapon | A weapon name or hash. |
spawnVehicle, spawnPed, spawnObject | A model name or hash. |
exports.AstroShield:allow('teleport', 5000)
exports.AstroShield:allow('invincible', true)
exports.AstroShield:allow('spawnVehicle', 'adder')Unknown kinds and values of the wrong type are ignored.
Helpers#
These do the same as allow, with a ready-made kind and duration.
Player#
| Export | Allows | For |
|---|---|---|
grantedArmour() | Armor being added | 8 s |
healthRefilled() | Health being restored | 5 s |
playerRevived() | A revive | 10 s |
resettedStamina() | Stamina being reset | 10 s |
hasTeleported() | A teleport | 10 s |
hasAddedAmmo() | Ammo being added | 5 s |
ChangeVehiclePlate() | A license plate change | 10 s |
createCam() | A script camera | 30 s |
proofsEnabled(toggle?) | Damage proofs on or off | until changed |
canBeDamaged(toggle?) | SetEntityCanBeDamaged on or off | until changed |
isInvincible(toggle?) | Invincibility on or off | until changed |
toggle is optional. Leaving it out means true. Pass false to say the state ended.
-- A safe zone gives players invincibility while inside
exports.AstroShield:isInvincible(true)
-- ... leave the zone
exports.AstroShield:isInvincible(false)Spawns#
exports.AstroShield:CreateVehicle(model)
exports.AstroShield:CreatePed(model)
exports.AstroShield:CreateObject(model)Call it just before your script creates that model. model is a name or a hash.
Vehicles#
exports.AstroShield:newGravity(value?) -- default 9.8
exports.AstroShield:newCheatPowerIncrease(value?) -- default 1.0
exports.AstroShield:newTopSpeedModifier(value?) -- default -1.0Each allows the matching change to the player's vehicle. The value is the value you are about to set.
Weapons#
exports.AstroShield:giveWeapon(weapon)
exports.AstroShield:removeWeapon(weapon)
exports.AstroShield:removeAllWeapons()
exports.AstroShield:setNewDamage(weapon, modifier?) -- modifier default 1.0weapon is a name like 'WEAPON_PISTOL' or a hash. giveWeapon tells AstroShield that the player is meant to have it. setNewDamage allows a custom damage modifier for one weapon.
Kept for compatibility#
These exist so that scripts written for other anticheats keep working. They are accepted and do almost nothing.
| Export | Behavior |
|---|---|
disableE2(), disableCamControls(), disableAllControls() | Allow controls changes for 5 s. |
destroyCam(), destroyCams() | No effect. |
Read state#
exports.AstroShield:isAcReady() --> boolean
exports.AstroShield:shouldDetect() --> boolean
exports.AstroShield:isAdmin() --> boolean
exports.AstroShield:getConfig() --> table or nil| Export | Returns |
|---|---|
isAcReady() | true once the player has spawned and the short grace period after it is over. |
shouldDetect() | false when the player is an admin and the txAdmin whitelist is on. |
isAdmin() | Whether the server marked this player as an admin. |
getConfig() | The configuration the server sent to this client. Secrets such as webhook URLs are removed. It is nil until it arrives. |
Monitoring a resource#
exports.AstroShield:getMonitoredResources() --> { [resourceName] = true }
exports.AstroShield:addMonitoredResource(resourceName)When Anti Resource Stop is on, AstroShield checks that its monitored resources are not stopped on the client. Every resource that has the shared guard is monitored by default. addMonitoredResource adds another one for this session.