 |
|
Veteran Member
|

08-30-2011
, 12:09
Re: Critical Hit Modifier
|
#206
|
+1 actually would be cool if we could add a list of weps to a blacklist of sorts for this... would make this conform nicely with the theadshotsonly plugin...
Quote:
#include <sourcemod>
#include <tf2>
new Handle:crits = INVALID_HANDLE;
new Handle:chance = INVALID_HANDLE;
#define PLUGIN_VERSION "0.1"
public Plugin:myinfo =
{
name = "SM Crits chance",
author = "pRED* (edited by cybersquare420 to ignore headshot weps)",
description = "Change critical hit %",
version = PLUGIN_VERSION,
url = "http://www.sourcemod.net/"
};
public OnPluginStart()
{
crits = CreateConVar("sm_crits_enabled", "1");
chance = CreateConVar("sm_crits_chance", "1.00");
CreateConVar("sm_crits_version", PLUGIN_VERSION, "Crits Version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FC VAR_NOTIFY);
}
public Action:TF2_CalcIsAttackCritical(client, weapon, String:weaponname[], &bool:result)
{
if (!GetConVarBool(crits))
{
return Plugin_Continue;
}
if (StrEqual(weaponname, "tf_weapon_sniperrifle", true))
{
return Plugin_Handled;
}
if (StrEqual(weaponname, "tf_weapon_sniperrifle_decap", true))
{
return Plugin_Handled;
}
if (StrEqual(weaponname, "tf_weapon_compound_bow", true))
{
return Plugin_Handled;
}
if (StrEqual(weaponname, "tf_weapon_revolver", false) && GetEntProp(weapon, Prop_Send, "m_iEntityQuality") == 3)
{
return Plugin_Continue;
}
if (GetConVarFloat(chance) > GetRandomFloat(0.0, 1.0))
{
result = true;
return Plugin_Handled;
}
result = false;
return Plugin_Handled;
}
|
edit: added checks for other headshot capable weps... tested fairly extensively now and appears to function as intended...
And of course, many thanx to pred for the original! hope this helps someone...
__________________
Last edited by cybersquare420; 09-05-2011 at 16:24.
|
|
|
|