43 lines
1.4 KiB
SourcePawn
43 lines
1.4 KiB
SourcePawn
#pragma newdecls required
|
|
|
|
#include <sourcemod>
|
|
|
|
//----------------------------------------------------------------------------------------------------
|
|
// Purpose:
|
|
//----------------------------------------------------------------------------------------------------
|
|
public Plugin myinfo =
|
|
{
|
|
name = "Force CVars",
|
|
author = "zaCade",
|
|
description = "Force CVars to specific values.",
|
|
version = "1.0.0"
|
|
};
|
|
|
|
//----------------------------------------------------------------------------------------------------
|
|
// Purpose:
|
|
//----------------------------------------------------------------------------------------------------
|
|
public void OnPluginStart()
|
|
{
|
|
RegServerCmd("sm_forcevar", Command_ForceCVar);
|
|
}
|
|
|
|
//----------------------------------------------------------------------------------------------------
|
|
// Purpose:
|
|
//----------------------------------------------------------------------------------------------------
|
|
public Action Command_ForceCVar(int args)
|
|
{
|
|
char sArguments[2][128];
|
|
GetCmdArg(1, sArguments[0], sizeof(sArguments[]));
|
|
GetCmdArg(2, sArguments[1], sizeof(sArguments[]));
|
|
|
|
ConVar CVar;
|
|
if ((CVar = FindConVar(sArguments[0])) != null)
|
|
{
|
|
float fValue = StringToFloat(sArguments[1]);
|
|
|
|
CVar.SetBounds(ConVarBound_Lower, true, fValue);
|
|
CVar.SetBounds(ConVarBound_Upper, true, fValue);
|
|
|
|
CVar.SetFloat(fValue, true, false);
|
|
}
|
|
} |