Skip to content

Conversation

@dystopm
Copy link
Contributor

@dystopm dystopm commented Aug 20, 2025

Fix SetHamItemInfo to store strings in the engine's string pool rather than keeping raw pointers from native parameters. Raw pointers could be overwritten, leading to crashes or undefined behavior.

Native is currently useless without this fix.

@rtxa
Copy link
Contributor

rtxa commented Oct 14, 2025

Now I know why I couldn't change cl_autowepswitch behaviour in the past

@dystopm
Copy link
Contributor Author

dystopm commented Oct 14, 2025

Now I know why I couldn't change cl_autowepswitch behaviour in the past

You mean by altering iFlags? That has never been bug or something, this just fixes string handling. Have you tried that on vanilla or regamedll?

@rtxa
Copy link
Contributor

rtxa commented Oct 14, 2025

Something like that, I tried to change iWeight parameter from weapons so the weapon being switched when picked up is different, but I'll have to try anyway.
image

@dystopm
Copy link
Contributor Author

dystopm commented Oct 14, 2025

Something like that, I tried to change iWeight parameter from weapons so the weapon being switched when picked up is different, but I'll have to try anyway. image

It is important to determine if you tested that in vanilla or regamedll, because in vanilla contexto, ItemInfoArray is used globally on all guns, so an early hook is enough. On regamedll, you need to hook GetItemInfo in all cases (early/first call and in-game ones), because every weapon creation instances a per-entity copy of the ItemInfo structure. Or, you can just also hook weapon's Spawn at post, and change iFlags/iWeight with rg_set_iteminfo

MisterCalvin added a commit to MisterCalvin/amxmodx that referenced this pull request Nov 13, 2025
…strings in the engine's string pool rather than keeping raw pointers from native parameters. Raw pointers could be overwritten, leading to crashes or undefined behavior.

Native is currently useless without this fix. Applied from upstream repo: alliedmodders#1128
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