AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Solved [Req] Admin kill bonus (https://forums.alliedmods.net/showthread.php?t=320836)

Shitty 01-11-2020 15:36

[Req] Admin kill bonus
 
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 :)

Bugsy 01-11-2020 17:22

Re: [Req] Admin kill bonus
 
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;
            }
        }
    }



Napoleon_be 01-12-2020 10:51

Re: [Req] Admin kill bonus
 
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.

Shitty 01-12-2020 11:33

Re: [Req] Admin kill bonus
 
Quote:

Originally Posted by Napoleon_be (Post 2679911)
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

Bugsy 01-12-2020 12:22

Re: [Req] Admin kill bonus
 
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?

Napoleon_be 01-12-2020 12:25

Re: [Req] Admin kill bonus
 
Quote:

Originally Posted by Bugsy (Post 2679927)
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.


Bugsy 01-12-2020 12:40

Re: [Req] Admin kill bonus
 
So you want to allow health and armor over 100?

Napoleon_be 01-12-2020 12:43

Re: [Req] Admin kill bonus
 
Quote:

Originally Posted by Bugsy (Post 2679933)
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.

Bugsy 01-12-2020 12:48

Re: [Req] Admin kill bonus
 
Above code updated to address admin flags and clamp removed.

Shitty 01-12-2020 12:59

Re: [Req] Admin kill bonus
 
thanks for your help, i tested it and it's working good.


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

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