Combat¶
Send damage packets to players and entities.
Asterion.SendDamage¶
Sends a damage packet to a specific player or entity.
Parameters¶
options is a table:
| Field | Type | Default | Description |
|---|---|---|---|
player |
integer |
— | Server player slot to target. |
entity |
integer |
— | Entity handle to target (use instead of player). |
weapon |
hash |
0 |
Weapon hash the damage is attributed to. |
damage |
number |
100.0 |
Amount of damage to apply. |
flags |
integer |
0 |
Damage flags. |
px |
number |
0 |
Hit position X. |
py |
number |
0 |
Hit position Y. |
pz |
number |
0 |
Hit position Z. |
Target either player or entity — not both. Use
entity = GetPlayerPed(p) to target by entity handle instead of by slot.
Example¶
Asterion.SendDamage({
player = 3, -- server player slot (or use entity=)
weapon = 0xBFEFFF6D, -- weapon hash (default 0)
damage = 100.0, -- damage amount (default 100)
flags = 0, -- damage flags (default 0)
px = 0, py = 0, pz = 0
})
Target by entity handle instead:
Asterion.SendDamage({
entity = GetPlayerPed(3),
weapon = GetHashKey("WEAPON_PISTOL"),
damage = 250.0,
})
Asterion.SendDamageAll¶
Sends a damage packet to every player within range metres.
Parameters¶
| Field | Type | Default | Description |
|---|---|---|---|
weapon |
hash |
0 |
Weapon hash the damage is attributed to. |
damage |
number |
100.0 |
Amount of damage to apply to each target. |
range |
number |
100.0 |
Radius in metres around the local player. |
flags |
integer |
0 |
Damage flags. |
Example¶
Asterion.SendDamageAll({
weapon = 0xBFEFFF6D,
damage = 100.0,
range = 100.0, -- radius in metres (default 100)
flags = 0
})
Radius is measured from you
range is centred on the local player, so everyone (including teammates)
inside the radius is affected. Lower it if you only want nearby targets.