Commit Graph

1182 Commits

Author SHA1 Message Date
BotoX
850ee60a18 Add GetClientIClient native. 2024-06-09 17:39:34 +02:00
Obuss
7cd130904b Logging changes to various base plugins. 2024-06-09 17:39:30 +02:00
BotoX
19019d3a4b Extend function calling API for natives and allow catching exceptions.
Change sourcepawn url.
2024-06-09 17:34:33 +02:00
BotoX
1d999c3984 Added hack to make plugins open a menu with all possible targets on ReplyToTargetError COMMAND_TARGET_AMBIGUOUS.
Explanation:
There are two clients in the server, one named gene, the other one "Ene ~special characters~".
An admin issues "sm_slay Ene" and gets following error message: More than one client matched the given pattern.
What this hack will do is: Use GetCmdArg(0, ...); to get the command name "sm_slay".
Use GetCmdArgString(...); to get the arguments supplied to the command.
Use GetLastProcessTargetString(...); (which was implemented in this commit) to retrieve the arguments that were passed to the last ProcessTargetString call.
It will then pass this data to the DynamicTargeting plugin through its AmbiguousMenu native.
The plugin will open up a menu on the client and list all targets which match the pattern that was supplied to ProcessTargetString.
If the client selects a menu entry, FakeClientCommand will be used to re-execute the command with the correct target.
2024-06-09 17:33:16 +02:00
Benoist
11d3cf94f7
Add GetFilePermissions (#2177)
Co-authored-by: Kenzzer <kenzzer@users.noreply.github.com>
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
ojlanders
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 <ojl9576@rit.edu>
2024-05-07 01:44:56 +00:00
Oliver John Hitchcock
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 <kyle.leet@gmail.com>
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
peace-maker
e88e9342ef
Update SourcePawn (#2052)
* Update SourcePawn

* Fix using SourceMod version as SourcePawn version
2023-10-06 22:47:11 +02:00
Kit o' Rifty
07d928dbad
Fix sound flags enumeration (#2040)
* Fix sound flags

* Change to bit shifts like in SDK
2023-09-27 17:03:03 +02:00
Boink
a402b3cceb
Prevent commands from being run on the client with sm_play (#1832)
* Prevent command injection

* Empty to commit to try to kick CI.

* Improve filename sanitisation

---------

Co-authored-by: Fyren <fyrenmoo@gmail.com>
2023-09-27 16:51:07 +02:00
Mikusch
29694ec13b
Add block parameter to various ArrayList functions (#1656)
* Add block parameter to FindString

* Add block parameter for GetString & GetArray

* Fix buffer overflow issues

* Fix wrong return

* Add size parameter to SetArrayString
2023-09-27 16:05:43 +02:00
Mikusch
1e8db957bf
Add more functions to ArrayStack (#2019)
* Add more functions to ArrayStack

* Make formatting consistent with other functions

* Don't remove the element for TopArray

* Replace 4 with sizeof(cell_t)
2023-09-27 15:43:04 +02:00
throwaway47777
79787cb868
Fix admin-flatfile.sp includes (#2043)
* Move admin-flatfile to plugins dir

* Fix admin-flatfile sp includes
2023-09-13 18:28:35 +02:00
Nicholas Hastings
8d60a46358
Revert "Update sourcepawn (#2011)" (#2032)
This reverts commit cb8541548b.
2023-07-29 16:01:25 +00:00
Nick Hastings
4c376cbcb7 Update PLAPI version for NormalSHook signature change (MAXPLAYERS increase) 2023-07-27 08:15:02 -04:00
sappho
d83c498a8f
[1.12] update maxplayers define for 07-25-23 tf2 update (#2026) 2023-07-26 20:13:31 +00:00
Mikusch
531b053096
TF2: Add TFCond_ImmuneToPushback condition (#2023) 2023-07-26 02:10:08 +00:00
rtldg
7170a8f11c
Fix typo in DHookRaw docs (#2020) 2023-07-21 09:58:14 +02:00
peace-maker
2ef874dbc9
Run basic native tests using hl2sdk-mock in CI (#2015)
This tests the sorting.inc API similar to the existing test plugin in
the plugins/testsuite folder. Tests fail if the srcds output contains "FAIL".
2023-07-12 22:58:28 +02:00
peace-maker
cb8541548b
Update sourcepawn (#2011)
* Update sourcepawn

* Remove #pragma rational Float
2023-07-12 22:55:40 +02:00
Corey D
5addaffa56
Add ParseTime (strptime) native (#1697)
* Add GetTimeStamp (strptime) native

* Fix description

* Fix typos

* Fix issues

* Rewrite ParseTime

* Fix docstrings

* Fix ParseTime

* Clarify docs
2023-07-04 13:42:45 +02:00
Erin
f40ae82df4
Clear sm_nextmap so we don't get stuck in a loop (#1545)
* Pure C++ solution

* Pure SourcePawn solution
2023-07-03 20:48:01 +02:00
Dysphie
97f2fc9d7f
Increase Cookie.GetInt/SetInt buffer size (#1995)
Current implementation does not account for negative sign or null term
2023-04-22 01:19:36 -07:00
Corey D
50b4ad4e11
Make KeyValues.Rewind traversal-stack clearing optional (#1993) 2023-04-17 13:10:02 +01:00
XeroX
f66a904c31
Update SDKCall documentation for string return type (#1961)
* Update SDKCall return information

This adds the information that if the return value is a string then SDKCall will return the number of bytes written.

* Update description

* Add info if the string is null
2023-04-02 23:46:53 +02:00
Michael
a28c3cac9b
cstrike.csgo: Add native to retrieve loadout slot of weapon (#1241)
* Add native to retrieve loadout slot of weapon

* Mention the native is for CS:GO only

---------

Co-authored-by: Peace-Maker <peace-maker@wcfan.de>
2023-03-29 21:27:45 -07:00
fakuivan
6670b93cc6
keyvalues: adjust KvSavePosition return value to implementation (#757)
The current ``KvSavePosition`` definition does not reflect the behaviour seen in [core/smn_keyvalues.cpp#L973-L981](404e96ad45/core/smn_keyvalues.cpp (L973-L981)). This can cause problems if some procedure on sp expects ``KvSavePosition`` to always add one node to the stack, no matter if there is no higher node.

Co-authored-by: peace-maker <peace-maker@wcfan.de>
2023-03-29 21:06:36 -07:00
Corey D
c5087d7a39
database: flip to recursive_mutex to allow nested locks (#1937)
* Fix crash from db locking

* Change db lock to use recursive_mutex
2023-03-29 20:03:03 -07:00
FlaminSarge
5ba9816377
nominations: implement map not in pool phrase (#597)
New English text is “Map ‘%s’ is not in the nominations pool.”
2023-03-29 18:39:54 -07:00
peace-maker
008fbf78a5
Cleanup the translation files (#1962)
* Remove obsolete slapslay.phrases.txt

That plugin isn't in the stock arsenal since forever.

* Remove "Dead Player Rename" phrase

Unused since #313

* Remove nominations phrases from rockthevote

Those phrases were moved to their own nominations.phrases.txt

* Remove "Next Map" phrase from nextmap.phrases.txt

It was moved to basetriggers.phrases.txt

* Remove unused phrases from common.phrases.txt

Only "Slapped Player" was moved to funvotes.phrases.txt

* Delete empty phrase files

* Fix workflow python version selection

3.10 would select Python 3.1 and fail

* Deduplicate "Please select a map" phrase

Only keep it in the plugin.basecommands.txt file and remove it from the basevotes.phrases.txt.

Both plugins using the phrase load the basecommands phrases.

* Allow manual triggering of translations action

* Actually use the nextmap phrases

They were never referenced in the plugin. The "ago" phrase doesn't work the way it is and needs more rethinking.
2023-03-30 01:13:40 +02:00
Mikusch
5539484f92
Add support for float modulo operator (#1953) 2023-03-19 16:19:42 +00:00
Alienmario
850f96b986
Allow void return type in timer callbacks (#1916) 2023-03-02 21:28:42 -08:00
Impact
1f5b735dbd
Add note about automatic unhook (#1910) 2023-01-22 10:23:40 +01:00
Rushaway
221d34f809
fix: Print full map name in Log instead of args (#1907) 2023-01-15 13:32:41 -05:00
Nicholas Hastings
8922ed0c5d
Add TE_WriteEnt and TE_ReadEnt natives to SDKTools. (#1905) 2023-01-14 14:48:05 +00:00
ambaca
8f7a1641fc
Friendly Fire support L4D(2) games. (#1530)
Support L4D(2) Friendly Fire In Basetriggers.sp #1522

- Games have cvar mp_friendlyfire min. and max. bounds set to 1
- Removing mp_friendlyfire lower bound and set to 0, cvar have no purpose on friendly fire damage.
- FF works from z_difficulty and each difficult level have FF damage ration cvars:
survivor_friendly_fire_factor_easy
survivor_friendly_fire_factor_normal
survivor_friendly_fire_factor_hard
survivor_friendly_fire_factor_expert

Update added PRINT_TO_ things from previous update.

Co-authored-by: Bacardi <>
2022-12-29 14:00:58 +00:00
nosoop
2130c60fd9
Implement raw entity handle accessors (#1830)
* Implement raw entity handle accessors

* Fix FromPseudoAddress calls on 64-bit

* fixup: Remove unnecessary ent deref

* fixup: Correct param index in thrown error
2022-12-29 03:57:47 +00:00
peace-maker
4320d7b17a
Get sdktools and sdkhooks/dhooks to load on hl2sdk-mock (#1892)
* Build SDKTools for hl2sdk-mock

* Fix loading of extensions using advanced naming scheme for hl2sdk-mock

* Fix error on missing sv_visiblemaxplayers convar

* Build SDKHooks for hl2sdk-mock

* Fix x86_64 SourcePawn VM filename

* SDKHooks: Ignore missing IEntityListeners list in hl2sdk-mock
2022-12-22 18:39:12 +01:00
Benoist
f8349e846a
Fix SetEntityHealth to support 'any' entities (#1846)
Co-authored-by: Kenzzer <kenzzer@users.noreply.github.com>
2022-12-20 22:07:57 +00:00