fix(logic): correct checks for weapon ownership#39
Merged
Rushaway merged 4 commits intosrcdslab:masterfrom Mar 7, 2026
Merged
Conversation
There was a problem hiding this comment.
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_PATCHfrom9to10. - 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
myinfoplugin metadata struct initializer appears to be missing a terminating semicolon after the closing brace. With#pragma semicolon 1this 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
offsNadesis computed twice (once per branch) using the sameFindDataMapInfoexpression. Consider computing it once before theif/elseto 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);
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.