View Single Post
dirka_dirka
Veteran Member
Join Date: Nov 2009
Old 08-03-2010 , 01:20   Re: [L4D/L4D2] Character Select Menu (1.8)
Reply With Quote #268

decided to add this to my server, but didnt want all the infected junk so i removed it.. and while doing so, i noticed quite a few places to improve the code. its easier to just post it, so here is my changes:
CSM Lite v1.0.1
Changelog:
Code:
*    Version 1.0 - Changes from v1.8 of CSM
*        - Removed all infected csm bits - this is now CSM Lite
*        - Reduced # of calls on global convar lookups
*        - Added hooks to several convars (it is noted in config file which aren't)
*        - Improved the hook on change limit to account for already used changes
*        - Reduced the # of convars for determining how to change character to 1
*        - Removed the OnClientDisconnect() call.. not needed
*        - Removed IsClientConnected() check(s).. not needed
*        - Removed global checking of admin - changed sm_csm to either be a console command or an admin command
*            Uses generic admin flag for access
*        - Fixed the menu command to not allow console access
*            Also uses ReplyToCommand now to properly respond to invalid usage
*        - Replaced PlayerIsAlive() with sourcemod function IsPlayerAlive()
*            Was this because of the infected stuff I removed?..
*        - Removed a useless timer
*        - Removed several hooks to events that are not required
*        - Now resets limits to all players on enable convar change.
*        - Other code clean-up bits I forgot to mention.
*        - Changed the convars and config file to represent that this is the "lite" version (cmsl instead of csm)
*
*    Version 1.0.1
*        - Added a hook to the l4d1 character convar
*        - Added back in OnMapEnd for the above hook
*        - Attempt at fixing glitchy weapon
*        - Removed page 2 of the menu when there is 8 options to select from (eg: characters + models - l4d1)
*        - Expanded the announcement based upon the available options (change model, character, both).
*        - Added a message informing clients when they only have 5 or less changes left.. this has a #define if you want to tweak it.
*        - Fixed memory leak when menu is canceled.
*        - Added more precaching checks for the l4d1 survivors to prevent crashing
Convars (in config file plugin.l4d.csml):
Quote:
// ConVars for plugin "l4d_csml.smx"

// Changes access to the sm_csm command. 1 = Admin access only (generic flag). (restart plugin if this is changed)
// Minimum: "0" - Maximum: "1"
l4d_csml_admins_only "0"

// Toggles the announcement of sm_csm command availability. (restart plugin if this is changed)
// Minimum: "0" - Maximum: "1"
l4d_csml_announce "1"

// Sets the number of times clients can change their character per life/map.
// Minimum: "0"
l4d_csml_change_limit "9999"

// Toggles the CSM plugin functionality.
// Minimum: "0" - Maximum: "1"
l4d_csml_enable "1"

// Toggles access to L4D1 Survivors in L4D2. Does nothing if game is L4D1. (won't work until next OnMapStart())
// Minimum: "0" - Maximum: "1"
l4d_csml_l4d1_survivors "0"

// 1 = change to character (you become a clone). 2 = Re-skin (you are a doppleganger - look like the new character, but still yourself). 3 = Allow both 1 and 2.
// Minimum: "1" - Maximum: "3"
l4d_csml_model_access "1"
the equipped weapon still displays incorrectly sometimes, but not nearly as often as before.

** if anyone chooses to use this - remove the csm plugin (and config file).
Attached Files
File Type: sp Get Plugin or Get Source (l4d_csml.sp - 691 views - 19.5 KB)
dirka_dirka is offline