AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   Apply On ADMFLAG_CUSTOM6 (https://forums.alliedmods.net/showthread.php?t=320513)

ApoziX 12-25-2019 18:48

Apply On ADMFLAG_CUSTOM6
 
Hey I want that to apply only on admflag_custom6 +rep for helpers
PHP Code:

#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*",
    
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|FCVAR_NOTIFY);
}


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



JeremyDF93 12-25-2019 19:46

Re: Apply On ADMFLAG_CUSTOM6
 
PHP Code:

#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*",
    
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|FCVAR_NOTIFY);
}


public 
Action:TF2_CalcIsAttackCritical(clientweaponString:weaponname[], &bool:result)
{
    if (!
GetConVarBool(crits))
    {
        return 
Plugin_Continue;    
    }

    if (!
IsClientAdmin(clientADMFLAG_CUSTOM6))
    {
        return 
Plugin_Continue;  
    }
    
    if (
GetConVarFloat(chance) > GetRandomFloat(0.01.0))
    {
        
result true;
        return 
Plugin_Handled;    
    }
    
    
result false;
    
    return 
Plugin_Handled;
}

stock bool IsClientAdmin(int clientint flags ADMFLAG_GENERIC) {
    return (
GetUserFlagBits(client) & flags) > 0;



ApoziX 12-25-2019 19:54

Re: Apply On ADMFLAG_CUSTOM6
 
Thank you +rep mate


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

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