From c1c5d2656cf4e8f5777a36e207ecffc1fcbc7a48 Mon Sep 17 00:00:00 2001 From: Scott Ehlert Date: Wed, 12 Nov 2008 23:14:49 -0600 Subject: [PATCH] The replicate and notify parameters for SetConVarX and ResetConVar are now ignored on Orange Box. - OB engine automatically replicates and fires server_cvar event notification for changes cvars. - Added a note about this in comments for affected natives. --- core/smn_console.cpp | 12 ++++++++++-- plugins/include/console.inc | 15 +++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/core/smn_console.cpp b/core/smn_console.cpp index 7dded75e..cb58a3e4 100644 --- a/core/smn_console.cpp +++ b/core/smn_console.cpp @@ -339,6 +339,7 @@ static cell_t sm_SetConVarNum(IPluginContext *pContext, const cell_t *params) pConVar->SetValue(params[2]); +#ifndef ORANGEBOX_BUILD /* Should we replicate it? */ if (params[3] && IsFlagSet(pConVar, FCVAR_REPLICATED)) { @@ -350,6 +351,7 @@ static cell_t sm_SetConVarNum(IPluginContext *pContext, const cell_t *params) { NotifyConVar(pConVar); } +#endif return 1; } @@ -386,6 +388,7 @@ static cell_t sm_SetConVarFloat(IPluginContext *pContext, const cell_t *params) float value = sp_ctof(params[2]); pConVar->SetValue(value); +#ifndef ORANGEBOX_BUILD /* Should we replicate it? */ if (params[3] && IsFlagSet(pConVar, FCVAR_REPLICATED)) { @@ -397,6 +400,7 @@ static cell_t sm_SetConVarFloat(IPluginContext *pContext, const cell_t *params) { NotifyConVar(pConVar); } +#endif return 1; } @@ -435,6 +439,7 @@ static cell_t sm_SetConVarString(IPluginContext *pContext, const cell_t *params) pConVar->SetValue(value); +#ifndef ORANGEBOX_BUILD /* Should we replicate it? */ if (params[3] && IsFlagSet(pConVar, FCVAR_REPLICATED)) { @@ -446,6 +451,7 @@ static cell_t sm_SetConVarString(IPluginContext *pContext, const cell_t *params) { NotifyConVar(pConVar); } +#endif return 1; } @@ -464,17 +470,19 @@ static cell_t sm_ResetConVar(IPluginContext *pContext, const cell_t *params) pConVar->Revert(); +#ifndef ORANGEBOX_BUILD /* Should we replicate it? */ - if (params[2] && IsFlagSet(pConVar, FCVAR_REPLICATED)) + if (params[3] && IsFlagSet(pConVar, FCVAR_REPLICATED)) { ReplicateConVar(pConVar); } /* Should we notify clients? */ - if (params[3] && IsFlagSet(pConVar, FCVAR_NOTIFY)) + if (params[4] && IsFlagSet(pConVar, FCVAR_NOTIFY)) { NotifyConVar(pConVar); } +#endif return 1; } diff --git a/plugins/include/console.inc b/plugins/include/console.inc index 0db4b74b..1a4e3529 100644 --- a/plugins/include/console.inc +++ b/plugins/include/console.inc @@ -473,6 +473,9 @@ native bool:GetConVarBool(Handle:convar); /** * Sets the boolean value of a console variable. * + * Note: The replicate and notify params are ignored on the Episode 2/Orange Box engine. + * This engine automatically replicates and notifies as soon as the convar is changed. + * * @param convar Handle to the convar. * @param value New boolean value. * @param replicate If set to true, the new convar value will be set on all clients. @@ -497,6 +500,9 @@ native GetConVarInt(Handle:convar); /** * Sets the integer value of a console variable. * + * Note: The replicate and notify params are ignored on the Episode 2/Orange Box engine. + * This engine automatically replicates and notifies as soon as the convar is changed. + * * @param convar Handle to the convar. * @param value New integer value. * @param replicate If set to true, the new convar value will be set on all clients. @@ -521,6 +527,9 @@ native Float:GetConVarFloat(Handle:convar); /** * Sets the floating point value of a console variable. * + * Note: The replicate and notify params are ignored on the Episode 2/Orange Box engine. + * This engine automatically replicates and notifies as soon as the convar is changed. + * * @param convar Handle to the convar. * @param value New floating point value. * @param replicate If set to true, the new convar value will be set on all clients. @@ -547,6 +556,9 @@ native GetConVarString(Handle:convar, String:value[], maxlength); /** * Sets the string value of a console variable. * + * Note: The replicate and notify params are ignored on the Episode 2/Orange Box engine. + * This engine automatically replicates and notifies as soon as the convar is changed. + * * @param convar Handle to the convar. * @param value New string value. * @param replicate If set to true, the new convar value will be set on all clients. @@ -562,6 +574,9 @@ native SetConVarString(Handle:convar, const String:value[], bool:replicate=false /** * Resets the console variable to its default value. * + * Note: The replicate and notify params are ignored on the Episode 2/Orange Box engine. + * This engine automatically replicates and notifies as soon as the convar is changed. + * * @param convar Handle to the convar. * @param replicate If set to true, the new convar value will be set on all clients. * This will only work if the convar has the FCVAR_REPLICATED flag