Raised This Month: $ Target: $400
 0% 

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


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 12-05-2010 , 20:40   [SNIPPET] How to block the change notification of cvars with NOTIFY flag
Reply With Quote #1

Since the notify=false parameter of the SetConVar Functions doesn't work anymore for orangebox/L4D games, and because it's often necessary to set the NOFITY flag for certain cvars that need to be public, here is how to block the notifcations that normally automatically goes th the clients when such a ConVar gets changed.



PHP Code:
public OnPluginStart() {
     
HookEvent("server_cvar"Event_ServerCvarEventHookMode_Pre);
}

public 
Action:Event_ServerCvar(Handle:event, const String:name[], bool:dontBroadcast) { 
Block all cvar notifications:

PHP Code:
    return Plugin_Handled
or block all cvar notifications of my plugin only starting with "mycvarprefix_":

PHP Code:
    decl String:cvarName[64];
    
GetEventString(event"cvarname"cvarNamesizeof(cvarName));

    if (
StrContains(cvarName"mycvarprefix_") == 0) {
        return 
Plugin_Handled;
    }

    return 
Plugin_Continue
PHP Code:

__________________
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

Last edited by berni; 03-16-2011 at 06:54.
berni is offline
 



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 21:47.


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