Skip to content

Prone fire & sync ​

GTA V has no prone stance for players. It has crawl animations and one engine task that aims a gun lying down (TaskAimGunScripted with SCRIPTED_GUN_TASK_PLANE_WING). That task is the obvious choice, but in FiveM it is not replicated: other players see the shooter stand up while the hitbox stays on the ground. So this resource doesn't use it. Instead, what other players see is built only from things FiveM replicates on its own:

What others see How it is synced
The prone pose A looping full-body animation (TaskPlayAnim), replicated by OneSync
Where the body points (yaw) The ped heading
Where the rifle points up or down (pitch) Which clip of the pose pack is playing (one clip per pitch bucket)
The shot: sound, flash, damage, kill credit, ammo The ped's own weapon fires through the engine. Fallback: a scripted bullet owned by the ped
A muzzle flash when the engine shot doesn't show remotely A server relay to nearby clients
The stance Replicated state bags

The aiming itself is a scripted camera on the shooter's client. Everything below is about keeping that camera and the synced pose close enough that nobody gets shot by a ped that looks like it aims somewhere else.

Deploy ​

While prone on the front with a weapon whose class is in Config.Prone.weaponClasses, holding aim deploys:

  1. The pose pack's clips are resolved (first candidate that loads), sorted by pitch, and the bucket closest to level starts playing.
  2. The aim camera starts: a scope for the sniper class, the eye or shoulder view for the rest (Config.Camera).
  3. LocalPlayer.state.proneDeployed becomes true and np_ccs:deployChanged fires.
  4. After Config.Prone.deployTimeMs the weapon has settled and can fire.

If something else clears the pose (an emote, another resource), it is put back within half a second. Releasing aim, changing stance, rolling over, changing or holstering the weapon, or getting incapacitated ends the deploy.

Yaw: the body follows the aim ​

The camera can lead the body by up to Config.Prone.aimArc (40°). Past that, the body turns toward the aim at Config.Prone.bodyTurnRate (90°/s). The heading replicates, so other players see the body turn too.

A shot is only allowed when the aim is within Config.Prone.fireArc (12°) of the body heading. While the body is still catching up, the crosshair shows Turning and the trigger does nothing. This is what stops a prone ped from hitting something 40° to its side while it looks like it aims straight ahead.

Rifle deployed while the body catches up with the aim

Mockup of the fallback NUI with mock data.

Pitch: pose packs ​

