[SourceMod] Model Reservation 1.0.1.1

This Section is all about Coding in C/C++ / Lua / SourcePawn for now...
Post Reply
User avatar
TESLA-X4
Former Developer
Former Developer
Posts: 570
Joined: Wed Jul 01, 2009 3:26 pm
Location: $Recycle.Bin

[SourceMod] Model Reservation 1.0.1.1

Post by TESLA-X4 »

Just thought I'd throw this together for the sake of anyone who wanted to restrict the use of certain models to a particular group of people, for whatever reason. Basically, the use of certain models can be restricted to a list of Steam IDs (on a per-model basis). Any player not in the whitelist for that model will be forced to switch back to a default model again and issued a warning (changeable to a kick or ban via a ConVar). Adding or removing of reserved models can be done via commands or by hand-editing the config file (not recommended unless you've studied the source to see the format of the file). Models can be associated with non-admin players, but this must first be done by an admin with appropriate privileges.

Configuration:
/sourcemod/data/modelreserve.txt: Automatically generated on initial plugin load, use it to configure which models to reserve, then reload it with the console command 'sm_modelreservation_reload'. (Keyvalues format, only edit this if you know what you're doing!)

Commands & Console Variables:
sm_reservemodel - Reserves your current model for use by yourself (requires 'Cheats' admin flag).
sm_reservemodelid <Steam ID> <full model path> - Reserves the specified model for use by the specified Steam ID (requires both 'Cheats' and 'Rcon' admin flag).
sm_unreservemodel <model path as listed in keyvalues (server only)> - This is a dynamic command that operates differently depending on whether it is entered into the server console or a client's console. Server console: Unreserves the specified model from all clients, making it public again. Client console: Unreserves your current model from only yourself, others reserving the model remain unaffected. (requires 'Cheats' admin flag).
sm_unreservemodelid <Steam ID> <full model path> - Unreserves the specified model from the specified Steam ID (requires both 'Cheats' and 'Rcon' admin flag).

sm_modelreservation_reload
sm_modelreserve_reload
sm_reservemodel_reload
Aliased server-side console commands to force a reload of the Model Reservation config file.

sm_modelreservation_action - Action to perform on a client who attempts to use a reserved model unsuccessfully. (0 = kick, 1 = ban), defaults to 0.
sm_modelreservation_maxstrikes - Number of strikes a player can get before the action specified by 'sm_modelreservation_action' is performed (-1 to disable), defaults to 5.
sm_modelreservation_banduration - Sets the ban duration for offending players (only applicable if 'sm_modelreservation_action' is 2, use 0 for a permanent ban but, really, that's unnecessarily harsh!), defaults to 5.

Dependencies:
None.

Installation:
- Place modelreservation.smx into the /sourcemod/plugins directory.
- Place modelreservation.phrases.txt into the /sourcemod/translations directory. (Don't forget to install the translations for other languages as well!)

Changelog:

Code: Select all

Version 1.0.1.1
-----------------------
+ Added exploit fix for illegal model changing

Version 1.0.1
-----------------------
! Fixed players potentially getting set to default models of the incorrect gender upon denial
! Fixed incorrect command description for command sm_unreservemodelid
! Removed 'Rcon' admin flag requirement for command sm_unreservemodel
! Changed command sm_unreservemodel to work in two modes:
  - Entered into the server console, it requires a model to be specified (and removes ALL Steam ID entries for that model, similar to how it worked back in 1.0.0)
  - Entered into a client's console, it always uses the client's current model instead (no support for manual model specification)
- Removed 'warn' option from ConVar sm_modelreservation_action (set sm_modelreservation_maxstrikes to -1 instead for the same effect)
+ Added 'strikes' system, controlled by a new ConVar sm_modelreservation_maxstrikes
+ Added new command aliases sm_modelreserve_reload and sm_reservemodel_reload
+ Added Japanese translations (thanks, Snowman7!)

Version 1.0.0
-----------------------
Initial release
Notes:
In case you haven't already noticed, this is a plugin for server operators, not clients.

Known Bugs/Limitations/Future Improvements:
- Only model paths that begin with models/player/ are supported.
- An alternate mode to permit non-admins to reserve their model (and only if they can actually use it; might not be implemented due to concerns regarding abuse).
- Per-model configuration of actions to be taken on clients who attempt to use the model unsuccessfully.

Download:
Get Plugin or Get Source
Browse all released versions here.

P.S.: I understand that this plugin may be rather controversial, therefore, please feel free to delete this thread if it is deemed inappropriate. Guess that's not necessary, after all. Image
Last edited by TESLA-X4 on Fri Jul 29, 2011 10:35 am, edited 6 times in total.
Reason: 1.0.1.1 Update
Apparently, Valve can't make games beyond the number 2.
I think the only time we'll get a Source SDK code update is when it starts having purchasable hats integrated, i.e. hatconomy.

Please do not make assumptions you are not knowledgeable enough to make - that just backfires on yourself.
Tick me off, and I'll be sure to give you the golden treatment. Haven't you heard? Silence is golden.
MaestraFénix
Team Member
Team Member
Posts: 2470
Joined: Mon May 10, 2010 11:50 am
Location: Spain
Contact:

Re: [SourceMod] Model Reservation 1.0.0

Post by MaestraFénix »

Perfect. This will end the controversy that i have with a model. Thanks Tesla :3
Click on my photo to add me into your friends in Steam
Image
Steam photos | Steam videos

Image
User avatar
Baddtraxx
npc_helicopter
npc_helicopter
Posts: 826
Joined: Sun Nov 28, 2010 6:55 pm
Location: Gensokyo
Contact:

Re: [SourceMod] Model Reservation 1.0.0

Post by Baddtraxx »

interesting o_ o
Image
Image
User avatar
Shana
Lead Developer
Lead Developer
Posts: 2971
Joined: Tue Aug 29, 2006 8:12 pm
Location: Germany
Contact:

Re: [SourceMod] Model Reservation 1.0.0

Post by Shana »

TESLA-X4 wrote: P.S.: I understand that this plugin may be rather controversial, therefore, please feel free to delete this thread if it is deemed inappropriate.
No, this is perfect, thanks!
User avatar
Keychain
Obsidian Veteran
Obsidian Veteran
Posts: 1511
Joined: Sun Aug 17, 2008 5:09 am
Location: Florida, United States
Contact:

Re: [SourceMod] Model Reservation 1.0.0

Post by Keychain »

This is more useful than you think it is. Trust me on this one.
User avatar
TESLA-X4
Former Developer
Former Developer
Posts: 570
Joined: Wed Jul 01, 2009 3:26 pm
Location: $Recycle.Bin

Re: [SourceMod] Model Reservation 1.0.1

Post by TESLA-X4 »

The plugin has been updated, please see the first post for details.
Apparently, Valve can't make games beyond the number 2.
I think the only time we'll get a Source SDK code update is when it starts having purchasable hats integrated, i.e. hatconomy.

Please do not make assumptions you are not knowledgeable enough to make - that just backfires on yourself.
Tick me off, and I'll be sure to give you the golden treatment. Haven't you heard? Silence is golden.
Post Reply