This commit is contained in:
xen
2020-03-25 20:09:12 +02:00
committed by xen
commit 527e7ec05e
420 changed files with 68682 additions and 0 deletions
+57
View File
@@ -0,0 +1,57 @@
#pragma newdecls required
#include <sourcemod>
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Plugin myinfo =
{
name = "Force ConVars",
author = "zaCade",
description = "Force ConVars to specific values.",
version = "1.0.0"
};
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
{
if(GetEngineVersion() != Engine_CSGO)
{
strcopy(error, err_max, "This plugin is only required on CS:GO!");
return APLRes_Failure;
}
return APLRes_Success;
}
//----------------------------------------------------------------------------------------------------
// 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);
}
}