OnPlayerRangedShot
onPlayerRangedShot
Triggered when the server creates an authoritative arrow or bolt projectile.
Availability
This event is available in server-side scripts.
Callback signature
onPlayerRangedShot(ownerPlayerId, projectileId, shotId, weaponType, x, y, z, velocityX, velocityY, velocityZ)
Parameters
| Name | Type | Description |
|---|---|---|
ownerPlayerId |
int |
The shooting player ID. |
projectileId |
int |
The authoritative projectile ID. |
shotId |
int |
The shot sequence ID. |
weaponType |
string |
Either bow or crossbow. |
x |
number |
Projectile origin X in metres. |
y |
number |
Projectile origin Y in metres. |
z |
number |
Projectile origin Z in metres. |
velocityX |
number |
Initial X velocity in metres per second. |
velocityY |
number |
Initial Y velocity in metres per second. |
velocityZ |
number |
Initial Z velocity in metres per second. |
Examples
Handle the event:
addEventHandler("onPlayerRangedShot", root, function(ownerPlayerId, projectileId, shotId, weaponType, x, y, z, velocityX, velocityY, velocityZ)
outputDebugString(weaponType .. " projectile " .. projectileId .. " fired")
end)