Command Palette

Search for a command to run...

Client exports

Every supported client-side export of AstroShield, from the generic allow to the one-line helpers for heals, teleports, spawns and weapons.

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#

Lua
exports.AstroShield:allow(kind, value?)

Allows one thing. kind is a name from the allowance reference and value depends on it:

Kind of allowancevalue
Time-limited, like teleport or healthMilliseconds. Default 5000, maximum 60000.
State, like invincible or frozentrue or false, or a number for values like vehGravity.
weapon, removeWeaponA weapon name or hash.
spawnVehicle, spawnPed, spawnObjectA model name or hash.
Lua
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#

ExportAllowsFor
grantedArmour()Armor being added8 s
healthRefilled()Health being restored5 s
playerRevived()A revive10 s
resettedStamina()Stamina being reset10 s
hasTeleported()A teleport10 s
hasAddedAmmo()Ammo being added5 s
ChangeVehiclePlate()A license plate change10 s
createCam()A script camera30 s
proofsEnabled(toggle?)Damage proofs on or offuntil changed
canBeDamaged(toggle?)SetEntityCanBeDamaged on or offuntil changed
isInvincible(toggle?)Invincibility on or offuntil changed

toggle is optional. Leaving it out means true. Pass false to say the state ended.

Lua
-- A safe zone gives players invincibility while inside
exports.AstroShield:isInvincible(true)
-- ... leave the zone
exports.AstroShield:isInvincible(false)

Spawns#

Lua
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#

Lua
exports.AstroShield:newGravity(value?)            -- default 9.8
exports.AstroShield:newCheatPowerIncrease(value?) -- default 1.0
exports.AstroShield:newTopSpeedModifier(value?)   -- default -1.0

Each allows the matching change to the player's vehicle. The value is the value you are about to set.

Weapons#

Lua
exports.AstroShield:giveWeapon(weapon)
exports.AstroShield:removeWeapon(weapon)
exports.AstroShield:removeAllWeapons()
exports.AstroShield:setNewDamage(weapon, modifier?)  -- modifier default 1.0

weapon 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.

ExportBehavior
disableE2(), disableCamControls(), disableAllControls()Allow controls changes for 5 s.
destroyCam(), destroyCams()No effect.

Read state#

Lua
exports.AstroShield:isAcReady()    --> boolean
exports.AstroShield:shouldDetect() --> boolean
exports.AstroShield:isAdmin()      --> boolean
exports.AstroShield:getConfig()    --> table or nil
ExportReturns
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#

Lua
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.