A lot of things are hard-coded into when they are called, and there's a lack of functions that, once made, could've helped make the code easier to read and write.
Seriously, look at this.
// In this function...
// public Handle:Menu_Top (iCid)
//set name for sur1 perk
&& (g_iStopping_enable==1 && g_iL4D_GameMode==0 // Could've put ALL these checks into ONE function.
|| g_iStopping_enable_sur==1 && g_iL4D_GameMode==1
|| g_iStopping_enable_vs==1 && g_iL4D_GameMode==2))
st_perk="Stopping Power"; // Could've used something like #define PERK_1_SUR1 "Stopping Power"
else if (g_iSur1[iCid]==2
&& (g_iDT_enable==1 && g_iL4D_GameMode==0 // And it all repeats these checks.
|| g_iDT_enable_sur==1 && g_iL4D_GameMode==1
|| g_iDT_enable_vs==1 && g_iL4D_GameMode==2))
st_perk="Double Tap"; // Once again, more repeating strings.
else if (g_iSur1[iCid]==3
&& (g_iSoH_enable==1 && g_iL4D_GameMode==0
|| g_iSoH_enable_sur==1 && g_iL4D_GameMode==1
|| g_iSoH_enable_vs==1 && g_iL4D_GameMode==2))
st_perk="Sleight of Hand";
else if (g_iSur1[iCid]==4
&& (g_iPyro_enable==1 && g_iL4D_GameMode==0
|| g_iPyro_enable_sur==1 && g_iL4D_GameMode==1
|| g_iPyro_enable_vs==1 && g_iL4D_GameMode==2))
// Worst part of this, is that this whole code tree is repeated and hard-coded for the other perk tiers. (Secondary, Tertiary)
// Could've used a function for all of this, that, in turn, would use other functions/consts to keep itself tidy, too, like the gamemode CVar checks.
// void Menu_Top_GetPerkName(int client, int tier, char copy_str, int str_size)
// bool IsPerkChosen(int client, int tier, int perk)
// bool IsPerkAllowed(int client, int tier, int perk)
I know, I know, it's an old and very complex plugin, but there was still stuff that could've been compressed into defines/consts and functions to save anyone who's trying to edit this a headache.
ATM (at the moment), I'm chalking this up to probably the age of how little easily-accessible info there was of Sourcemod, even though I've never experienced it.
This plugin is from 2009, last update from the author was on 2013, I think there is no point on reviving/talking about coding on "old" threads.
SM has some best practices for coding nowadays and good tutorials available, lots of plugins are written by people that don't know much about coding,
since I'm new here, I don't know the difficulties in the "old syntax" days or even about the lack of documentation and examples.
Some people only want to share their work to improve the game/community, if the plugin works, it is enough for most of "non-developers" admins.
No reason to extend about this in the following posts. I' not trying to be rude is just advice about getting to nowhere, the best place to talk about this kind of thing is in the "Scripting" or "Plugin/Gameplay Ideas and Requests" area.
Keep in mind that this plugin was originally made for L4D1 since it was released 3 months before L4D2 even came out. I would imagine the author didn't have much experience back then nor any examples to go off of like Marttt said. You're just preaching to a wall with dry paint at this point. The code sucks but that's nothing new for a plugin that will be 11 years old in less than 2 months.
1. Some old coders would come back who just kinda played both games for a few months and coded about the same amount of time to code and play L4D3 to pick up where Valve inevitably leaves holes in the game
2. Gradually L4D2 coding would be abandoned more than it is now
3. This probably happens regardless if Valve sticks with the source engine or decides to go with a different one. Last leaks/rumors hinted at an engine switch that I remember
Then again, getting asked for plugin editing, and, due to humbleness and being tempted along by them, agreed in exchange for a game, and which I realize t'was a mistake as I really didn't want to do plugin editing prompted me to make that stressed reply.
And that has lead me here, as of now.
I did well with the small plugin-editing he offered me, but I just moved on to the big ones like these, and I don't know whether to keep going and suffer for a game I inevitably don't have VR devices for, OR gather the courage to refuse the offer.
Even with the small plugins, I didn't really feel okay with it.
Now I understand why some people create these fine prints in their signatures: I am not available for plugin creating/editing. Don't ask me to get anything done.