Skip to content

fix invalid client index crash in VIP_Tag on client connect - #21

Merged
Rushaway merged 1 commit into
masterfrom
Rushaway-patch-1
Aug 16, 2026
Merged

Rushaway merged 1 commit into
masterfrom
Rushaway-patch-1

Conversation

@Rushaway

Copy link
Copy Markdown
Member

Summary

  • OnClientConnected fired CS_GetClientClanTag before the client
    entity existed, throwing Client index N is not valid (see server
    log below). Switched the hook to OnClientPutInServer, which only
    fires once the entity is created.

Log before fix

L 08/16/2026 - 13:01:19: [SM] Exception reported: Client index 12 is not valid
L 08/16/2026 - 13:01:19: [SM] Blaming: vip/VIP_Tag.smx
L 08/16/2026 - 13:01:19: [SM] [0] CS_GetClientClanTag
L 08/16/2026 - 13:01:19: [SM] [1] Line 44, VIP_Tag.sp::OnClientConnected

CS_GetClientClanTag was called from OnClientConnected, before the
client entity actually exists, causing "Client index N is not valid"
exceptions on connect. Move the lookup to OnClientPutInServer, where
the entity is guaranteed to be valid.
Copilot AI lite review requested due to automatic review settings August 16, 2026 11:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a crash in the SourceMod VIP_Tag plugin caused by calling CS_GetClientClanTag before the client entity exists by moving the initialization hook to a later lifecycle callback.

Changes:

  • Bumped plugin version to 1.0.2.
  • Replaced OnClientConnected with OnClientPutInServer for capturing/storing the player’s original clan tag after the entity is created.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@Rushaway
Rushaway merged commit db96971 into master Aug 16, 2026
7 checks passed
@Rushaway
Rushaway deleted the Rushaway-patch-1 branch August 16, 2026 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants