View Single Post
Author Message
Ginxeng
Senior Member
Join Date: Nov 2009
Location: Timber Doodle
Old 04-02-2011 , 18:26   Hide Cvar Chat Print
Reply With Quote #1

Is there a plugin to hide cvar printed the chat? For example lets say I do sv_alltalk 1, I dont want to server to print in the chat that it was changed. Someone gave me this a while ago
Code:
new Handle:p_Notify = INVALID_HANDLE;
 
public OnPluginStart ()
{
p_Notify = CreateConVar("sm_core_notify", "sv_gravity, sv_airaccelerate, sv_wateraccelerate, sv_alltalk, mp_limitteams", "Setting: List of cvars, comma limited, to strip notifications from.");
}
 
public OnConfigsExecuted()
{
StripNotifyCvars();
}
 
StripNotifyCvars()
{
decl String:cvars[1024], String:ncvars[16][64];
GetConVarString(p_Notify, cvars, sizeof(cvars));
if(strcmp(cvars, "", false)!=0)
{
    new cvarc = ExplodeString(cvars, ", ", ncvars, 16, 64);
    for(new i=0;i<cvarc;i++)
    {
TrimString(ncvars[i]);
        new Handle:cvar = FindConVar(ncvars[i]);
        new flags = GetConVarFlags(cvar);
flags &= ~FCVAR_NOTIFY;
SetConVarFlags(cvar, flags);
    }
}
} 
It does the job but it gives me errors and I want to fix that.

Code:
[SM] Native "GetConVarFlags" reported: Invalid convar handle 0 (error 4)
Code:
[SM] Displaying call stack trace for plugin "no_print.smx":
[SM] [0] Line 24, /groups/sourcemod/upload_tmp/text5FE4tU.sp::StripNotifyCvars()
[SM] [1] Line 10, /groups/sourcemod/upload_tmp/text5FE4tU.sp::OnConfigsExecuted()
__________________

Last edited by Ginxeng; 04-03-2011 at 16:18.
Ginxeng is offline
Send a message via AIM to Ginxeng Send a message via MSN to Ginxeng Send a message via Skype™ to Ginxeng