|
Junior Member
|
04-03-2011
, 04:15
Re: Hide Cvar Chat Print
|
#3
|
Quote:
Originally Posted by Ginxeng
Is here 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()
|
Ginxeng, BIG THX for this code!! It's what that i need!)))
|
|
|
|