Monthly Target: $400 Donations: $602
 150% 

[SNIPPET] How to block the change notification of cvars with NOTIFY flag


Post New Thread Reply   
 
Thread Tools Display Modes
xioSlayer
Senior Member
Join Date: Apr 2011
Old 08-08-2011 , 06:04   Re: [SNIPPET] How to block the change notification of cvars with NOTIFY flag
Reply With Quote #11

I tried both methods and couldn't get the 'cvar changed' notifications to go away...

or does this only work on clients and not admins?
xioSlayer is offline
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 08-08-2011 , 06:09   Re: [SNIPPET] How to block the change notification of cvars with NOTIFY flag
Reply With Quote #12

Your code + how you change convars please.
__________________
Why reinvent the wheel ? Download smlib with over 350 useful functions.

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter than "Yes"
powered by Core i7 3770k | 32GB DDR3 1886Mhz | 2x Vertex4 SSD Raid0
berni is offline
xioSlayer
Senior Member
Join Date: Apr 2011
Old 08-08-2011 , 07:42   Re: [SNIPPET] How to block the change notification of cvars with NOTIFY flag
Reply With Quote #13

I just ended up editing basecommands.sp to never show cvar changes with sm_cvar.

That should work just fine for now I suppose.
xioSlayer is offline
RedSword
SourceMod Plugin Approver
Join Date: Mar 2006
Location: Quebec, Canada
Old 05-05-2012 , 19:29   Re: [SNIPPET] How to block the change notification of cvars with NOTIFY flag
Reply With Quote #14

Does anyone got it to work recently ?

Code:
public OnPluginStart()
{
	CreateConVar( "testcvar", "1", "Team Scramble version", FCVAR_PLUGIN );
	HookEvent("server_cvar", Event_ServerCvar, EventHookMode_Pre);
}
public Action:Event_ServerCvar(Handle:event, const String:name[], bool:dontBroadcast)
{
	decl String:cvarName[64];
	GetEventString(event, "cvarname", cvarName, sizeof(cvarName));
	PrintToChatAll(cvarName);

	if (StrEqual(cvarName, "testcvar")) {
		PrintToChatAll("string matched and handled");
		return Plugin_Handled;
	}
	
	return Plugin_Continue;
}
Doesn't work. Also it seems that the whole event isn't even triggered.

Is there another way ?
__________________
My plugins :
Red Maze
Afk Bomb
RAWR (per player/rounds Awp Restrict.)
Kill Assist
Be Medic

You can also Donate if you appreciate my work
RedSword is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Old 05-06-2012 , 02:20   Re: [SNIPPET] How to block the change notification of cvars with NOTIFY flag
Reply With Quote #15

Quote:
Originally Posted by RedSword View Post
Doesn't work. Also it seems that the whole event isn't even triggered.

Is there another way ?
I assume you need add this flag to your cvar. Like what have few other srcds cvars... (mp_startmoney, mp_flashlight, sv_cheats)
PHP Code:
FCVAR_NOTIFY /**< Notifies players when changed. */ 
Bacardi is offline
TnTSCS
SourceMod Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 05-06-2012 , 12:57   Re: [SNIPPET] How to block the change notification of cvars with NOTIFY flag
Reply With Quote #16

Saw this from KyleS (I think) a long time ago. This allows you to remove FCVAR_NOTIFY from Cvars

Might need some tweaking, but this is the gist:

PHP Code:

new String:cvars[][] = {"bot_quota""mp_startmoney""mp_flashlight""sv_cheats"};

public 
OnPluginStart()
{
    for(new 
0<sizeof(cvars); i++)
    {
        new 
Handle:CVarHandle FindConVar(cvars[i]);
        if (
CVarHandle != INVALID_HANDLE)
        {
            new 
flags;
            
flags GetConVarFlags(CVarHandle);
            
flags &= ~FCVAR_NOTIFY;
            
SetConVarFlags(CVarHandleflags);
            
CloseHandle(CVarHandle);
            return;
        }
        
ThrowError("Couldn't find %s. What sort of game is this?"cvars[i]);
        return;
    }

Or what about SetEventBroadcast(event, true);
__________________

Last edited by TnTSCS; 05-06-2012 at 13:05.
TnTSCS is offline
KyleS
SourceMod Plugin Approver
Join Date: Jul 2009
Location: Segmentation fault.
Old 05-06-2012 , 16:29   Re: [SNIPPET] How to block the change notification of cvars with NOTIFY flag
Reply With Quote #17

Quote:
Originally Posted by TnTSCS View Post
Saw this from KyleS (I think) a long time ago. This allows you to remove FCVAR_NOTIFY from Cvars

Might need some tweaking, but this is the gist:

PHP Code:

new String:cvars[][] = {"bot_quota""mp_startmoney""mp_flashlight""sv_cheats"};

public 
OnPluginStart()
{
    for(new 
0<sizeof(cvars); i++)
    {
        new 
Handle:CVarHandle FindConVar(cvars[i]);
        if (
CVarHandle != INVALID_HANDLE)
        {
            new 
flags;
            
flags GetConVarFlags(CVarHandle);
            
flags &= ~FCVAR_NOTIFY;
            
SetConVarFlags(CVarHandleflags);
            
CloseHandle(CVarHandle);
            return;
        }
        
ThrowError("Couldn't find %s. What sort of game is this?"cvars[i]);
        return;
    }

Or what about SetEventBroadcast(event, true);
If I did write that, my bad >.< That return should be a continue in the for.

Last edited by KyleS; 05-06-2012 at 16:29.
KyleS is online now
minimoney1
SourceMod Donor
Join Date: Dec 2010
Old 05-07-2012 , 05:18   Re: [SNIPPET] How to block the change notification of cvars with NOTIFY flag
Reply With Quote #18

Why not use the same method in the OT and use SetEventBroadcast?
minimoney1 is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 23:06.


Powered by vBulletin®
Copyright ©2000 - 2015, vBulletin Solutions, Inc.
Theme made by Freecode