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

[L4D2] Gift Rewards (1.9) [10-Jan-2024]


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Plugin ID:
6840
Plugin Version:
1.9
Plugin Category:
Fun Stuff
Plugin Game:
Left 4 Dead
Plugin Dependencies:
    Servers with this Plugin:
    21 
    Plugin Description:
    Gives random rewards when picking up gifts.
    Old 12-02-2019 , 17:54   [L4D2] Gift Rewards (1.9) [10-Jan-2024]
    Reply With Quote #1




    Related Plugins:

    Thanks:
    • Lux for the WeaponHandling_API plugin and reward suggestion.


    About:
    • It's holiday time and servers are spawning Valves Christmas gifts, but they have no reward... (except adding toward an Achievement).
    • This rewards players when picking up gifts:
    • Health: Restores full health.
    • Ammo: Refills full ammo.
    • Speed: Increases shooting and reloading speed. Requires the WeaponHandling_API plugin.
    • Rewards are chance based using a weighted selection. Only one will trigger per gift.
    • Note: game cvar "z_holiday_gift_drop_chance" and plugin cvar "l4d2_gift_rewards_drop" to control the chance of dropping on Special Infected death.
    • Gifts expire after 30 seconds. Game default.



    Admin Commands: (requires "z" flag)

    PHP Code:
    sm_gift      // Spawns a gift at where you're looking.
    sm_gifter    // Gives yourself a reward. For testing. 


    CVars:

    Saved to l4d2_gift_rewards.cfg in your servers \cfg\sourcemod\ folder.

    PHP Code:
    // 0=Plugin off, 1=Plugin on.
    l4d2_gift_rewards_allow "1"

    // Chance to completely refill a players ammo.
    l4d2_gift_rewards_chance_ammo "100"

    // Chance to restore a players health to full.
    l4d2_gift_rewards_chance_heal "100"

    // Chance to reward increased speed for: shooting, reloading and deploying. Requires WeaponHandling API plugin.
    l4d2_gift_rewards_chance_speed "100"

    // 0=No restriction. This number of Special Infected must die before allowing the drop chance of spawning a Gift.
    l4d2_gift_rewards_count "5"

    // -1.0=Use games z_holiday_gift_drop_chance cvar value. 0.0=Off. 1.0=Maximum chance. The chance to randomly drop gifts on Special Infected death.
    l4d2_gift_rewards_drop "-1.0"

    // 0.0=Off. Reduces the size of gifts over this many seconds.
    l4d2_gift_rewards_size "20.0"

    // Duration the increased speed affects a player.
    l4d2_gift_rewards_speed "20.0"

    // Turn on the plugin in these game modes, separate by commas (no spaces). (Empty = all).
    l4d2_gift_rewards_modes ""

    // Turn off the plugin in these game modes, separate by commas (no spaces). (Empty = none).
    l4d2_gift_rewards_modes_off ""

    // Turn on the plugin in these game modes. 0=All, 1=Coop, 2=Survival, 4=Versus, 8=Scavenge. Add numbers together.
    l4d2_gift_rewards_modes_tog "0"

    // Gift Rewards plugin version.
    l4d2_gift_rewards_version 



    Changes:
    Code:
    1.9 (10-Jan-2024)
        - Changed the plugins on/off/mode cvars to use the Left4DHooks (if available) method instead of creating an entity.
    
    1.8 (09-Dec-2022)
        - Fixed refilling ammo giving to wrong client due to Valve code inside "givecurrentammo" command. Thanks to "GL_INS" for reporting.
        - Now optionally uses "Left 4 DHooks" to refill the weapon clip.
    
    1.7 (08-Mar-2022)
        - Fixed cvar "l4d2_gift_rewards_count" not resetting the death count. Thanks to "mikaelangelis" for reporting.
    
    1.6 (04-Jul-2021)
        - Added cvar "l4d2_gift_rewards_count" to control how many SI must die before allowing the chance of dropping a Gift.
    
    1.5 (03-Jul-2021)
        - Added cvar "l4d2_gift_rewards_drop" to control the chance of dropping gifts when Special Infected die.
        - By default the plugin uses the games chance from "z_holiday_gift_drop_chance" cvar.
        - No longer patches the game to drop gifts in all game modes. (Code left for demonstration purposes).
    
    1.4 (16-Jun-2021)
        - L4D2: Compatibility update for "2.2.1.3" update. Thanks to "N.U.S.C." for reporting.
        - GameData .txt file and plugin updated.
    
    1.3a (24-Sep-2020)
        - Compatibility update for L4D2's "The Last Stand" update.
        - GameData .txt file updated.
    
    1.3 (10-May-2020)
        - Added better error log message when gamedata file is missing.
        - Extra checks to prevent "IsAllowedGameMode" throwing errors.
        - Various changes to tidy up code.
    
    1.2 (10-Apr-2020)
        - Patched out Holiday requirement and Versus mode restriction.
        - GameData and plugin updated.
    
    1.1 (01-Apr-2020)
        - Fixed "IsAllowedGameMode" from throwing errors when the "_tog" cvar was changed before MapStart.
    
    1.0 (03-Dec-2019)
        - Initial release.


    Optional Plugin
    Updating from 1.5 or older:
    • New cvars have been added: use the Cvar Configs Updater, or delete the old cvars config or manually add them.

    Installation
    1. Click "Get Plugin" and put the .smx file into your servers \addons\sourcemod\plugins\ folder.
    2. Download "l4d2_gift_rewards.txt" and save to your servers \addons\sourcemod\gamedata\ folder.
    Attached Files
    File Type: sp Get Plugin or Get Source (l4d2_gift_rewards.sp - 301 views - 27.0 KB)
    File Type: txt l4d2_gift_rewards.txt (1.7 KB, 1385 views)
    __________________

    Last edited by Silvers; 01-10-2024 at 11:45.
    Silvers is offline
    mikaelangelis
    Senior Member
    Join Date: Oct 2017
    Old 12-09-2019 , 05:03   Re: [L4D2] Gift Rewards (1.0) [03-Dec-2019]
    Reply With Quote #2

    excuse me, how to make gift random spawn or appear without typing sm_gift and without depending on christmas tree?

    Last edited by mikaelangelis; 12-09-2019 at 15:01.
    mikaelangelis is offline
    HarryPotter
    Veteran Member
    Join Date: Sep 2017
    Location: Taiwan, Asia
    Old 12-09-2019 , 22:51   Re: [L4D2] Gift Rewards (1.0) [03-Dec-2019]
    Reply With Quote #3

    Quote:
    Originally Posted by mikaelangelis View Post
    excuse me, how to make gift random spawn or appear without typing sm_gift and without depending on christmas tree?
    gift is an item created by plugin
    I don't think you can make gift random spawn just like weapons or medical items on the map
    __________________
    HarryPotter is offline
    cravenge
    Veteran Member
    Join Date: Nov 2015
    Location: Chocolate Factory
    Old 12-10-2019 , 01:34   Re: [L4D2] Gift Rewards (1.0) [03-Dec-2019]
    Reply With Quote #4

    Quote:
    Originally Posted by fbef0102 View Post
    gift is an item created by plugin
    I don't think you can make gift random spawn just like weapons or medical items on the map
    The gift is actually a feature in the game, but only limited to Versus game modes afaik. It's usually disabled when Christmas is too far to be celebrated or already ended.

    And yes, like what it says in the description, it's just there for the achievement and no rewards are given whatsoever when a player grabs it.

    Last edited by cravenge; 12-10-2019 at 01:34.
    cravenge is offline
    HarryPotter
    Veteran Member
    Join Date: Sep 2017
    Location: Taiwan, Asia
    Old 12-10-2019 , 02:54   Re: [L4D2] Gift Rewards (1.0) [03-Dec-2019]
    Reply With Quote #5

    Quote:
    Originally Posted by cravenge View Post
    The gift is actually a feature in the game, but only limited to Versus game modes afaik.
    you are right, I was wrong, I totally forgot there is a l4d2 Christmas gift achievement
    maybe try "sm_cvar z_holiday_gift_drop_chance" to make gift random spawn
    __________________

    Last edited by HarryPotter; 12-10-2019 at 02:55.
    HarryPotter is offline
    kelvin31
    Member
    Join Date: May 2010
    Old 12-12-2019 , 20:36   Re: [L4D2] Gift Rewards (1.0) [03-Dec-2019]
    Reply With Quote #6

    hello, would you enhancing it for after killng tank or special infected, is it work?
    kelvin31 is offline
    mikaelangelis
    Senior Member
    Join Date: Oct 2017
    Old 04-10-2020 , 06:40   Re: [L4D2] Gift Rewards (1.1) [01-Apr-2020]
    Reply With Quote #7

    P.S: excuse me, I tried "sm_cvar z_holiday_gift_drop_chance 100" and I killed every common zombie and special infected, no gift drop
    mikaelangelis is offline
    Silvers
    SourceMod Plugin Approver
    Join Date: Aug 2010
    Location: SpaceX
    Old 04-10-2020 , 07:42   Re: [L4D2] Gift Rewards (1.1) [01-Apr-2020]
    Reply With Quote #8

    Quote:
    Originally Posted by mikaelangelis View Post
    P.S: excuse me, I tried "sm_cvar z_holiday_gift_drop_chance 100" and I killed every common zombie and special infected, no gift drop
    Gift drops are only enabled by the game around Christmas time. I could add a memory patch to always enable them but I'm not sure if Valve would like that since they add up to give an achievement.
    __________________
    Silvers is offline
    mikaelangelis
    Senior Member
    Join Date: Oct 2017
    Old 04-10-2020 , 08:46   Re: [L4D2] Gift Rewards (1.1) [01-Apr-2020]
    Reply With Quote #9

    Quote:
    Originally Posted by Silvers View Post
    Gift drops are only enabled by the game around Christmas time. I could add a memory patch to always enable them but I'm not sure if Valve would like that since they add up to give an achievement.
    isn't that achievement all disabled with -insecure option as we host a local server?
    I hate the fact that I need to change the date/time to december to make the plugin work, quite handful. I hope you could add memory patch or whatever possible :> I really like this plugin
    mikaelangelis is offline
    Silvers
    SourceMod Plugin Approver
    Join Date: Aug 2010
    Location: SpaceX
    Old 04-10-2020 , 09:17   Re: [L4D2] Gift Rewards (1.1) [01-Apr-2020]
    Reply With Quote #10

    Quote:
    Originally Posted by mikaelangelis View Post
    I hate the fact that I need to change the date/time to december to make the plugin work
    hahah!

    Quote:
    Originally Posted by mikaelangelis View Post
    isn't that achievement all disabled with -insecure option as we host a local server?
    Probably but this plugin isn't strictly used by -insecure local hosts, so it would be allowed for others where achievements are generated.

    Well it might be ok to enable anytime, the games so old and Valve probably don't care anyway. I can look into patching to work anytime, and it seems to only work in Versus? That can be removed too and allow all modes. Will look into it next few days.
    __________________

    Last edited by Silvers; 04-10-2020 at 09:18.
    Silvers 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 11:29.


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