Commit Graph

25 Commits

Author SHA1 Message Date
Rain
3b6f18e3b4
Fix client validity checks
Unify the client validity checks with AddTargetsToMenuByAuthId checks
2023-10-15 22:05:25 +03:00
Rain
9b06d85771
Don't attempt to get auth string for unauthorized clients 2023-10-15 21:29:51 +03:00
Rain
67f5fcdb25
Refactor
In function "PrepareBan", use the global PlayerInfo struct array
members directly, instead of passing them as function parameters.
2023-10-15 20:58:56 +03:00
Rain
5ac6be0497
Use userid to find client when possible
Only fall back to authid lookup if userid no longer resolved to client index
2023-10-15 20:49:37 +03:00
Rain
f9ec38103a
Use auth strings when banning from menu
When an admin initiates a ban from a BaseBans GUI menu, track players by
their AuthId (SteamID) instead of userid, so that the admin is able to
target players who disconnect after that menu was constructed.

If the target player is still connected, use their userid to ban the
same as before this commit.

If the target has disconnected, write a ban using their stored AuthId
value, as with "sm_addban".

This commit also revertss the `(admin==0)` check from PrepareBan that
was mistakenly added by bf7212889b,
because it would prevent banning from server/RCON (client index 0).
2023-10-15 19:56:51 +03:00
Rain
bf7212889b Fix invalid client index in Basebans menu
Fix #1768

The `sm_admin`-triggered Menu flow for banning players is caching client
indices inside the basebans.sp `PlayerInfo` struct, and can then
incorrectly use them in the menu callback without checking for the
related client's UserId validity. This leads to bug #1768 occurring when
the ban target player disconnects from the server before the banning
admin could complete the banmenu UI flow.

Since the related menu callbacks can't rely on the cached client index,
I have removed the basebans.sp `PlayerInfo.banTarget` member entirely,
in favor of the `PlayerInfo.banTarget`, and instead call
`GetClientOfUserId(...)` to get & validate the target client index where
necessary. The `PrepareBan(...)` function has been refactored to take a
ban target UserId (instead of the target client index) accordingly.
2023-05-11 23:56:40 +03:00
Vladimir
f4ff2ad45a Add missing return values in plugins 2021-08-21 14:11:20 -07:00
Mustafa Enes AKDENİZ
9d49bbfaf0
Fixed unauthorized menu usages (#1374)
* Fixed unauthorized menu usages

Let's say we have kick flag but don't have admin menu flag.
When we type !kick, menu opens with a back button, when we click back button, we go parent menu without admin menu flag

* Update ban.sp
2020-11-05 11:34:00 +01:00
Michael Flaherty
c8f3035cb0
Introduce enum structs to core sm plugins 2018-12-15 13:51:03 -08:00
JoinedSenses
a5b22498ce Update to sm_ban, sm_kick, & sm_map in chat with no args to display menu (#838)
This change makes it so /kick, /ban, and /map open the already created methods for displaying their menus when there are no args.

The reason for the feature is to take advantage of menus that already exist and to make the commands easier to use.

The client == 0 check prevents them from opening if it was ran via rcon, sm_rcon, or server command. Client auth is also checked because its a registered admin command.

Usage params will display if client == 0 and args < min

For example, a moderator wants to change a map, instead of running through the admin menu, they can instead type just /map to display available maps and choose one.

If a mod wants to quickly ban or kick someone without having to either run through the admin menu or type it out, they could then type the corresponding commands with no args to open the menus.
2018-09-04 00:41:22 +01:00
ErikMinekus
d9fb0ba64e Update base plugins for transitional syntax (#507) 2016-05-11 10:44:58 -04:00
ErikMinekus
fb2117137e Update basebans and SQL admins plugins for transitional syntax (#484) 2016-04-27 09:34:22 -04:00
Nicholas Hastings
9e0dbfcf68 Fix inconsistencies with buffer sizes for player names.
Found any I could not using MAX_NAME_LENGTH and changed them to use it. I think that we should
increase MAX_NAME_LENGTH to 128 for CS:GO at some point as that's what it uses internally.
(Presumably to get the client's full multibyte name from Steam without truncation mid-codepoint which
can happen in other games. Steam's max is 32 characters if I remember correctly, but allows multibyte chars).
2015-06-03 22:40:43 -04:00
David Anderson
1328984e0b Update plugins for transitional methods. 2014-12-13 13:29:15 -08:00
David Anderson
f020b5682e Port KeyValues to the transitional syntax. 2014-11-08 15:54:40 -08:00
David Anderson
9c6c0f37ed Fix line-endings. 2014-10-30 21:25:23 -07:00
David Anderson
b97335ccb0 Port TopMenus to transitional syntax. 2014-10-30 19:20:33 -07:00
Matthias Kollek
fd9e657196 Add support for customizing ban reasons in basebans.sp (bug 5762, r=psychonic). 2013-08-28 13:17:17 -04:00
Asher Baker
8da56ff98c Allow access to unvalidated authstrings (bug 5587, r=psychonic). 2013-03-07 00:58:17 +00:00
Nicholas Hastings
978d7c0fca Fixed typo in basebans ban reason (bug 5188, r=me). 2011-12-06 14:42:30 -05:00
Fyren
d9f7e4c9e0 Added more detail to certain player-oriented menu titles (bug 2740, r=liam, a12=dvander). 2009-03-01 16:51:15 -05:00
Matt Schubert
d707ea0de5 Fixed amb1929 - Banning via console should now work properly
--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%402533
2008-09-12 20:36:53 +00:00
Matt Woodrow
eaccf6f90b Fixed amb1918 - Ban menu should compare userids, not client indexes
--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%402436
2008-08-07 23:16:16 +00:00
Scott Ehlert
c473d75d3d Added more missing svn:keywords properties to some files (this should be the last of them before I never have to do this again)
Moved sm_memtable files in sqlite extension to sdk directory (to be consistent with topmenus)
Some extension source files had an incorrect extension name in their headers

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%402037
2008-04-11 17:16:36 +00:00
Scott Ehlert
251cced1f8 Spring Cleaning, Part Ichi (1)
Various minor things done to project files
Updated sample extension project file and updated makefile to the new unified version (more changes likely on the way)
Updated regex project file and makefile

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401971
2008-03-30 07:00:22 +00:00