You can try this. I don't know much about CSS. Gathered all these up from the internet.
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
bool g_bPlanting[MAXPLAYERS+1] = {false, ...};
public void OnPluginStart()
{
HookEvent("bomb_beginplant", Event_BeginPlant, EventHookMode_Pre);
HookEvent("bomb_abortplant", Event_Abort);
HookEvent("bomb_planted", Event_Abort);
HookEvent("player_death", Event_Abort);
}
public void OnClientPutInServer(int client)
{
g_bPlanting[client] = false;
SDKHook(client, SDKHook_PreThink, PreThink);
}
public Action PreThink(int client)
{
if(!IsPlayerAlive(client))
{
return;
}
if(!g_bPlanting[client])
{
return;
}
if(GetEntProp(client, Prop_Send, "m_bDucking") != 1)
SetEntProp(client, Prop_Send, "m_bDucking", 1);
if(!(GetEntityFlags(client) & FL_DUCKING))
SetEntityFlags(client, GetEntityFlags(client)|FL_DUCKING);
}
public Action OnPlayerRunCmd(int iClient, int &iButtons, int &iImpulse, float Velocity[3], float fAngles[3], int &iWeapon)
{
if(!IsPlayerAlive(iClient))
{
return Plugin_Continue;
}
if(!g_bPlanting[iClient])
{
return Plugin_Continue;
}
iButtons |= IN_DUCK;
return Plugin_Changed;
}
public Action Event_BeginPlant(Event ev, const char[] name, bool dbc)
{
int client = GetClientOfUserId(ev.GetInt("userid"));
g_bPlanting[client] = true;
}
public Action Event_Abort(Event ev, const char[] name, bool dbc)
{
int client = GetClientOfUserId(ev.GetInt("userid"));
g_bPlanting[client] = false;
SetEntProp(client, Prop_Send, "m_bDucking", 0);
SetEntityFlags(client, GetEntityFlags(client) & ~FL_DUCKING);
}
__________________