Commit Graph
2 Commits
Author SHA1 Message Date
A1m` a86fc4af91 Fix circular includes and include cleanup (#3)
* Fix circular includes and include cleanup

Fixed a bug where other *.h header files would include extension.h, which itself
was already included in those same headers, creating a circular dependency cycle.
This caused build errors and made compilation unpredictable.

To resolve this:
- Moved implementation-only includes to .cpp files where they are actually needed.
- Added forward declarations where possible to avoid pulling in unnecessary headers.
- Ensured extension.h only contains declarations that require full type definitions.

This improves build stability and compilation time.

* Clean up includes and fix build errors

- Replaced full includes with forward declarations where possible
- Moved implementation-only includes from .h to .cpp files
- Added missing includes for stdint.h and Steam interfaces
- This significantly reduces compilation time and prevents future dependency issues

* Switch to SourceMod SDK smsdk_ext instead of local copy
2026-07-13 21:43:05 +00:00
A1m` 07fc524d27 Fixed incorrect use of ReferenceToIndex, which caused some functions to be unstable during client connection. (#2)
While this function works well with the client indexes we pass in, as its name
suggests, we should essentially be passing player references, not client indexes.
The problem is that SourceMod looks for this player in the entity list, but they
might not be there when connecting, or they might be another client or a bot.

This makes the code unstable and confusing, and it works intermittently.
Steam doesn't care whether the player is in the entity list—it works with the
Steam ID. Using ReferenceToIndex here is fundamentally wrong and causes random
-1 errors, especially during OnClientConnect when the entity may not exist yet.

This commit replaces it with a direct client index lookup, which is correct and
reliable because params[1] is already a client index.
2026-07-13 21:39:04 +00:00