Raised This Month: $81 Target: $400
 20% 

[CS:GO] Kill Rewards (v1.0.0, 2016-11-07)


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Maxximou5
AlliedModders Donor
Join Date: Feb 2013
Plugin ID:
5401
Plugin Version:
1.0.0
Plugin Category:
Fun Stuff
Plugin Game:
Counter-Strike: GO
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Awards players on a successful kill with health and/or armor.
    Old 11-07-2016 , 19:17   [CS:GO] Kill Rewards (v1.0.0, 2016-11-07)
    Reply With Quote #1

    Current Version: 1.0.0

    Main Features
    _____________________________________________
    • Health Points and/or Armor Points
    • Message Configuration
    • Auto-Update Support
    • Multi-Language Support
      • English Supported
      • Spanish Supported
      • French Supported
      • Polish Supported
      • Brazilian Supported

    Features to Add
    _____________________________________________
    • Nothing yet!

    Commands
    _____________________________________________
    • Nothing yet!

    ConVars
    _____________________________________________

    Spoiler


    Compatibility
    _____________________________________________

    This plugin is tested on the following Sourcemod & Metamod Versions.

    Requirements
    _____________________________________________

    Auto-Update Support requires updater to be installed.

    Instructions
    _____________________________________________
    • Extract zip file and place files in the corresponding directories of /addons/sourcemod
    • /plugins/killrewards.smx
    • /scripting/killrewards.sp (necessary only for compiling)

    Changelog
    _____________________________________________

    To view the most recent changelog visit the changelog file.

    Download
    _____________________________________________

    Once installed, the plugin will update itself as long as you've done as described in the requirements section; otherwise, downloaded the latest release below.
    Please download the latest killrewards.zip file from my releases.

    Bugs
    _____________________________________________

    If there are any bugs, please report them using the issues page.

    Credit
    _____________________________________________

    A thank you to those who helped:

    Source Code
    _____________________________________________

    Visit the Github or download the source code below.

    Donate
    _____________________________________________

    If you think I am doing a good job or you want to buy me a beer or feed my cat, please donate. Thanks!



    Total times downloaded: 0 (as of 11/07/16)
    Attached Files
    File Type: zip killrewards.zip (28.4 KB, 963 views)

    Last edited by Maxximou5; 11-07-2016 at 20:10. Reason: Minor typos!
    Maxximou5 is offline
    Maxximou5
    AlliedModders Donor
    Join Date: Feb 2013
    Old 11-07-2016 , 19:17   Re: [CS:GO] Kill Rewards (v1.0.0, 2016-11-07)
    Reply With Quote #2

    Reserved for future Q & A.
    Maxximou5 is offline
    m22b
    Senior Member
    Join Date: Jul 2013
    Old 12-01-2016 , 11:39   Re: [CS:GO] Kill Rewards (v1.0.0, 2016-11-07)
    Reply With Quote #3

    How can i add weapon_awp ?
    Like if i kill enemy with ak47 i got +20hp, if i kill enemy with awp i got +10hp.
    m22b is offline
    Maxximou5
    AlliedModders Donor
    Join Date: Feb 2013
    Old 12-01-2016 , 19:01   Re: [CS:GO] Kill Rewards (v1.0.0, 2016-11-07)
    Reply With Quote #4

    Quote:
    Originally Posted by m22b View Post
    How can i add weapon_awp ?
    Like if i kill enemy with ak47 i got +20hp, if i kill enemy with awp i got +10hp.
    That's something that can be added in future versions, but currently there is no option for that.
    Maxximou5 is offline
    OneMore
    Senior Member
    Join Date: Feb 2019
    Old 03-12-2019 , 18:59   Re: [CS:GO] Kill Rewards (v1.0.0, 2016-11-07)
    Reply With Quote #5

    The plugin doesn't work correctly I've updated it. If someone interested in, I can upload... But I removed admin group support and updater support.
    OneMore is offline
    eliteroyal
    AlliedModders Donor
    Join Date: Dec 2016
    Location: Moldova
    Old 06-04-2019 , 05:27   Re: [CS:GO] Kill Rewards (v1.0.0, 2016-11-07)
    Reply With Quote #6

    Quote:
    Originally Posted by OneMore View Post
    The plugin doesn't work correctly I've updated it. If someone interested in, I can upload... But I removed admin group support and updater support.
    upload please
    __________________
    PEACE FROM MOLDOVA
    eliteroyal is offline
    OneMore
    Senior Member
    Join Date: Feb 2019
    Old 06-04-2019 , 15:27   Re: [CS:GO] Kill Rewards (v1.0.0, 2016-11-07)
    Reply With Quote #7

    Code:
    #include <cstrike>
    #include <csgocolors>
    #include <sourcemod>
    #include <sdktools>
    
    ConVar g_hCvar_KW_Enable,
    g_hCvar_KW_hp_max,
    g_hCvar_KW_hp_kill,
    g_hCvar_KW_hp_hs,
    g_hCvar_KW_hp_knife,
    g_hCvar_KW_hp_nade,
    g_hCvar_KW_hp_messages,
    g_hCvar_KW_ap_max,
    g_hCvar_KW_ap_kill,
    g_hCvar_KW_ap_hs,
    g_hCvar_KW_ap_knife,
    g_hCvar_KW_ap_nade,
    g_hCvar_KW_ap_messages;
    
    bool g_bCvar_KW_Enable,
    g_bCvar_KW_ap_messages,
    g_bCvar_KW_hp_messages;
    
    int g_iCvar_KW_hp_max,
    g_iCvar_KW_hp_kill,
    g_iCvar_KW_hp_hs,
    g_iCvar_KW_hp_knife,
    g_iCvar_KW_hp_nade,
    g_iCvar_KW_ap_max,
    g_iCvar_KW_ap_kill,
    g_iCvar_KW_ap_hs,
    g_iCvar_KW_ap_knife,
    g_iCvar_KW_ap_nade;
    
    #define PLUGIN_VERSION          "1.0.0"
    #define PLUGIN_NAME             "[CS:GO] Kill Rewards"
    #define PLUGIN_DESCRIPTION      "Awards players on a successful kill with health and/or armor."
    
    #define CHAT_BANNER             "[\x04REWARD\x01]"
    
    public Plugin myinfo =
    {
        name                        = PLUGIN_NAME,
        description                 = PLUGIN_DESCRIPTION,
        version                     = PLUGIN_VERSION,
    }
    
    public void OnPluginStart()
    {
        LoadTranslations("common.phrases");
        LoadTranslations("killrewards.phrases");
    
        CreateConVar( "sm_killrewards_version", PLUGIN_VERSION, PLUGIN_DESCRIPTION, FCVAR_SPONLY | FCVAR_NOTIFY | FCVAR_DONTRECORD );
    
        g_hCvar_KW_Enable = CreateConVar("sm_killrewards_enable", "1", "Enable or Disable all features of the plugin.", _, true, 0.0, true, 1.0);
        g_hCvar_KW_hp_max = CreateConVar("sm_killrewards_hp_max", "100", "Maximum Health Points (HP).");
        g_hCvar_KW_hp_kill = CreateConVar("sm_killrewards_hp_kill", "5", "Health Points (HP) per kill.");
        g_hCvar_KW_hp_hs = CreateConVar("sm_killrewards_hp_hs", "10", "Health Points (HP) per headshot kill.");
        g_hCvar_KW_hp_knife = CreateConVar("sm_killrewards_hp_knife", "50", "Health Points (HP) per knife kill.");
        g_hCvar_KW_hp_nade = CreateConVar("sm_killrewards_hp_nade", "30", "Health Points (HP) per nade kill.");
        g_hCvar_KW_hp_messages = CreateConVar("sm_killrewards_hp_messages", "1", "Display HP messages.");
        g_hCvar_KW_ap_max = CreateConVar("sm_killrewards_ap_max", "100", "Maximum Armor Points (AP).");
        g_hCvar_KW_ap_kill = CreateConVar("sm_killrewards_ap_kill", "5", "Armor Points (AP) per kill.");
        g_hCvar_KW_ap_hs = CreateConVar("sm_killrewards_ap_hs", "10", "Armor Points (AP) per headshot kill.");
        g_hCvar_KW_ap_knife = CreateConVar("sm_killrewards_ap_knife", "50", "Armor Points (AP) per knife kill.");
        g_hCvar_KW_ap_nade = CreateConVar("sm_killrewards_ap_nade", "30", "Armor Points (AP) per nade kill.");
        g_hCvar_KW_ap_messages = CreateConVar("sm_killrewards_ap_messages", "1", "Display AP messages.");
    
        HookEvent("player_death", Event_PlayerDeath);
    
        AutoExecConfig(true, "killrewards");
    
        UpdateConVars();
    
        if (GetEngineVersion() != Engine_CSGO)
        {
            SetFailState("ERROR: This plugin is designed only for CS:GO.");
        }
    }
    
    public void OnConfigsExecuted()
    {
        UpdateConVars();
    }
    
    public Action Event_PlayerDeath(Event event, const char[] name, bool dontBroadcast)
    {
        if (g_bCvar_KW_Enable)
        {
            int attacker = GetClientOfUserId(event.GetInt("attacker"));
    
            char weapon[6];
            char hegrenade[16];
            char decoygrenade[16];
            GetEventString(event, "weapon", weapon, sizeof(weapon));
            GetEventString(event, "weapon", hegrenade, sizeof(hegrenade));
            GetEventString(event, "weapon", decoygrenade, sizeof(decoygrenade));
    
            bool validAttacker = (attacker != 0) && IsPlayerAlive(attacker);
    
            /* Reward attacker with HP. */
            if (validAttacker)
            {
                bool knifed = StrEqual(weapon, "knife");
                bool nades = StrEqual(hegrenade, "hegrenade");
                bool headshot = GetEventBool(event, "headshot");
    
                if ((knifed && (g_iCvar_KW_hp_knife > 0)) || (!knifed && (g_iCvar_KW_hp_kill > 0)) || (headshot && (g_iCvar_KW_hp_hs > 0)) || (nades && (g_iCvar_KW_hp_nade > 0)))
                {
                    int attackerHP = GetClientHealth(attacker);
    
                    if (attackerHP < g_iCvar_KW_hp_max)
                    {
                        int addHP;
                        if (knifed)
                            addHP = g_iCvar_KW_hp_knife;
                        else if (headshot)
                            addHP = g_iCvar_KW_hp_hs;
                        else if (nades)
                            addHP = g_iCvar_KW_hp_nade;
                        else
                            addHP = g_iCvar_KW_hp_kill;
                        int newHP = attackerHP + addHP;
                        if (newHP > g_iCvar_KW_hp_max)
                            newHP = g_iCvar_KW_hp_max;
                        SetEntProp(attacker, Prop_Send, "m_iHealth", newHP, 1);
                    }
    
                    if (g_bCvar_KW_hp_messages && !g_bCvar_KW_ap_messages)
                    {
                        if (knifed)
                            CPrintToChat(attacker, "%s \x04+%i HP\x01 %t", CHAT_BANNER, g_iCvar_KW_hp_knife, "HP Knife Kill");
                        else if (headshot)
                            CPrintToChat(attacker, "%s \x04+%i HP\x01 %t", CHAT_BANNER, g_iCvar_KW_hp_hs, "HP Headshot Kill");
                        else if (nades)
                            CPrintToChat(attacker, "%s \x04+%i HP\x01 %t", CHAT_BANNER, g_iCvar_KW_hp_knife, "HP Nade Kill");
                        else
                            CPrintToChat(attacker, "%s \x04+%i HP\x01 %t", CHAT_BANNER, g_iCvar_KW_hp_kill, "HP Kill");
                    }
                }
    
                /* Reward attacker with AP. */
                if ((knifed && (g_iCvar_KW_ap_knife > 0)) || (!knifed && (g_iCvar_KW_ap_kill > 0)) || (headshot && (g_iCvar_KW_ap_hs > 0)) || (nades && (g_iCvar_KW_ap_nade > 0)))
                {
                    int attackerAP = GetClientArmor(attacker);
    
                    if (attackerAP < g_iCvar_KW_ap_max)
                    {
                        int addAP;
                        if (knifed)
                            addAP = g_iCvar_KW_ap_knife;
                        else if (headshot)
                            addAP = g_iCvar_KW_ap_hs;
                        else if (nades)
                            addAP = g_iCvar_KW_ap_nade;
                        else
                            addAP = g_iCvar_KW_ap_kill;
                        int newAP = attackerAP + addAP;
                        if (newAP > g_iCvar_KW_ap_max)
                            newAP = g_iCvar_KW_ap_max;
                        SetEntProp(attacker, Prop_Send, "m_ArmorValue", newAP, 1);
                    }
    
                    if (g_bCvar_KW_ap_messages && !g_bCvar_KW_hp_messages)
                    {
                        if (knifed)
                            CPrintToChat(attacker, "%s \x04+%i AP\x01 %t", CHAT_BANNER, g_iCvar_KW_ap_knife, "AP Knife Kill");
                        else if (headshot)
                            CPrintToChat(attacker, "%s \x04+%i AP\x01 %t", CHAT_BANNER, g_iCvar_KW_ap_hs, "AP Headshot Kill");
                        else if (nades)
                            CPrintToChat(attacker, "%s \x04+%i AP\x01 %t", CHAT_BANNER, g_iCvar_KW_ap_nade, "AP Nade Kill");
                        else
                            CPrintToChat(attacker, "%s \x04+%i AP\x01 %t", CHAT_BANNER, g_iCvar_KW_ap_kill, "AP Kill");
                    }
                }
    
                if (g_bCvar_KW_hp_messages && g_bCvar_KW_ap_messages)
                {
                    if (knifed)
                        CPrintToChat(attacker, "%s \x04+%i HP\x01 & \x04+%i AP\x01 %t", CHAT_BANNER, g_iCvar_KW_hp_knife, g_iCvar_KW_ap_knife, "HP Knife Kill", "AP Knife Kill");
                    else if (headshot)
                        CPrintToChat(attacker, "%s \x04+%i HP\x01 & \x04+%i AP\x01 %t", CHAT_BANNER, g_iCvar_KW_hp_hs, g_iCvar_KW_ap_hs, "HP Headshot Kill", "AP Headshot Kill");
                    else if (nades)
                        CPrintToChat(attacker, "%s \x04+%i HP\x01 & \x04+%i AP\x01 %t", CHAT_BANNER, g_iCvar_KW_hp_nade, g_iCvar_KW_ap_nade, "HP Nade Kill", "AP Nade Kill");
                    else
                        CPrintToChat(attacker, "%s \x04+%i HP\x01 & \x04+%i AP\x01 %t", CHAT_BANNER, g_iCvar_KW_hp_kill, g_iCvar_KW_ap_kill, "HP Kill", "AP Kill");
                }
            }
        }
        return Plugin_Handled;
    }
    
    UpdateConVars()
    {
        g_bCvar_KW_Enable = GetConVarBool(g_hCvar_KW_Enable);
        g_iCvar_KW_hp_max = GetConVarInt(g_hCvar_KW_hp_max);
        g_iCvar_KW_hp_kill = GetConVarInt(g_hCvar_KW_hp_kill);
        g_iCvar_KW_hp_hs = GetConVarInt(g_hCvar_KW_hp_hs);
        g_iCvar_KW_hp_knife = GetConVarInt(g_hCvar_KW_hp_knife);
        g_iCvar_KW_hp_nade = GetConVarInt(g_hCvar_KW_hp_nade);
        g_bCvar_KW_hp_messages = GetConVarBool(g_hCvar_KW_hp_messages);
        g_iCvar_KW_ap_max = GetConVarInt(g_hCvar_KW_ap_max);
        g_iCvar_KW_ap_kill = GetConVarInt(g_hCvar_KW_ap_kill);
        g_iCvar_KW_ap_hs = GetConVarInt(g_hCvar_KW_ap_hs);
        g_iCvar_KW_ap_knife = GetConVarInt(g_hCvar_KW_ap_knife);
        g_iCvar_KW_ap_nade = GetConVarInt(g_hCvar_KW_ap_nade);
        g_bCvar_KW_ap_messages = GetConVarBool(g_hCvar_KW_ap_messages);
    }
    Attached Files
    File Type: smx killrewards.smx (10.4 KB, 195 views)
    OneMore is offline
    eliteroyal
    AlliedModders Donor
    Join Date: Dec 2016
    Location: Moldova
    Old 06-06-2019 , 12:46   Re: [CS:GO] Kill Rewards (v1.0.0, 2016-11-07)
    Reply With Quote #8

    Thx bro, but i tested the original from the first post and it seems to work good
    what problems did u find in it?
    __________________
    PEACE FROM MOLDOVA
    eliteroyal is offline
    OneMore
    Senior Member
    Join Date: Feb 2019
    Old 06-07-2019 , 08:33   Re: [CS:GO] Kill Rewards (v1.0.0, 2016-11-07)
    Reply With Quote #9

    Quote:
    Originally Posted by eliteroyal View Post
    Thx bro, but i tested the original from the first post and it seems to work good
    what problems did u find in it?
    I do not remember, to be honest. It was long ago. But I recompiled it with the latest sourcemod at least.
    OneMore is offline
    OneMore
    Senior Member
    Join Date: Feb 2019
    Old 06-07-2019 , 08:41   Re: [CS:GO] Kill Rewards (v1.0.0, 2016-11-07)
    Reply With Quote #10

    You can compare the conditions string. It was wrong written in the previous version.
    This one is correct
    if ((knifed && (g_iCvar_KW_hp_knife > 0)) || (!knifed && (g_iCvar_KW_hp_kill > 0)) || (headshot && (g_iCvar_KW_hp_hs > 0)) || (nades && (g_iCvar_KW_hp_nade > 0)))
    This one from the original is incorrect
    if ((knifed && (g_iCvar_KW_hp_kill > 0)) || (!knifed && (g_iCvar_KW_hp_kill > 0)) || (headshot && (g_iCvar_KW_hp_hs > 0)) || (!headshot && (g_iCvar_KW_hp_kill > 0)))

    So I changed conditions to work correctly.
    OneMore 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 23:24.


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