The heading carries yaw, but nothing replicates where a playing animation points the arms. Pitch is therefore shown by switching between clips: a pose pack has one looping clip per pitch bucket, for example −20°, −10°, 0°, +10°, +20°.

  • When the aim pitch crosses into another bucket (plus Config.Prone.bucketHysteresis, so it doesn't flicker), the matching clip is played. Each switch is an ordinary animation task, so it replicates.
  • With more than one bucket, a shot is only allowed when the aim pitch is within Config.Prone.firePitchTolerance (6°) of the active bucket, and not during the 200 ms blend after a switch. The camera's pitch range is the first bucket minus the tolerance to the last bucket plus the tolerance.
  • With a single bucket (the vanilla pack), there is nothing to switch to. Pitch is clamped to Config.Prone.vanillaPitch (−12° to +18°) to keep the difference between the camera and the level-looking rifle small.

The vanilla pack ​

The default pack uses game clips only: the lying sniper pose from the story mission (missfbi3_sniping / prone_michael, then prone_dave), and as a last resort a frozen frame of the crawl clip. It has one bucket, so other players see the body's direction but not the rifle's pitch. With a scoped rifle at range this is hard to notice. With an assault rifle at close range, a shooter aiming up a slope still looks level from outside.

Adding a streamed pose pack ​

Visible pitch needs custom animations. A pose pack is just a clip dictionary and some config:

  1. Author the clips. One looping, full-body prone aim pose per pitch bucket, holding a two-handed rifle, all in one dictionary, for example np_prone_aim with aim_d20, aim_d10, aim_0, aim_u10, aim_u20. Optionally an upper-body fire additive (fire_add) and an upper-body reload (reload). Export them as a .ycd.
  2. Stream it. Put np_prone_aim.ycd in a stream/ folder in the resource (or in a separate streaming resource that starts first). FiveM streams the files in stream/ automatically. A data_file entry is not needed for .ycd clip dictionaries.
  3. Add the pack to Config.Poses.packs and select it:
    lua
    Config.Poses = {
      active = 'np_prone_aim',
      packs = {
        vanilla = { --[[ keep it as the fallback ]] },
        np_prone_aim = {
          buckets = {
            { pitch = -20.0, candidates = { { 'np_prone_aim', 'aim_d20' } } },
            { pitch = -10.0, candidates = { { 'np_prone_aim', 'aim_d10' } } },
            { pitch = 0.0,   candidates = { { 'np_prone_aim', 'aim_0' } } },
            { pitch = 10.0,  candidates = { { 'np_prone_aim', 'aim_u10' } } },
            { pitch = 20.0,  candidates = { { 'np_prone_aim', 'aim_u20' } } },
          },
          fire = { 'np_prone_aim', 'fire_add' },
          reload = { 'np_prone_aim', 'reload' },
        },
      },
    }
  4. Check it with /ccs_check: every bucket of every pack is listed with the candidate that resolved. Buckets whose clips don't load are skipped. If none load, deploying shows "No prone aim pose available on this client".
  5. Tune firePitchTolerance to about half the bucket spacing, and check with a second client that the rifle in each bucket points where the scope does.

Buckets don't need to be evenly spaced and are sorted by pitch at deploy time. Each bucket can have several candidates, like the other animation slots, so a pack can fall back to game clips per bucket.

Shot ​

On each allowed trigger pull, the client takes the crosshair point (camera ray plus the class's spread) and fires one of two ways (Config.Fire.method):

Method What happens Trade-off
ped SetPedShootsAtCoord with the ped's real weapon Sound, muzzle flash, damage, kill credit and ammo go through the engine like any shot. May break the pose or not fire during a full-body animation (unverified)
bullet ShootSingleBulletBetweenCoordsIgnoreEntityNew from the weapon's muzzle bone to the crosshair point, owned by the ped, damage from GetWeaponDamage; the script takes one round from the clip and plays a local muzzle flash Works in any state. Other players get the flash only from the relay. Some anticheats flag scripted bullets: whitelist this resource if yours does
auto (default) Starts with ped. Two frames after each shot it checks that the pose is still playing and the weapon fired. If not, it switches to bullet for the rest of the session and delivers the lost shot through it

/ccs_check prints the session's current method. The ped's weapon is never switched by script: np_inventory owns the drawn weapon, and the shot always uses the weapon in hand.

Ammo, jams and reload ​

  • The clip is the native ammo of the drawn weapon. np_inventory reads it as usual.
  • With np_inventory: a jammed weapon refuses to fire (isWeaponJammed()), and reload goes through reloadWeapon(), which refills the clip from ammo items without the standing reload animation. Scripted shots count for durability through np_ccs:shotFired.
  • Without np_inventory: a timed reload (Config.Fire.reloadMs) that refills the clip from the weapon's native reserve.
  • The pose pack's reload clip plays as an upper-body animation if the pack has one.

Recoil, spread, sway ​

Per class from Config.Weapons.classes: spread offsets the shot, recoil and recoilYaw kick the camera and recoilReturn brings it back, sway moves the camera over time. The scope's sway is reduced while holding breath. All of this happens on the shooter's camera; other players see the pose.

Server validation ​

Every prone shot is also sent to the server as np_ccs:shot with the weapon, class, muzzle position, impact point and a sequence number. The server checks it against its own view of the player:

Reason Check
malformed Missing or non-finite numbers, not a table, non-integer sequence
no_pos No server-side position for the player
stance The player's stance bag isn't 'prone'
not_deployed proneDeployed isn't true
weapon The reported weapon isn't the weapon the server sees in the ped's hands
class The class isn't allowed in Config.Prone.weaponClasses
origin The muzzle is more than Config.Server.originTolerance from the player
range Muzzle to impact is longer than Config.Fire.maxRange
seq Sequence number not increasing (replay)
rate Faster than the class's minShotIntervalMs minus Config.Server.intervalSlackMs
burst The per-player token bucket (Config.Server.burst) is empty

A rejected shot is logged according to Config.Server.log (console, or the np_ccs:suspicious server event) and is not relayed. The server can't undo the shot: damage was already applied by the game. Use the log or the event to feed your anticheat.

The state bags are checked too: a client that writes an invalid value into stance, proneType, proneDeployed, isProne or isCrouched gets it reset to standing values, with a console line.

Relay and remote muzzle flash ​

An accepted shot is relayed as np_ccs:shotRelay to every player within Config.Fire.relayRange of the muzzle. The receiving client only adds cosmetics, never damage:

  • If the shooter's ped showed a real engine shot (IsPedShooting) within Config.Fire.remoteFx.windowMs before or after the relay, nothing is added. That is the normal case with the ped method.
  • Otherwise it plays a muzzle flash particle on the shooter's weapon (remoteFx.flashAsset / flashName).

So with the bullet method, other players get the flash from the relay. The bullet's sound and impact come from the game.

What is not synced ​

  • The shooter's camera, zoom, sway and recoil: local only.
  • The scope view hides the shooter's own body locally. Others see it.
  • With the vanilla pack: rifle pitch (see above).
  • The stance chip and key hints: local UI.