Thread: Crit Issue
View Single Post
Author Message
ReFlexPoison
☠☠☠
Join Date: Jul 2011
Location: ☠☠☠
Old 03-26-2012 , 19:08   Crit Issue
Reply With Quote #1

Pretty simple question here, don't know about response. Ever since I added this to my server, I didn't attempt to fix the problem, because, well, I didn't know there was one. I set it up to where anyone with ADMFLAG_CUSTOM1 receives %100 critical strikes. This works fine, however this disabled all crits for anyone else without this flag. (Even when uber charge or an all crits weapon is being used)

Easy fix question mark

PHP Code:
#include <sourcemod>
#include <tf2>

new Handle:crits INVALID_HANDLE;
new 
Handle:chance INVALID_HANDLE;

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|FCVAR_NOTIFY);
}


public 
Action:TF2_CalcIsAttackCritical(clientweaponString:weaponname[], &bool:result)
{
    if (!
GetConVarBool(crits))
    {
        return 
Plugin_Continue;    
    }
    
    if(
GetConVarFloat(chance) > GetRandomFloat(0.01.0) && CheckCommandAccess(client"sm_crits_flag"ADMFLAG_CUSTOM1))
    {
        
result true;
        return 
Plugin_Handled;    
    }
    
    
result false;
    
    return 
Plugin_Handled;

ReFlexPoison is offline