Yeah, that's something with more functionalities, so I'm okay with it.
As per usual, firstly what I saw at a quick glance:
- In fileRead:
- strlen(szData) should be cached.
- You should add some checks for data validity inside configuration file. Like, when you get the color for message, it can be from 3 to 6, everything that is outside this is invalid. For this, use clamp:
PHP Code:
clamp(str_to_num(szValue), 3, 6)
How this works? Anything lower than 3 is converted to 3, everything bigger than 6 becomes 6, so you don't get invalid input. If between 3 and 6, value does not change. Apply such kind of checks on any kind of value, when it makes sense.
- You should also check if your szValue contains something and it's not empty:
PHP Code:
if(is_blank(szValue))
{
continue
}
Should be before if(g_eSettings[stgMsgEnable]).
- Checking if sound/sprite exists before passing it to precache would be nice. Use file_exists for that.
- In case of wrong configuration, make some logs to notify the user.
- When replacing the old sounds/sprites you could unprecache the new ones(just a matter to hook FM_PrecacheModel for sprites and check the sprite name, for sounds hook FM_PrecacheSound). I assume you know default names for sounds & sprites.
- In fwdSetModel, check if entity is valid before doing anything.
- In grenade_throw check if user is alive before retrieving team.
__________________