OnPlayerRangedShot

From Wiki G1R-MP G1 Remake Multiplayer
Revision as of 22:32, 14 August 2026 by QCherry (talk | contribs) (Update Lua event reference)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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)