AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Crit Issue (https://forums.alliedmods.net/showthread.php?t=181239)

ReFlexPoison 03-26-2012 19:08

Crit Issue
 
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;



11530 03-26-2012 19:14

Re: Crit Issue
 
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.

ReFlexPoison 03-26-2012 19:35

Re: Crit Issue
 
And that did it, thanks man. :)


All times are GMT -4. The time now is 02:48.

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