Skip to content

fix(logic): correct checks for weapon ownership#39

Merged
Rushaway merged 4 commits intosrcdslab:masterfrom
Dolly132:main-dolly3
Mar 7, 2026
Merged

fix(logic): correct checks for weapon ownership#39
Rushaway merged 4 commits intosrcdslab:masterfrom
Dolly132:main-dolly3

Conversation

@Dolly132
Copy link
Copy Markdown
Contributor

@Dolly132 Dolly132 commented Mar 6, 2026

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates TopInfectors’ grenade reward logic to check actual weapon ownership (instead of using the grenade ammo count as a proxy), and bumps the plugin patch version.

Changes:

  • Bump TopInfectors_V_PATCH from 9 to 10.
  • Update grenade-giving logic to detect whether the player already owns the grenade weapon by scanning m_hMyWeapons.
  • Apply minor formatting/whitespace cleanups in TopInfectors.sp.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
addons/sourcemod/scripting/include/TopInfectors.inc Patch version bump for the public include/version macro.
addons/sourcemod/scripting/TopInfectors.sp Adjusts grenade reward ownership check (ammo → inventory scan) and includes formatting changes.
Comments suppressed due to low confidence (2)

addons/sourcemod/scripting/TopInfectors.sp:55

  • myinfo plugin metadata struct initializer appears to be missing a terminating semicolon after the closing brace. With #pragma semicolon 1 this typically fails compilation (expected };).
public Plugin myinfo =
{
	name            =       "Top Infectors",
	author          =       "Nano, maxime1907, .Rushaway",
	description     =       "Show top infectors after each round",

addons/sourcemod/scripting/TopInfectors.sp:637

  • offsNades is computed twice (once per branch) using the same FindDataMapInfo expression. Consider computing it once before the if/else to reduce duplication and make the logic easier to follow.
	if (HasPlayerItem(client, sWeapon))
	{
		int offsNades = FindDataMapInfo(client, "m_iAmmo") + (view_as<int>(type) * 4);
		int count = GetEntData(client, offsNades);
		SetEntData(client, offsNades, count + iAmount);

@Rushaway Rushaway merged commit 3bfd3ac into srcdslab:master Mar 7, 2026
3 checks passed
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.

3 participants