adding FPSMaxEnforce
This commit is contained in:
parent
c6818aabfd
commit
eff1e370e2
49
FPSMaxEnforce/scripting/FPSMaxEnforce.sp
Normal file
49
FPSMaxEnforce/scripting/FPSMaxEnforce.sp
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
#include <sourcemod>
|
||||||
|
|
||||||
|
#pragma semicolon 1
|
||||||
|
#pragma newdecls required
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
// Purpose:
|
||||||
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
public Plugin myinfo =
|
||||||
|
{
|
||||||
|
name = "FPSMaxEnforce",
|
||||||
|
author = "Neon (i decompiled it, now its mine!)",
|
||||||
|
description = "",
|
||||||
|
version = "1.0.0",
|
||||||
|
url = "https://steamcommunity.com/id/n3ontm"
|
||||||
|
};
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
// Purpose:
|
||||||
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
public void OnPluginStart()
|
||||||
|
{
|
||||||
|
HookEvent("player_spawn", OnClientSpawn);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
// Purpose:
|
||||||
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
public void OnClientSpawn(Event hEvent, const char[] sEvent, bool bDontBroadcast)
|
||||||
|
{
|
||||||
|
int client = GetClientOfUserId(hEvent.GetInt("userid"));
|
||||||
|
QueryClientConVar(client, "fps_max", OnConVarQueryFinished);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
// Purpose:
|
||||||
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
public void OnConVarQueryFinished(QueryCookie cookie, int client, ConVarQueryResult result, const char[] cvarName, const char[] cvarValue)
|
||||||
|
{
|
||||||
|
if (!IsClientInGame(client))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (result != ConVarQuery_Okay)
|
||||||
|
LogError("Could not query ConVar \"cvarName\" for %N", client);
|
||||||
|
|
||||||
|
if (StringToInt(cvarValue) < 58)
|
||||||
|
KickClient(client, "Your fps_max is invalid, please set it to a higher value (>59)");
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user