#define IsPlayer(%1) (1 <= %1 <= MAX_PLAYERS)
You should ideally check against get_maxplayers
(cached in a global variable).
returns -1 on failure so you should probably check that before executing the forward.
at line 223
While this is functionally correct it is hard to read and understand. You should explicitly check if g_iSaveType != NVAULT. It's easier to understand what is going on(freeing handles based on the saving system that's currently used).
new szConfigsDir, szFileName
I would suggest increasing the size to 256, just in case the configs dir path is changed(to avoid an index out of bounds error).
It is better to use while(!fgets(...)) instead of feof. This is because you can't absolutely be sure there is no more data unless you try to read it and see the file is empty. Otherwise, things could change and cause an error. However, it is not likely to happen in a server where the file is usually only processed by the server.
if(szData == '[')
(line 258 ) you can add continue to skip the line, after the section counter is increased. Then you can remove the checks for '[' from the switch.
7. In TRACKS_SECTION
you may want to do ArrayPushArray
only if the file exists. Otherwise, you are storing invalid data.
8. Regarding strtok2
, if this is the only 1.8.3+ specific function then you can replace it with strtok, do not use it for trimming, and manually call trim
on left and right. It would be great if the plugin would support amxx 1.8.2 as well.
9. if(szValue == EOS || !szValue)
This is redundant, both conditions check the same thing. EOS is basically 0: if the first character in a string is 0(EOS) then the string is empty. if(szValue == EOS)
10. if(0 <= str_to_num(szValue) <= 2)
You have definitions, use them. NVAULT is 0, SQL_LITE is 2. Same thing below: g_iSaveType = 0
should be g_iSaveType = NVAULT
str_to_num(szValue) == 1 ? g_bAuthData == true : g_bAuthData == false
This is not right. Did you mean to use "=" instead of "=="? Otherwise, this line does nothing, it just checks if the value is 1 and then checks if g_bAuthData is true or false, without actually doing anything.
g_iSaveInstant = str_to_num(szValue)
Should you validate szValue before(negative numbers, something else besides 0 and 1)? If not valid then default to either 0 or 1, whichever value you think is best.
should be inside if(iFile)
check, if the handle is not valid then nothing needs to be closed.
starts at 0 and can only increase. What is the point of checking if(iTry)?
15. For the record, I'm not a fan of caching the player name in a global variable because you have to account for name changing(using ClientUserInfoChanged). Calling get_user_name
directly isn't going to cause any performance issues and trying to keep the cache up to date can be a pain in the ass and it's more error-prone(as is the case here since if the player is going to change his name your code will fail).
I think it's enough for now.