Added replicate and notify parameters to ResetConVar() - these were already available for SetConVarX()
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401307
This commit is contained in:
parent
a53d103507
commit
ac03126022
@ -360,6 +360,35 @@ static cell_t sm_SetConVarString(IPluginContext *pContext, const cell_t *params)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell_t sm_ResetConVar(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
Handle_t hndl = static_cast<Handle_t>(params[1]);
|
||||
HandleError err;
|
||||
ConVar *pConVar;
|
||||
|
||||
if ((err=g_HandleSys.ReadHandle(hndl, g_ConVarManager.GetHandleType(), NULL, (void **)&pConVar))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid convar handle %x (error %d)", hndl, err);
|
||||
}
|
||||
|
||||
pConVar->Revert();
|
||||
|
||||
/* Should we replicate it? */
|
||||
if (params[2] && pConVar->IsBitSet(FCVAR_REPLICATED))
|
||||
{
|
||||
ReplicateConVar(pConVar);
|
||||
}
|
||||
|
||||
/* Should we notify clients? */
|
||||
if (params[3] && pConVar->IsBitSet(FCVAR_NOTIFY))
|
||||
{
|
||||
NotifyConVar(pConVar);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell_t sm_GetConVarFlags(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
Handle_t hndl = static_cast<Handle_t>(params[1]);
|
||||
@ -470,23 +499,6 @@ static cell_t sm_GetConVarName(IPluginContext *pContext, const cell_t *params)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell_t sm_ResetConVar(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
Handle_t hndl = static_cast<Handle_t>(params[1]);
|
||||
HandleError err;
|
||||
ConVar *pConVar;
|
||||
|
||||
if ((err=g_HandleSys.ReadHandle(hndl, g_ConVarManager.GetHandleType(), NULL, (void **)&pConVar))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid convar handle %x (error %d)", hndl, err);
|
||||
}
|
||||
|
||||
pConVar->Revert();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static bool s_QueryAlreadyWarned = false;
|
||||
|
||||
static cell_t sm_QueryClientConVar(IPluginContext *pContext, const cell_t *params)
|
||||
@ -961,10 +973,10 @@ REGISTER_NATIVES(consoleNatives)
|
||||
{"SetConVarString", sm_SetConVarString},
|
||||
{"GetConVarFlags", sm_GetConVarFlags},
|
||||
{"SetConVarFlags", sm_SetConVarFlags},
|
||||
{"ResetConVar", sm_ResetConVar},
|
||||
{"GetConVarName", sm_GetConVarName},
|
||||
{"GetConVarBounds", sm_GetConVarBounds},
|
||||
{"SetConVarBounds", sm_SetConVarBounds},
|
||||
{"ResetConVar", sm_ResetConVar},
|
||||
{"QueryClientConVar", sm_QueryClientConVar},
|
||||
{"RegServerCmd", sm_RegServerCmd},
|
||||
{"RegConsoleCmd", sm_RegConsoleCmd},
|
||||
|
@ -468,6 +468,20 @@ native GetConVarString(Handle:convar, String:value[], maxlength);
|
||||
*/
|
||||
native SetConVarString(Handle:convar, const String:value[], bool:replicate=false, bool:notify=false);
|
||||
|
||||
/**
|
||||
* Resets the console variable to its default value.
|
||||
*
|
||||
* @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
|
||||
* and actually exists on clients.
|
||||
* @param notify If set to true, clients will be notified that the convar has changed.
|
||||
* This will only work if the convar has the FCVAR_NOTIFY flag.
|
||||
* @noreturn
|
||||
* @error Invalid or corrupt Handle.
|
||||
*/
|
||||
native ResetConVar(Handle:convar, bool:replicate=false, bool:notify=false);
|
||||
|
||||
/**
|
||||
* Returns the bitstring of flags on a console variable.
|
||||
*
|
||||
@ -521,15 +535,6 @@ native SetConVarBounds(Handle:convar, ConVarBounds:type, bool:set, Float:value=0
|
||||
*/
|
||||
native GetConVarName(Handle:convar, const String:name[], maxlength);
|
||||
|
||||
/**
|
||||
* Resets the console variable to its default value.
|
||||
*
|
||||
* @param convar Handle to the convar.
|
||||
* @noreturn
|
||||
* @error Invalid or corrupt Handle.
|
||||
*/
|
||||
native ResetConVar(Handle:convar);
|
||||
|
||||
funcenum ConVarQueryFinished
|
||||
{
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user