Hi guys,
I'm trying to disable a plugin when these hookevents started
PHP Code:
HookEvent ("charger_charge_start", Event_InfectedAbilityStart);
HookEvent ("charger_pummel_start", Event_InfectedAbilityStart);
HookEvent ("choke_start", Event_InfectedAbilityStart);
HookEvent ("lunge_pounce", Event_InfectedAbilityStart);
HookEvent ("jockey_ride", Event_InfectedAbilityStart);
I'm not sure how to do it, if someone can enlighten me I would be appreciated
Here is the script
PHP Code:
#pragma semicolon 1
#pragma newdecls required
#define PLUGIN_VERSION "1.0"
#define SOUND "ui/menu_countdown.wav"
#include <sdktools>
#include <sourcemod>
Handle SpeedAllowed = INVALID_HANDLE;
Handle MaximumSpeed = INVALID_HANDLE;
bool Speeding [MAXPLAYERS+1];
public Plugin myinfo =
{
name = "L4D2 Speed Booster",
author = "alasfourom",
description = "Allowing Speical Infected To Speed Boost When SHIFT Is Pressed",
version = PLUGIN_VERSION,
url = "https://forums.alliedmods.net/"
}
public void OnPluginStart()
{
CreateConVar ("l4d2_speed_booster_version", PLUGIN_VERSION, "Players Speed Booster", FCVAR_SPONLY|FCVAR_NOTIFY|FCVAR_DONTRECORD);
SpeedAllowed = CreateConVar ("l4d2_speed_allowed", "1", "Enable Speed Booster Plugin [ 0 = Disable - 1 = Enable ]", FCVAR_NOTIFY, true, 0.0, true, 1.0);
MaximumSpeed = CreateConVar ("l4d2_maximum_speed", "1.25", "Set your maximum speed [ Default = 1.0 - Maximum = 2.0]", FCVAR_NOTIFY, true, 0.0, true, 2.0);
AutoExecConfig (true, "L4D2_Speed_Booster");
}
public void OnMapStart()
{
PrecacheSound (SOUND, true);
}
public Action OnPlayerRunCmd (int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon)
{
if (buttons & IN_SPEED && GetEntityFlags(client) & FL_ONGROUND && GetConVarBool(SpeedAllowed))
{
if (client && IsClientInGame(client) && !IsFakeClient(client) && IsInfected(client))
{
buttons &= ~IN_SPEED;
if (Speeding [client])
{
SetClientSpeed(client, GetConVarFloat(MaximumSpeed));
return Plugin_Continue;
}
else
{
Speeding [client] = true;
SetClientSpeed(client, GetConVarFloat(MaximumSpeed));
EmitSoundToClient(client, SOUND, client, SNDCHAN_WEAPON, SNDLEVEL_SCREAMING);
return Plugin_Continue;
}
}
else
{
if (Speeding [client])
{
Speeding [client] = false;
SetEntPropFloat (client, Prop_Data, "m_flLaggedMovementValue", 1.0);
return Plugin_Continue;
}
}
}
else
{
if (Speeding [client])
{
Speeding [client] = false;
SetEntPropFloat (client, Prop_Data, "m_flLaggedMovementValue", 1.0);
return Plugin_Continue;
}
}
return Plugin_Continue;
}
stock bool IsInfected(int client)
{
return (GetClientTeam(client) == 3);
}
stock int SetClientSpeed (int client, float ammount)
{
SetEntPropFloat (client, Prop_Data, "m_flLaggedMovementValue", ammount);
return true;
}
I thought this may work but it didnt
PHP Code:
public void Event_InfectedAbilityStart (Event event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId (event.GetInt("userid"));
if (client && IsClientInGame(client) && !IsFakeClient(client) && IsInfected(client))
{
Speeding [client] = false;
SetEntPropFloat (client, Prop_Data, "m_flLaggedMovementValue", 1.0);
}
return;
}
Thanks