Raised This Month: $ Target: $400
 0% 

How to block 'server cvars x changed'


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SilentBr
Veteran Member
Join Date: Jan 2009
Old 04-06-2014 , 08:30   How to block 'server cvars x changed'
Reply With Quote #1

Hi

I've done a plugin to change another plugin cvars according with connected players. The problem is every time my plugin change the cvars show in chat "server cvars x changed". Is there a way to not show?

Thank you
SilentBr is offline
Dr. Greg House
Professional Troll,
Part-Time Asshole
Join Date: Jun 2010
Old 04-06-2014 , 09:00   Re: How to block 'server cvars x changed'
Reply With Quote #2

http://docs.sourcemod.net/api/index....d=show&id=483&
__________________
Santa or Satan?

Watch out when you're paying people for private requests! Most stuff already exists and you can hardly assess the quality of what you'll get, and if it's worth the money.
Dr. Greg House is offline
h3bus
AlliedModders Donor
Join Date: Nov 2013
Old 04-06-2014 , 09:14   Re: How to block 'server cvars x changed'
Reply With Quote #3

On CS:GO at least you need to remove the NOTIFY flag.
I didn't manage to have the replicate/notify parameters working in the original function.

PHP Code:
stock cvars_SetConVarStringUnNotified(Handle:cvarHandle, const String:cvarValue[], bool:replicate=truebool:notify=false)
{
    
decl flagsoldFlags;
    
    
oldFlags GetConVarFlags(cvarHandle);
    
flags oldFlags;
    if(!
notify)
        
flags flags & ~FCVAR_NOTIFY;
    if(!
replicate)
        
flags flags & ~FCVAR_REPLICATED;
    
    
SetConVarFlags(cvarHandleflags);
    
    
SetConVarString(cvarHandlecvarValuereplicatenotify);
    
    
SetConVarFlags(cvarHandleoldFlags);


Last edited by h3bus; 04-06-2014 at 09:16.
h3bus is offline
SilentBr
Veteran Member
Join Date: Jan 2009
Old 04-06-2014 , 10:45   Re: How to block 'server cvars x changed'
Reply With Quote #4

I tried this

Quote:
if (GetSurvivors >= 15)
{
if (GetConVarInt(defaultHealth) != 56000)
{
SetConVarInt(defaultHealth, 56000, bool:notify=false);
}
got those problems

Quote:
error 017: undefined symbol "notify"
warning 215: expression has no effect
error 001: expected token: ";", but found ")"
error 029: invalid expression, assumed zero
fatal error 127: too many error messages on one line
Did I something wrong?

Thanks for helping me.
SilentBr is offline
RedSword
SourceMod Plugin Approver
Join Date: Mar 2006
Location: Quebec, Canada
Old 04-06-2014 , 11:44   Re: How to block 'server cvars x changed'
Reply With Quote #5

You don't need to rewrite the symbol "notify" nor its tag. Just the value (being "false");
__________________
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
SilentBr
Veteran Member
Join Date: Jan 2009
Old 04-06-2014 , 12:25   Re: How to block 'server cvars x changed'
Reply With Quote #6

Quote:
Originally Posted by RedSword View Post
You don't need to rewrite the symbol "notify" nor its tag. Just the value (being "false");
I've tried editing my plugin like this

Quote:
if (GetSurvivors >= 15)
{
if (GetConVarInt(defaultHealth) != 56000)
{
SetConVarInt(defaultHealth, 56000, false); //Still showing the message cvar changed
}
Quote:
if (GetSurvivors >= 15)
{
if (GetConVarInt(defaultHealth) != 56000)
{
SetConVarInt(defaultHealth, 56000, false, false); //Didn't show de message but didin't change the cvar (like plugin is not doing what should do)
}
I opened the original plugin that I want change the cvar according players online, and I saw this part:

Quote:
hDefaultExtraHealth = CreateConVar("st_default_extra_health", "0", "Default Tanks receive this many additional hitpoints.",FCVAR_PLUGIN|FCVAR_NOTIFY,true,0. 0,true,100000.0);
If I change that FCVAR_NOTIFY,true,0.0,true,100000.0 to something else, will solve my problem? Should I change for what?
SilentBr is offline
Undeadflayme
Junior Member
Join Date: Apr 2014
Old 04-06-2014 , 12:49   Re: How to block 'server cvars x changed'
Reply With Quote #7

Quote:
Originally Posted by SilentBr View Post
I've tried editing my plugin like this





I opened the original plugin that I want change the cvar according players online, and I saw this part:



If I change that FCVAR_NOTIFY,true,0.0,true,100000.0 to something else, will solve my problem? Should I change for what?
You have this:
PHP Code:
if (GetSurvivors >= 15)
{
if (
GetConVarInt(defaultHealth) != 56000)
{
SetConVarInt(defaultHealth56000false); //Still showing the message cvar changed

Change it to this:
PHP Code:
if (GetSurvivors >= 15)
{
    if (
GetConVarInt(defaultHealth) != 56000)
    {
        
SetConVarInt(defaultHealth56000false); //Still showing the message cvar changed
    
}

You were missing the last } to end the try block.
Undeadflayme is offline
SilentBr
Veteran Member
Join Date: Jan 2009
Old 04-06-2014 , 16:09   Re: How to block 'server cvars x changed'
Reply With Quote #8

Quote:
Originally Posted by Undeadflayme View Post

You were missing the last } to end the try block.
No, I'm not missing that, it's just a part from my plugin, when end all 'ifs', I have the last }
SilentBr is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 04-06-2014 , 23:35   Re: How to block 'server cvars x changed'
Reply With Quote #9

It's a moot point, notify is ignored on OrangeBox and newer as it uses the FCVAR_NOTIFY mechanism instead.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
sheo
SourceMod Donor
Join Date: Jul 2013
Location: Russia, Moscow
Old 04-07-2014 , 01:57   Re: How to block 'server cvars x changed'
Reply With Quote #10

Best way:
Code:
public OnPluginStart()
{
	HookEvent("server_cvar", SilentEvent, EventHookMode_Pre);
}

public Action:SilentEvent(Handle:event, const String:name[], bool:dontBroadcast)
{
	SetEventBroadcast(event, true);
	return Plugin_Continue;
}
If you need to hide changes of only specified cvars you can retrieve cvar names from the event and hide only that ones you need to
sheo is offline
Reply



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 08:27.


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