PDA

View Full Version : TF2: Give specific weapons 100% crit chance


hinehine10
12-30-2011, 12:42
Need a Plugin that i can use to give a weapon,
like 'The Conscientious Objector', a 100% critical hit chance.
Been looking for hours now and couldn't find anything.
If such a Plugin already exist please give me the Link to it.

This should NOT give the weapon this Crit-Glow effect, should just act like a random crit, only that it's forever.

Just to prevent misunderstandings, here's it again:
The plugin shouldn't give a specific player crits,
it should give any player with a specific weapon crits.

Tylerst
12-30-2011, 13:58
I don't think there's a plugin for that, but it would be fairly easy to make using the weapon index.

For example, this would give The Conscientious Objector crits:


#include <sourcemod>
#include <tf2>

public Action:TF2_CalcIsAttackCritical(client, weapon, String:weaponname[], &bool:result)
{
new weaponindex = GetEntProp(weapon, Prop_Send, "m_iItemDefinitionIndex");
switch(weaponindex)
{
case 474:
{
result = true;
return Plugin_Handled;
}
}
return Plugin_Continue;
}


To add other weapons, just add a comma and another index to the case.

Example:
For The Conscientious Objector, The Ullapool Caber, and The Frying Pan, it would be like this:

case 474, 307, 264:

Edit: Indexes can be found in your items_game.txt or here: http://wiki.alliedmods.net/Team_Fortress_2_Item_Definition_Indexes

hinehine10
12-30-2011, 15:12
Thanks Tylerst!
I'll try that immediately.