Raised This Month: $ Target: $400
 0% 

Crit for admin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Onedda
Senior Member
Join Date: May 2009
Old 07-31-2009 , 14:15   Crit for admin
Reply With Quote #1

Hello People

Just asking is there any way or if there is a plugin to allow an admin with slay flag to have 100% crit every shot?

Thanks
Onedda
Onedda is offline
noodleboy347
AlliedModders Donor
Join Date: Mar 2009
Old 08-01-2009 , 01:02   Re: Crit for admin
Reply With Quote #2

You can use Gachl's Candy Funpack.
noodleboy347 is offline
retsam
Veteran Member
Join Date: Aug 2008
Location: so-cal
Old 08-01-2009 , 01:08   Re: Crit for admin
Reply With Quote #3

Youd just have to edit preds crits plugin and put an extra admin only check in... Pretty easy to do. Not sure if you know how to do that but..
retsam is offline
pheadxdll
AlliedModders Donor
Join Date: Jun 2008
Old 08-01-2009 , 01:39   Re: Crit for admin
Reply With Quote #4

Code:
#include <sourcemod>

public Action:TF2_CalcIsAttackCritical(client, weapon, String:weaponname[], &bool:result)
{
    if(GetUserFlagBits(client) & ADMFLAG_SLAY) result = true;
    
    return Plugin_Continue;
}
Paste that into http://www.sourcemod.net/compiler.php and hit compile.
pheadxdll is offline
Onedda
Senior Member
Join Date: May 2009
Old 08-01-2009 , 05:41   Re: Crit for admin
Reply With Quote #5

thanks pheadxdll

but i have compiled it and it is running under sourcemod but it doesn't work for me.

I tried it as a soldier and just normal rockets not crit ones was fired.

I will say though that if it works for you is there any way you can put a on or off command for it.

p.s i do appreciate it though for taking the time to do it.

Thanks
Onedda
Onedda is offline
pheadxdll
AlliedModders Donor
Join Date: Jun 2008
Old 08-01-2009 , 13:21   Re: Crit for admin
Reply With Quote #6

Onedda, I forgot the #include <tf2> at the top. But here's a fixed version with a convar.

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

new Handle:g_hEnabled = INVALID_HANDLE;
new bool:g_bEnabled = true;

public OnPluginStart()
{
    g_hEnabled = CreateConVar("admin_crits", "1", "<0/1> On/off.");
}

public OnConfigsExecuted()
{
    HookConVarChange(g_hEnabled, ConVarChange_Enable);
    g_bEnabled = GetConVarBool(g_hEnabled);
}

public ConVarChange_Enable(Handle:convar, const String:oldValue[], const String:newValue[])
{
    if(StringToInt(newValue))
        g_bEnabled = true;
    else
        g_bEnabled = false;
}

public Action:TF2_CalcIsAttackCritical(client, weapon, String:weaponname[], &bool:result)
{
    if(g_bEnabled && GetUserFlagBits(client) & ADMFLAG_SLAY) result = true;
    
    return Plugin_Continue;
}
Use: sm_cvar admin_crits 0 to turn it off.
pheadxdll is offline
Onedda
Senior Member
Join Date: May 2009
Old 08-02-2009 , 06:10   Re: Crit for admin
Reply With Quote #7

Thanks pheadxdll

I will try it later and let you know how i get on.

Thanks
Onedda
Onedda is offline
retsam
Veteran Member
Join Date: Aug 2008
Location: so-cal
Old 08-02-2009 , 18:01   Re: Crit for admin
Reply With Quote #8

Looks right to me, but probably should have a return Plugin_Handled in there for admins in the tf2 calc function. Wouldnt this be better pheadxdll?


Code:
public Action:TF2_CalcIsAttackCritical(client, weapon, String:weaponname[], &bool:result)
{
    if(g_bEnabled && GetUserFlagBits(client) & ADMFLAG_SLAY)
    {    
      result = true;
      return Plugin_Handled;
    }
    return Plugin_Continue;
}

Last edited by retsam; 08-02-2009 at 18:06.
retsam is offline
pheadxdll
AlliedModders Donor
Join Date: Jun 2008
Old 08-02-2009 , 21:08   Re: Crit for admin
Reply With Quote #9

That looks right retsam, try this:

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

new Handle:g_hEnabled = INVALID_HANDLE;
new bool:g_bEnabled = true;

public OnPluginStart()
{
    g_hEnabled = CreateConVar("admin_crits", "1", "<0/1> On/off.");
}

public OnConfigsExecuted()
{
    HookConVarChange(g_hEnabled, ConVarChange_Enable);
    g_bEnabled = GetConVarBool(g_hEnabled);
}

public ConVarChange_Enable(Handle:convar, const String:oldValue[], const String:newValue[])
{
    if(StringToInt(newValue))
        g_bEnabled = true;
    else
        g_bEnabled = false;
}

public Action:TF2_CalcIsAttackCritical(client, weapon, String:weaponname[], &bool:result)
{
    if(g_bEnabled && GetUserFlagBits(client) & ADMFLAG_SLAY)
    {
         result = true;
         return Plugin_Handled;
    }
    
    return Plugin_Continue;
}
pheadxdll is offline
Onedda
Senior Member
Join Date: May 2009
Old 08-03-2009 , 16:03   Re: Crit for admin
Reply With Quote #10

Hello pheadxdll

Yep it works and turns off and on, problem it though when i turn it on and another admin (lower than me) it turns it on for them as well.

Also is there any way to stop it printing to chat that it is on or off?

Thanks
Onedda
Onedda is offline
Reply



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 04:27.


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