Quote:
Originally Posted by Powerlord
It amuses me that your code only checks the first letter. So, if I were to write
Code:
sm_suppressconvar mp_restartgame do
it would disable mp_restartgame's reporting.
|
Actually, you're incorrect, doing so would remove mp_restartgame from the trie. However, if you were to use the shorthand
sm_suppressconvar mp_restartgame e , this would do what you're wanting. If it makes you happy I can totally check with StrEqual for disable and enable, as I do in some other plugins.
Quote:
Originally Posted by Powerlord
It seems like a lot more work to hook server_cvar and do it there rather than just stripping FCVAR_NOTIFY from the cvar, though...
|
As Asherkin pointed out in the
6th post, this causes
A2S_Rules to become out of sync. I recently rewrote every single plugin I use (Came to about 30~, I'm still writing), which is why I posted this instead of going the incorrect route and stripping FVCAR_NOTIFY. Sure it's easier, but no one wants to be the cause of breakage on a server.
Quote:
Originally Posted by Powerlord
Edit: Also, I'm disappointed to see a plugin approver reusing the same string buffer for three different arguments in the same function. While you could argue it's efficient, it's very hard to maintain later.
|
I don't see this growing. I also didn't see a point in wasting arrays. If functionality has been lost as a result of this, please let me know. Upon request I can also totally add a verbose syntax checker.
If you have any further questions or concerns in regards to this plugin please let me know.
EDIT: Oops!
Quote:
Originally Posted by Powerlord
Feel free to leave me any negative comments that you want. It doesn't change the fact that the method this plugin author references in this post is likely more efficient than the way this plugin works.
|
I didn't say that! What I had said was I had made a mistake with said Snippet. Even looking at it now, CloseHandle shouldn't be there either. However, it has no effect on ConVars (As far as I'm aware), so it isn't unsafe or anything.
If I were to rewrite the above hard coded snippet, it would look something like this.
PHP Code:
#pragma semicolon 1
#include <sourcemod>
public OnPluginStart()
{
new Handle:hCVarHandle = INVALID_HANDLE;
new iFlags;
new String:sCVars[][] = {"bot_quota", "mp_startmoney", "mp_flashlight", "sv_cheats"};
for(new i = 0; i < sizeof(sCVars); i++)
{
hCVarHandle = FindConVar(sCVars[i]);
if (hCVarHandle == INVALID_HANDLE)
{
LogError("Couldn't find %s. What sort of game is this?", sCVars[i]);
continue;
}
iFlags = GetConVarFlags(hCVarHandle);
if (!(iFlags & FCVAR_NOTIFY))
{
continue;
}
iFlags &= ~FCVAR_NOTIFY;
SetConVarFlags(hCVarHandle, iFlags);
}
}
There's nothing stopping another plugin from re-adding FCVAR_NOTIFY back to those convars, which is another reason why this is a bad method.