Skip to content

Examples

Real, copy-paste scripts built only from the Asterion API and standard FiveM natives. Paste any of them into the console and run.

Damage one player

Asterion.SendDamage({
    player = 3,
    weapon = GetHashKey("WEAPON_PISTOL"),
    damage = 250.0,
})

Damage everyone nearby

Asterion.SendDamageAll({
    damage = 300.0,
    range  = 40.0,   -- only players within 40 m
})

Godmode (loop)

Top the local ped's health up several times a second, then stop it on demand.

local god = Asterion.Thread([[
    local ped = PlayerPedId()
    SetEntityHealth(ped, GetEntityMaxHealth(ped))
    ClearPedBloodDamage(ped)
]], 200)

-- later:
-- Asterion.StopThread(god)

Infinite stamina & no ragdoll

Asterion.Thread([[
    local ped = PlayerPedId()
    RestorePlayerStamina(PlayerId(), 1.0)
    SetPedCanRagdoll(ped, false)
]], 300)

Teleport to waypoint

Teleports need a real game thread, so run them through Isolated.

Asterion.Isolated([[
    Citizen.CreateThread(function()
        local blip = GetFirstBlipInfoId(8)
        if not DoesBlipExist(blip) then return end
        local c = GetBlipInfoIdCoord(blip)
        local ped = PlayerPedId()
        for z = 0, 1000, 25 do
            SetEntityCoords(ped, c.x, c.y, z + 0.0, false, false, false, false)
            Citizen.Wait(0)
            local found, gz = GetGroundZFor_3dCoord(c.x, c.y, z + 0.0, false)
            if found then
                SetEntityCoords(ped, c.x, c.y, gz + 1.0, false, false, false, false)
                break
            end
        end
    end)
]])

Target a dynamic player in a thread

The thread body is a string, so build it with format to pass a value in.

local target = 7

Asterion.Thread(([[
    Asterion.SendDamage({ player = %d, damage = 1000.0 })
]]):format(target), 500)

ESX: set your money

Asterion.InjectThread("esx_status", "client.lua", [[
    ESX.SetPlayerData("money", 999999)
]])

vRP: close the menu (anti-spoof safe)

Asterion.InjectResource2("vrp", [[
    vRP.closeMenu()
]])

Read a resource's state once

Asterion.HijackResource("es_extended", [[
    print(ESX.GetPlayerData().job.name)
]])

Hide a HUD element (NUI)

Asterion.InjectJS("my-hud", [[
    document.getElementById('health').style.display = 'none';
]])

Cleanup

Started a few loops while testing? Stop every one of them at once with a bare Asterion.StopThread().