Raised This Month: $12 Target: $400
 3% 

Solved [Req] Admin kill bonus


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Shitty
Member
Join Date: Sep 2019
Old 01-11-2020 , 15:36   [Req] Admin kill bonus
Reply With Quote #1

Hey, i need a plugin which give admins with those flags a bonus per kill.

Flags and bonus per kill :

"abcdefghijkmnopqrsu" ========= "100 HP + 100 AP + 10000$ per kill"
"bcdefimjpt" ================ "80 HP + 80 AP + 8000$ per kill"
"bcdefimjpr" ================ "70 HP + 70 AP + 7000$ per kill"
"bcdefimjpo" ================ "60 HP + 60 AP + 6000$ per kill"
"bcdefimnjp" ================ "25 HP + 25 AP + 1200$ per kill"
"bcdefimnj" ================= "40 HP + 40 AP + 4000$ per kill"
"bceinj" =================== "40 HP + 40 AP + 4000$ per kill"
"bn" ===================== "40 HP + 40 AP + 4000$ per kill"

thanks in advance
__________________

Last edited by Shitty; 01-12-2020 at 12:59.
Shitty is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-11-2020 , 17:22   Re: [Req] Admin kill bonus
Reply With Quote #2

PHP Code:

#include <amxmodx>
#include <cstrike>
#include <fun>
#include <hamsandwich>

new const Version[] = "0.2";

enum AdminBonus
{
    
Flags32 ],
    
HPBonus,
    
APBonus,
    
MoneyBonus
}

new 
g_Bonuses[][ AdminBonus ] = 
{
    { 
"abcdefghijkmnopqrsu"100 100 10000 } ,
    { 
"bcdefimjpt" 80 80 8000 } ,
    { 
"bcdefimjpr" 70 70 7000 } ,
    { 
"bcdefimjpo" 60 60 6000 } ,
    { 
"bcdefimnjp" 25 25 1200 } ,
    { 
"bcdefimnj" 40 40 4000 } ,
    { 
"bceinj" 40 40 4000 } ,
    { 
"bn" 40 40 4000 }
};

public 
plugin_init() 
{
    
register_plugin"Admin Kill Bonus" Version "bugsy" );
    
    
RegisterHamHam_Killed "player" "HamKilled" );
}

public 
HamKillediVictim iKiller ShouldGib )
{
    new 
iCurrentArmor CsArmorType:catArmor;
    
    if ( 
is_user_aliveiKiller ) )
    {
        for ( new 
sizeofg_Bonuses ) ; i++ )
        {
            if ( 
get_user_flagsiKiller ) == read_flagsg_Bonuses][ Flags ] ) ) 
            {
                
cs_set_user_moneyiKiller cs_get_user_moneyiKiller ) + g_Bonuses][ MoneyBonus ] );
                
set_user_healthiKiller get_user_healthiKiller ) + g_Bonuses][ HPBonus ] );
                
iCurrentArmor cs_get_user_armoriKiller catArmor );
                
cs_set_user_armoriKiller iCurrentArmor g_Bonuses][ APBonus ] , catArmor ); 
                
                
client_printiKiller print_chat "* Awarded +$%d , +%d health, +%d armor for your kill!" g_Bonuses][ MoneyBonus ] , g_Bonuses][ HPBonus ] , g_Bonuses][ APBonus ] );
                break;
            }
        }
    }

__________________

Last edited by Bugsy; 01-12-2020 at 12:48.
Bugsy is offline
Old 01-12-2020, 10:21
Shitty
This message has been deleted by Shitty.
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 01-12-2020 , 10:51   Re: [Req] Admin kill bonus
Reply With Quote #3

I tested it and the money works fine as it should. I think the clamp() needs to get modified. The players health & armor gets set to 100 but doesn't get added to it's current health & armor.

EDIT: Removing the clamp() function could fix this issue. Also bugsy, could you make this so that the bonuses only apply if the flags are equal? right now if u add a flag like "x", you still get that 10k money bonus.
__________________

Last edited by Napoleon_be; 01-12-2020 at 11:22.
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Shitty
Member
Join Date: Sep 2019
Old 01-12-2020 , 11:33   Re: [Req] Admin kill bonus
Reply With Quote #4

Quote:
Originally Posted by Napoleon_be View Post
I tested it and the money works fine as it should. I think the clamp() needs to get modified. The players health & armor gets set to 100 but doesn't get added to it's current health & armor.

EDIT: Removing the clamp() function could fix this issue. Also bugsy, could you make this so that the bonuses only apply if the flags are equal? right now if u add a flag like "x", you still get that 10k money bonus.
yea that's what i need
__________________
Shitty is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-12-2020 , 12:22   Re: [Req] Admin kill bonus
Reply With Quote #5

I think clamp() is doing what it should. This limits the value to between 0 and 100, which is the max capacity of health and armor. If you look at the code, it does take their current money/health/armor and add on to it the bonus value.

Regarding flag handling, this will award the bonus if the player has all of the flags for the specific bonus level. If they have additional flags beyond the bonus flags, they get the bonus. So what you are saying is they should only get the bonus if they have ONLY the flags for the bonus, and no other flags?
__________________
Bugsy is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 01-12-2020 , 12:25   Re: [Req] Admin kill bonus
Reply With Quote #6

Quote:
Originally Posted by Bugsy View Post
I think clamp() is doing what it should. This limits the value to between 0 and 100, which is the max capacity of health and armor. If you look at the code, it does take their current money/health/armor and add on to it the bonus value. Yes clamp does what it's supposed to do in the code, but there's no point in adding health and armor if u cap it at 100 only. When someone gets a kill, their health gets set to the value according to the flags, it should get added, not set. Either clamp value should be increased or either removed from the code.

Regarding flag handling, this will award the bonus if the player has all of the flags for the specific bonus level. If they have additional flags beyond the bonus flags, they get the bonus. So what you are saying is they should only get the bonus if they have ONLY the flags for the bonus, and no other flags? Yes.
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-12-2020 , 12:40   Re: [Req] Admin kill bonus
Reply With Quote #7

So you want to allow health and armor over 100?
__________________

Last edited by Bugsy; 01-12-2020 at 12:41.
Bugsy is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 01-12-2020 , 12:43   Re: [Req] Admin kill bonus
Reply With Quote #8

Quote:
Originally Posted by Bugsy View Post
So you want to allow health and armor over 100?
Yes, i asked the author and there shouldn't be a cap at all since this is going to be used for a furienmod.
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-12-2020 , 12:48   Re: [Req] Admin kill bonus
Reply With Quote #9

Above code updated to address admin flags and clamp removed.
__________________
Bugsy is offline
Shitty
Member
Join Date: Sep 2019
Old 01-12-2020 , 12:59   Re: [Req] Admin kill bonus
Reply With Quote #10

thanks for your help, i tested it and it's working good.
__________________
Shitty 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 20:10.


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