Raised This Month: $32 Target: $400
 8% 

Crit Issue


Post New Thread Reply   
 
Thread Tools Display Modes
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
11530
Veteran Member
Join Date: Sep 2011
Location: Underworld
Old 03-26-2012 , 19:14   Re: Crit Issue
Reply With Quote #2

Try removing result = false; and changing the last line to return Plugin_Continue; instead.

As it currently stands, result = false; ensures that everyone without the ADMFLAG_CUSTOM1 do not get crits, then that change is set in stone by returning Plugin_Handled. Removing those two lines, and instead using return Plugin_Continue; would allow the normal calculations to continue, i.e. allowing other players to sometimes get crits.

Last edited by 11530; 03-27-2012 at 12:07.
11530 is offline
ReFlexPoison
☠☠☠
Join Date: Jul 2011
Location: ☠☠☠
Old 03-26-2012 , 19:35   Re: Crit Issue
Reply With Quote #3

And that did it, thanks man.
ReFlexPoison is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:55.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode