Commit Graph
1214 Commits
Author SHA1 Message Date
Nicholas Hastings d9128d874b Switch from FloatCompare to < operator in vote plugins 2026-07-12 10:49:59 -04:00
SCP-076 0002aa228c clarify late load callbacks 2026-05-25 15:28:08 -04:00
David Anderson e87291362b Remove PushNull API from forwards/calls.
This appears to have no users, as it was not really possible to take
advantage of due to language constraints.
2026-05-24 13:25:34 -07:00
David Anderson 468760c902 Switch ForwardSys to use ICallable.
This removes a ton of tech debt and will improve Forward performance.
2026-05-17 15:22:58 -07:00
David Anderson 6739b0c280 Update SourcePawn. (#2454)
This modifies smn_sorting to use the new 2D array access API.
2026-05-03 09:52:31 -07:00
F1F88 707a6f5a00 Add format specifier "%lb" & "%lX" & "%lx" (#2448)
* Add format specifier "%lb" & "%lX" & "%lx"

* adjust brace style to match the rest of the file
2026-04-28 02:54:12 +00:00
c11164c4d9 Add KeyValues.Merge (#2184)
* Add KeyValues.Merge

* Disable for ep1

Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: Nicholas Hastings <[email protected]>
Co-authored-by: Copilot <[email protected]>
2026-04-28 01:58:49 +00:00
BerkeandNicholas Hastings 5d28ea6162 Fix the funcommands plugin resetting all players' color and transparency on round end (#2446)
* Add check for client status before resetting

* Get rid of unnecessary color reset on beacon remove

* Fix firebomb/timebomb resetting color when effect was not active

* Fix firebomb toggling wrong client's active status

---------

Co-authored-by: Nicholas Hastings <[email protected]>
2026-04-26 16:34:37 +00:00
SCP-076 94adc98ef5 Fix out-of-bounds crash in PluginIterator_Next (#2445)
* Fix OOB dereference in PluginIterator methodmap (#1880)

This prevents the native from returning true when the iterator has already reached the end() of the list, which previously led to a crash when accessing the Plugin property.

* Add defense-in-depth safeguards to CMMPluginIterator

* Update PluginIterator.Next() @error documentation

Reflect the new NativeError thrown when calling Next() on an exhausted iterator.
2026-04-25 17:11:28 +00:00
F1F88 817696358b Fixed an extra padding character in the negative integer formatting (#2443)
* Fixed an extra padding character in the negative integer formatting

* Add test script

* Add more test cases
2026-04-25 13:30:09 +00:00
David Anderson 80ca6f8cd4 Fix return value of AdminId.GetUsername. (#2438) 2026-04-10 08:31:15 -07:00
David Anderson feaeb6a0ea Fix return values of some natives. (#2437)
These are listed as returning void, but actually have non-void returns
in their implementation and pre-methodmap signatures.
2026-04-09 21:02:26 -07:00
Ayrton09 a3fb4dfe5e Add %lu & %li as format for int64 (#2421) 2026-04-09 15:58:35 +02:00
ambaca 337b755f34 Added a command to refresh mapchooser map list (#2431) 2026-04-09 15:55:55 +02:00
Benoist d5cc622227 Bump sp module + address fix (#2430) 2026-04-02 21:33:38 +02:00
Nicholas Hastings 0c9a476851 Remove the long-deprecated IsValidHandle from API 2026-03-24 20:49:43 -04:00
Benoist 155cdc318c Re-introduce Address as int64 and remove the opt-in (#2414) 2026-03-15 00:43:25 +01:00
Nicholas Hastings b492426a79 Revert "Make Address a int64 if <virtual_address> is included (#2407)"
This reverts commit 2b5554a21d.
2026-03-12 20:01:31 -04:00
Benoist 2b5554a21d Make Address a int64 if <virtual_address> is included (#2407) 2026-03-12 21:02:12 +01:00
David Anderson 617ee1c98e Update float.inc to work with the latest spcomp. (#2405) 2026-02-27 15:26:59 -08:00
Benoist 8907569dd8 Correct OpenFile filemode check (#2390) 2026-01-21 15:58:24 +01:00
Lukáš Č. 733e33e82a Fix a bug where ban reason is used as ban duration (#2383)
In basebans there are 3 commands for banning: banip,addban,ban
They have required arguments for ban duration and optional arguments for ban reason. However the functions that process the arguments do not properly validate the duration and if reason is provided instead of duration, the functions just convert that string into an integer and use it as the ban duration. This usually results in a permaban with an empty reason. This commit adds a loop for checking duration chars to be numeric before converting them to an int.
2026-01-01 13:01:24 +01:00
Benoist 6439769d50 Introduce Virtual Address (#2226)
In the current ongoing effort for sourcemod to fully support 64 bits, we are introducing "virtual address".

# Explanation

Because SourcePawn does not yet support a 64 bits-wide type it's been impossible for any plugins to hold addresses in regular 32-bits wide variable.

A first attempt at solving this issue was made in commit ce1a4dcac0 therein dubbed "PseudoAddress", however this turned out to be an unsatisfactory solution, as any 'high' address if offsetted could turn invalid (or outright be impossible to map).

This leaves us with three alternatives :
- New type
- Convert Address into a handle
- Virtual Address

A new type is the most destructive solution, as it entails breaking every single Address related method. While that solution is still not off the table, we're reserving it as the last attempt should this commit fail.

Converting into a handle type is a good compromise between a brand new type whilst also preserving the Address methods. However, this comes with two issues: the first being that you can no longer offset Address, the second is that we would require authors to free the handle type which will be very confusing. This will likely not be implemented.

# Virtual address

Under a reasonable assumption, we've noted that the average plugin is unlikely to play with more than 4 GB of memory; this shouldn't be too surprising as all valve games were once 32bits and therefore limited to 4GB. Assuming this stays mostly true and a plugin isn't interested with the mapped memory of lesser known modules (like soundlib or matlib), it is fair to assume plugins are unlikely to access more than 4GB of mapped memory. Working with this in mind, we map the memory the plugins are likely to access to our custom virtual address ranges (from 0 to 4Gb, the values of which can fit on 32bits variable). If any memory was missed and plugins were to try an access it later those ranges will be late-mapped to our virtual address ranges until we run out of them.

In order to use virtual addressing, whether on 32 bits or 64 bits. Plugins must now "#include <virtual_address>", as well as use the new SDKCall_VirtualAddress, SDKType_VirtualAddress, LoadAddressFromAddress & StoreAddressToAddress where it's appropriate to.
2025-11-13 13:23:13 +01:00
Alienmario 84f67fcd2d Add new options to ArrayList FindString, FindValue (#2216) 2025-11-08 17:03:42 +00:00
A1m` 98831a8667 Add the ability to work with the |this| parameter under dhooks callback (#2219) 2025-11-06 16:33:41 +01:00
Mikusch 351917be35 Add new TF_CUSTOM_* values (#2360) 2025-10-02 10:43:37 +02:00
FlaminSarge 512e7c37c1 Add TFHoliday_Summer (#2350)
Valve has updated this holiday this year to use 2025 dates (2025-07-16 to 2025-09-16) so semi-relevant to add
2025-08-22 13:14:41 +00:00
Nicholas Hastings 64a8c20243 Add missing in-game check in adminmenu 2025-06-01 13:54:41 -04:00
Mart 3b9d03e015 Update adt_stack.inc (#2313) 2025-04-27 18:03:49 -04:00
Nicholas Hastings 4d1e265a5c Fix entity output tests failing with server-only entities (#2276) 2025-04-27 11:20:30 -04:00
Nicholas Hastings ed2bb90ca5 Fix incorrect param order and docs on ArcTangent2 (fixes #2312) 2025-04-27 11:12:57 -04:00
Arcala 6faaefdc69 Related to #2148: (#2270)
* Added columns from the SELECT clause that were missing from the GROUP BY clause on line 529 that was causing the query to fail.
* Increased query buffer size on line 513 from 512 to 544 to accomodate the extra characters needed.
2025-02-20 04:27:53 +00:00
34e9605519 Add IntMap methodmap (#2018)
* Add new IntHashMap and IntMap natives

This is a continuation of #579.

[HashMap] Adds new IntHashMap and IntMap natives.

This patch makes the following changes
  * Refactors StringHashMap to a generic HashMap template
  * Adds the IntHashMap class
  * Adds new IntMap natives
  * Adds IntMap tests to the tries test suite

[HashMap] Reverted rename of CharsAndLength

[HashMap] Use more descriptive template names

[HashMap] Removed old-style natives

[HashMap] Removed IntHash class

[HashMap] Reverted some search & replace errors

Co-authored-by: Geoffrey McRae <[email protected]>

* Fix spelling mistake + include

* Fix tries test

* Update tests with clone + ContainsKey

---------

Co-authored-by: Geoffrey McRae <[email protected]>
Co-authored-by: Nicholas Hastings <[email protected]>
2024-10-31 23:35:41 +00:00
Nick Hastings 8acb60947c Bump version 2024-10-20 12:57:26 -04:00
Nick Hastings 80dfa1cc77 Add Clone to Handle methodmap 2024-10-19 13:20:20 -04:00
Mikusch dd3409bb9b Fix unused parameter warning in TF2_SetPlayerClass (#2176) 2024-08-04 16:17:42 +02:00
BenoistandKenzzer 11d3cf94f7 Add GetFilePermissions (#2177)
Co-authored-by: Kenzzer <[email protected]>
2024-06-08 14:17:50 +00:00
Nick Hastings 0e4b1ca4cf Revert "Update sourcepawn submodule (#2146)"
This reverts commit 1bcc5b8a44.
2024-06-08 09:26:13 -04:00
suza 1bcc5b8a44 Update sourcepawn submodule (#2146)
Update SourcePawn and AMTL.
2024-06-04 16:24:22 -07:00
ojlandersandOdin Landers e60c672485 Add OnServerHibernationUpdate forward (closes #1483) (#2151)
* Add OnServerHibernationUpdate forward (closes #1483)

* Clarify hibernation state

* make it 2 forwards instead of 1

---------

Co-authored-by: Odin Landers <[email protected]>
2024-05-07 01:44:56 +00:00
Oliver John HitchcockandKyle Sanderson f9ad35badf Stop EntRefToEntIndex returning garbage if a bad parameter is passed (#1323)
* Stop EntRefToEntIndex returning garbage if a bad parameter is passed

Seen multiple bad usage of this function that works only because whatever was passed in was returned as it wasnt an entity reference.
This code should have worked and would be expected to have returned something invalid but instead the the input was returned which allowed the code to work when really it is bad code.
See for one such case https://discordapp.com/channels/335290997317697536/335290997317697536/736518488314871868

* Update documentation of EntRefToEntIndex

Added the error text saying what shall be returned when a invalid parameter is passed.

* Validate entity index instead of just returning INVALID_EHANDLE_INDEX

Not sure if it needs this much validation but this just mirrors how IsValidEntity works, so the entity index returned should be valid else INVALID_EHANDLE_INDEX is returned.

* EntRefToEntIndex improve doc comments to better represent functionality

---------

Co-authored-by: Kyle Sanderson <[email protected]>
2024-04-25 23:19:04 +00:00
Peak 5c507cc35c Implement File.Size (#2131)
* Implement file size method for already open files

* Switch from fseek/ftell to fileno/fstat size reading
2024-04-13 18:14:52 +00:00
Ryan Blackham 7bb9da2a26 Fixed typo in reservedslots.sp (#2109) 2024-02-01 10:36:28 +01:00
NotnHeavy 7e29f22f8f Fix typo in ArrayList.Clone docs (#2098)
very useful update of: grammar in comment
2023-12-22 20:35:26 +01:00
Ivan Zaitsev ab6b45b81c Add void function prototypes to NativeCall and MenuHandler (#2081)
* Add void prototype to NativeCall typeset

`void` prototype can be used for simple natives which don't return any value.
This is done to silence compiler warnings 209 (`function has explicit 'int' tag but does not return a value`) and 242 (`function "NativeCallback" should return an explicit value`).

* Make MenuHandler into typeset and add void prototype

This can be used for basic menu handlers that don't return modified item styles and don't redraw menu items.
2023-12-18 23:57:58 +00:00
bauxite f2ca671d1f Update basetriggers.sp for Dystopia compatibility (#2075)
* Update basetriggers.sp for Dystopia compatibility

Dystopia has a built-in command called nextmap which breaks due to the Sourcemod nextmap command. This modification is intended to restore Dystopia compatibility.

* Update basetriggers.sp

* Update basetriggers.sp

* Update basetriggers.sp

* Update basetriggers.sp
2023-11-06 16:10:46 +00:00
sappho d4da21b07f Add more context to Format etc documentation (#2079) 2023-11-06 16:07:00 +00:00
David Anderson 7bfd5e521e Update SourcePawn.
This updates float.inc and smn_float.cpp to compensate for alias
removal.
2023-11-03 17:46:48 -10:00
David Anderson 060c832f89 Update SourcePawn.
This brings in a few breaking changes.

One, INVALID_FUNCTION is now 0 instead of -1. This is long overdue.
Plugins should transparently work except in two cases:

  1. Third-party extensions that have a hardcoded test for -1 will no
     longer work. A new API has been provided for this,
     GetFunctionByIdOrNull.
  2. If a plugin "framework" uses INVALID_FUNCTION anywhere in its
     exported API, then all plugins using that framework need to be
     recompiled together, so they agree on the value of
     INVALID_FUNCTION.

Hopefully the damage here is minimal. The core plugin version has been
bumped to 7 to try and limit conflicts.

Second, braceless functions are no longer supported. There wasn't really
any way around this and it's better to bite the bullet now. This affects
source compatibility, but not binary compatibility.

Third, the "using" keyword is no longer implemented. SourceMod now has a
Handle methodmap again. Plugins compiled against this new methodmap will
require a "Handle.~Handle" native, which 1.12 now provides.
2023-11-02 18:38:30 -10:00
Rain 8938a29904 Ignore chat triggers for interactive ban reason (#2067)
* Ignore chat triggers for interactive ban reason

If the admin types a chat trigger for a command while BaseBans is
waiting for them to type a ban reason, don't treat that message as the
ban reason.

This fixes a problem where the admin decides to cancel their ban with
"!abortban", "/abortban" etc, but ends up accidentally banning the
player with the ban reason "!abortban" (or by attempting to access any
other command via a chat trigger before typing the ban reason).

* Optimize

Check if we're actually waiting for chat reason before calling the native
2023-10-16 19:43:00 +02:00