[Suggestion] noshake plugin

Hello, I would like to know - is there any way to install noshake?

This plugin would be useful on some maps, where the screen is often very shaken.
This plugin was found a long time ago, in any case - it seems to be a working one.

I just do not want to say anything, the effect of shaking the screen is made on maps for the atmosphere, but there are people who do not like this from themselves.

Again, this plugin has the ability to enable / disable the function for those who do not need it.
Below I attach the source code of the plugin I found, and also the code - if you do not want to download the archive.

Source Code
#pragma semicolon 1
 
#include <sourcemod>
#include <sdkhooks>
#include <clientprefs>
 
#pragma newdecls required
 
Handle g_hNoShakeCookie;
ConVar g_Cvar_NoShakeGlobal;
 
bool g_bNoShake[MAXPLAYERS + 1] = {false, ...};
bool g_bNoShakeGlobal = false;
 
public Plugin myinfo =
{
name= "NoShake",
author= "BotoX",
description= "Disable env_shake",
version= "1.0.1",
url= ""
};
 
public void OnPluginStart()
{
RegConsoleCmd("sm_shake", Command_Shake, "[NoShake] Disables or enables screen shakes.");
RegConsoleCmd("sm_noshake", Command_Shake, "[NoShake] Disables or enables screen shakes.");
 
g_hNoShakeCookie = RegClientCookie("noshake_cookie", "NoShake", CookieAccess_Protected);
 
g_Cvar_NoShakeGlobal = CreateConVar("sm_noshake_global", "0", "Disable screenshake globally.", 0, true, 0.0, true, 1.0);
g_bNoShakeGlobal = g_Cvar_NoShakeGlobal.BoolValue;
g_Cvar_NoShakeGlobal.AddChangeHook(OnConVarChanged);
 
HookUserMessage(GetUserMessageId("Shake"), MsgHook, true);
}
 
public void OnClientCookiesCached(int client)
{
static char sCookieValue[2];
GetClientCookie(client, g_hNoShakeCookie, sCookieValue, sizeof(sCookieValue));
g_bNoShake[client] = StringToInt(sCookieValue) != 0;
}
 
public void OnConVarChanged(ConVar convar, const char[] oldValue, const char[] newValue)
{
if(StringToInt(newValue) > StringToInt(oldValue))
PrintToChatAll("\x03[NoShake]\x01 Enabled NoShake globally!");
else if(StringToInt(newValue) < StringToInt(oldValue))
PrintToChatAll("\x03[NoShake]\x01 Disabled NoShake globally!");
 
g_bNoShakeGlobal = StringToInt(newValue) != 0;
}
 
public Action MsgHook(UserMsg msg_id, BfRead msg, const int[] players, int playersNum, bool reliable, bool init)
{
if(playersNum == 1 && (g_bNoShakeGlobal || g_bNoShake[players[0]]))
return Plugin_Handled;
else
return Plugin_Continue;
}
 
public Action Command_Shake(int client, int args)
{
if(g_bNoShakeGlobal)
return Plugin_Handled;
 
if(!AreClientCookiesCached(client))
{
ReplyToCommand(client, "\x03[NoShake]\x01 Please wait. Your settings are still loading.");
return Plugin_Handled;
}
 
if(g_bNoShake[client])
{
g_bNoShake[client] = false;
ReplyToCommand(client, "\x03[NoShake]\x01 has been disabled!");
}
else
{
g_bNoShake[client] = true;
ReplyToCommand(client, "\x03[NoShake]\x01 has been enabled!");
}
 
static char sCookieValue[2];
IntToString(g_bNoShake[client], sCookieValue, sizeof(sCookieValue));
SetClientCookie(client, g_hNoShakeCookie, sCookieValue);
 
return Plugin_Handled;
}

We already have (our own) no shake in the server, enabled by !noshake. It’s been there for weeks.

I apologize if it already exists. I just do not have access to the game right now, and the other day I remembered that I wanted to offer this thing. When I last visited ! noshake has not been installed on the server yet.
I correctly understood, at the moment such thing is already present on the server?
I apologize, because I use Google translator

Yes, it’s present.

ちょっとBrocali、最後の2週間以内にnoshakeがサーバーに追加されました。あなたは!noshakeでそれを起動することができます。
(Sorry for the shitty Japanese)

Ok, thanks for answer!
And no, I’m not from Japan :slight_smile:

I would like to know if there is an opportunity to make a different text for !Noshake?
For example, at the moment it is not clear if you have this plugin enabled or not.
That it is on, that it is off - the same text.
Enviolinador

Done.

1 Like