Skip to content

SWEP:Deploy() and PlayerSwitchWeapon hook not called on client when weapon is auto-selected via ply:Give() #6686

@FoxProfef

Description

@FoxProfef

Details

Description:
On the x86-64 branch (Chromium), there is a networking desync when a weapon is given via ply:Give(). If the weapon is automatically selected by the engine, the SWEP:Deploy method and the PlayerSwitchWeapon hook are NOT triggered on the CLIENT side.

Environment:

  • OS: Windows (both Client and Listen Server).
  • Mode: Multiplayer (Listen Server or Dedicated) with 2+ players.
  1. Manually switching to another weapon and back "fixes" it and triggers the Client call.Critical Impact on Prediction:
    This bug breaks movement prediction for high-latency players (tested with 750ms+ fakelag). Since the client doesn't run Deploy, it fails to initialize prediction tables (e.g., for SetupMove). This results in severe rubberbanding as the server moves the player but the client doesn't "predict" the movement locally.

Expected behavior:
The client should always fire Deploy and PlayerSwitchWeapon when a weapon becomes active, regardless of whether it was a manual switch or a server-side ply:Give().

Steps to reproduce

  1. Create a SWEP that prints "Deploy called" in SWEP:Deploy on both Server and Client.
  2. Force give the weapon to a player via server-side script: player:Give("weapon_class").
  3. Observe that the console message only appears on the Server.

Version of the game

2026.01.08

Beta

x86-64 beta

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions