Raised This Month: $4 Target: $400
 1% 

[L4D & L4D2] Gear Transfer (2.9) [01-Apr-2020]


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Silvers
AlliedModders Donor
Join Date: Aug 2010
Location: SpaceX
Plugin ID:
1941
Plugin Version:
2.9
Plugin Category:
Gameplay
Plugin Game:
Left 4 Dead
Plugin Dependencies:
    Servers with this Plugin:
    389 
    Plugin Description:
    Allows items (molotov,pipebomb,vomitjar,defibrillator,first aid,explosive & incendiary rounds) to be transferred. Bots can auto give/grab items.
    Old 09-07-2010 , 12:27   [L4D & L4D2] Gear Transfer (2.9) [01-Apr-2020]
    Reply With Quote #1

    Thanks:

    A big thanks to DJ_WEST for Grenade Transfer which I used to build this.
    A massive thanks to Mr.RuyC and NanX for help testing and using their server for many, many hours!
    Also thanks to AtomicStryker and cheewongken for tips on improving the plugin, greatly appreciated!

    Thanks to Lux for testing v2.0 and lots of advice and ideas on optimizing.
    Thanks to Dragokas and disawar1 for testing version 2.0.

    Thanks to JoBarfCreepy for Danish translations.
    Thanks to Tertius Gaudens for German translations.
    Thanks to disawar1 for Russian translations.
    Thanks to januto for Spanish translations.
    Thanks to bazrael for Traditional Chinese translations.



    About:
    • Transfers: molotovs, pipebombs, vomitjars, defibrillators, first aid kits, pain pills, adrenaline, explosive and incendiary rounds.
    • Survivor bots can pick up nearby items. (Auto Grab)
    • Survivor bots can give their items to players with none. (Auto Give)
    • Allows players to give items to other players.
    • Allows players to give, grab or switch items with a survivor bot.
    • Bots auto give/grab order can be re-arranged. Read "ORDER GRAB/GIVE" section inside the code and recompile.
    • l4d_gear_transfer_notify 1 will display text to chat like this:


    How to use:

    - SHOVE (right click melee) or press your RELOAD (default R) key whilst looking directly at another survivor.



    CVars:

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

    PHP Code:
    l4d_gear_transfer_allow "1"                 // 0=Plugin Off, 1=Plugin On.
    l4d_gear_transfer_dist_give "150.0"         // How close you have to be to transfer an item Affects bots auto give.
    l4d_gear_transfer_dist_grab "150.0"         // How close the bots need to be for them to pick up an item.
    l4d_gear_transfer_method "3"                // 0=Off. 1=Shove only, 2=Reload key only, 3=Shove and Reload key to transfer items.
    l4d_gear_transfer_modes_bot ""              // Disallow bots from auto give/grab in these game modes, separate by commas (no spaces). (Empty = none).
    l4d_gear_transfer_modes_off ""              // Turn off the plugin in these game modes, separate by commas (no spaces). (Empty = none).
    l4d_gear_transfer_modes_on ""               // Turn on the plugin in these game modes, separate by commas (no spaces). (Empty = all).
    l4d_gear_transfer_modes_tog "0"             // Turn on the plugin in these game modes. 0=All, 1=Coop, 2=Survival, 4=Versus, 8=Scavenge. Add numbers together.
    l4d_gear_transfer_notify "1"                // 0=Off, 1=Display transfer info to everyone through chat messages.
    l4d_gear_transfer_sounds "1"                // 0=Off, 1=Play a sound to the person giving/receiving an item.
    l4d_gear_transfer_timeout "5"               // Timeout to stop bots returning an item after switching with a player. Timeout to prevent bots auto grabbing a recently dropped item.
    l4d_gear_transfer_timer_give "1.0"          // 0.0=Off. How often to check survivor bot positions to real clients for auto give.
    l4d_gear_transfer_timer_grab "0.5"          // 0.0=Off. How often to check survivor bot positions to item positions for auto grab.
    l4d_gear_transfer_traces "15"               // Maximum number of ray traces per frame for auto give/grab. This could be increased with minimal impact.
    l4d_gear_transfer_types_give "123456789"    // Which type can bots auto give. 0=Off. 1=Adrenaline, 2=Pain Pills, 3=Molotov, 4=Pipe Bomb, 5=Vomit Jar, 6=First Aid, 7=Explosive Rounds, 8=Incendiary Rounds, 9=Defibrillator. Any string combination.
    l4d_gear_transfer_types_grab "123456789"    // Which type can bots auto grab. 0=Off. 1=Adrenaline, 2=Pain Pills, 3=Molotov, 4=Pipe Bomb, 5=Vomit Jar, 6=First Aid, 7=Explosive Rounds, 8=Incendiary Rounds, 9=Defibrillator. Any string combination.
    l4d_gear_transfer_types_real "123456789"    // The types real players can transfer. 0=Off. 1=Adrenaline, 2=Pain Pills, 3=Molotov, 4=Pipe Bomb, 5=Vomit Jar, 6=First Aid, 7=Explosive Rounds, 8=Incendiary Rounds, 9=Defibrillator. Any string combination.
    l4d_gear_transfer_vocalize "1"              // 0=Off. 1=Players vocalize when transferring items. Blocked for the first 60 seconds of a new round.
    l4d_gear_transfer_version                   // Gear Transfer plugin version. 


    Changes:
    Code:
    2.9 (01-Apr-2020)
        - Fixed "IsAllowedGameMode" from throwing errors when the "_tog" cvar was changed before MapStart.
    
    2.8 (28-Feb-2020)
        - Fixed duplicating weapons bug (bots picking invisible _spawn items). Thanks to "ridiculousties" for reporting.
        - Fixed clients swapping to pistols. Thanks to "TiTz" for reporting.
        - Switching grenades now keeps the grenade equipped.
    
    2.7 (11-Feb-2020)
        - Fixed switching first aid with bots instead of healing them.
        - Fixed bots auto giving straight away after you gave them adrenaline/pills.
        - Fixed players instantly grabbing from bots after they gave adrenaline/pills.
    
    2.6 (06-Jan-2020)
        - Fixed not being able to grab adrenaline/pills from shoving. Thanks to "KillerBudgie" for reporting.
    
    2.5 (05-Jan-2020)
        - Added additional checks to prevent OnWeaponEquip errors. Thanks to "Mr. Man" for reporting.
    
    2.4 (09-Nov-2019)
        - Fixed Molotov idle sound not stopping on transfer. Thanks to "ceasedU" for reporting.
        - Fixed not picking up items in Survival/after round restart due to last version fixes.
    
    2.3 (09-Nov-2019)
        - Fixed "Invalid memory access". Thanks to "Lux" for reporting.
        - Fixed bots not always picking up items.
    
    2.2 (04-Nov-2019)
        - Additional optimization for L4D1.
    
    2.1 (01-Nov-2019)
        - Fixed error from missing event "weapon_drop" in L4D1. Thanks to "Dragokas" for reporting.
    
    2.0 (01-Nov-2019)
        - Plugin overhauled and optimized. Several times faster than the previous version.
        - Profiler used to determine the best procedures for least CPU cycles.
        - Auto give/grab features and item exchange with reload/shove key is much more optimized.
        - Cvars have been changed and renamed. Please delete or backup and update your old cvars config.
    
        - Thanks to "Lux" for testing and lots of advice and ideas on optimizing.
        - Thanks to "Dragokas" and "disawar1" for testing.
    
    1.6.5 (21-Oct-2019)
        - Fixed invalid entity errors from "Prototype Grenades" support changes. Thanks to "Dragokas" for reporting.
    
    1.6.4 (18-Oct-2019)
        - Blocks transferring items when pressing Shoot + Shove, to support "Prototype Grenades" plugin.
    
    1.6.3 (10-Oct-2019)
        - Added support for "Prototype Grenades" plugin.
    
    1.6.2 (19-Aug-2019)
        - Prevents auto grab and auto give during intro cut scenes.
    
    1.6.1.1 (09-May-2019) (Dragokas)
        - Added detection of sex additionally by character (for custom models).
    
    1.6.1 (14-Aug-2018)
        - Removed LogError "Tracer Bug".
    
    1.6.0 (05-May-2018)
        - Converted plugin source to the latest syntax utilizing methodmaps. Requires SourceMod 1.8 or newer.
        - Changed cvar "l4d_gear_transfer_modes_tog" now supports L4D1.
    
    1.5.12 (17-Jul-2017)
        - Fixed invalid entity error - Thanks to "Newbie_Sexy" for reporting and "Visual77" for some code.
    
    1.5.11 (25-Jun-2017)
        - Fixed client not connected errors - Thanks to "Lux" for reporting.
        - Fixed depreciated FCVAR_PLUGIN flag.
    
    1.5.10 (10-May-2012)
        - Added Traditional Chinese translations - Thanks to "bazrael".
        - Added cvar "l4d_gear_transfer_vocalize" to control transfer vocalizes - Thanks to "bazrael" for the request.
    
    1.5.9 (31-Mar-2012)
        - Fixed the last update breaking auto give and auto grab.
    
    1.5.8 (30-Mar-2012)
        - Added Russian translations - Thanks to "disawar1".
        - Added cvar "l4d_gear_transfer_modes_on" to control which game modes the plugin works in.
        - Added cvar "l4d_gear_transfer_modes_tog" same as above, but only works for L4D2.
    
    1.5.7 (18-Oct-2011)
        - Fires the item_pickup and player_use events when bots auto grab. Required for Footlocker Spawner 1.2+.
    
    1.5.6 (20-Apr-2011)
        - Added cvar 'l4d_gear_transfer_modes_off' to turn off the plugin on certain game modes.
        - Fixed deleting grenade spawns which give infinite items.
    
    1.5.5 (30-Jan-2011)
        - Changed the bot allow cvars (as requested by "LTR.2") so you can specify which items bots auto give/grab.
    
    1.5.4 (06-Jan-2011)
        - Another attempt to fix 'm_humanSpectatorUserID' errors.
        - Added chat notifications block from round start the same as vocalize block.
    
    1.5.3 (04-Jan-2011)
        - Changed the previous check to make sure the netclass is 'SurvivorBot', should stop all related errors.
    
    1.5.2 (02-Jan-2011)
        - Added check for 'bebop_bot_fakeclient' which caused errors.
        - Removed the -attack2 after shoves thanks to Valve patching some client commands.
    
    1.5.1 (09-Dec-2010)
        - Added IsVisibleTo for player to player transfers (stops transfers through walls!)
        - Fixed auto give transferring directly after a player to player transfer.
    
    1.5.0 (03-Dec-2010)
        - Optimized a lot code.
        - Fixed allow cvars not restricting their correct items.
        - Added cvar 'l4d_gear_transfer_modes' to disable auto give/grab in listed game modes.
        - Added cvar 'l4d_gear_transfer_timer_item' to specify how often the auto grab item list updates.
        - Added delay to auto give when switching items with bots.
        - Added vocalize block for 60 seconds from round start.
        - Added check for translation file.
        - Added finale_vehicle_leaving event to disable auto give/grab.
        - Added notifications for auto give/grab when 'l4d_gear_transfer_notify' is enabled.
        - Removed hint text when l4d_gear_transfer_notify set to 2. Now only shows chat notifications.
    
    1.4.11 (27-Oct-2010)
        - Added ("-attack2") to stop shoving after successful transfer.
        - Added FCVAR_DONTRECORD flag to the version cvar.
    
    1.4.10 (21-Oct-2010)
        - Fixed 'switch' translation being given the wrong weapon name.
        - Changed weapon name text color to yellow.
    
    1.4.9 (19-Oct-2010)
        - Fixed player_shoved transfers not working because of a missing exclamation mark!
    
    1.4.8 (16-Oct-2010)
        - Fixed Infected receiving items.
    
    1.4.7 (16-Oct-2010)
        - Optimized auto give a little.
    
    1.4.6 (16-Oct-2010)
        - Re-added FileExists check for scenes, now using Valve's Filesystem!
        - Small changes.
    
    1.4.5 (14-Oct-2010)
        - Re-added player_shoved event to transfer items.
        - Removed FileExists check from scenes, now vocalizes L4D1 characters!
    
    1.4.4 (12-Oct-2010)
        - Fixed creating dupe grenades when throwing.
    
    1.4.3 (12-Oct-2010)
        - Fixed AutoTimer rubbish!
        - Stopped auto give/grab when survivor is incapped/reviving.
    
    1.4.2 (10-Oct-2010)
        - Small fixes.
    
    1.4.1 (07-Oct-2010)
        - Added displaying transfers in chat messages with translations.
        - Changed some vocalize parts for The Sacrifice update.
    
    1.4.0.1 (03-Oct-2010)
        - Fixed disabling shove transfers with first aid.
    
    1.4.0 (03-Oct-2010)
        - Officially supports the first Left4Dead!
        - Added check so bots will not auto grab "projectile" grenades.
        - Added check so bots will not auto grab items who have owners.
        - Added cvars to allow/disallow bots to auto give/grab certain items.
        - Changed cvars to comply with releasing guidelines.
        - Idle players no longer treated as bots.
    
    1.3.0 (01-Oct-2010)
        - Small changes to auto grab.
    
    1.2.9 (29-Sep-2010)
        - Disabled transfers with incapacitated players.
        - Fixed disabling auto give/grab in versus.
        - Changed the fix for auto grab creating two grenades again.
        - Removed player_shoved event, reload+shove transfer from OnPlayerRunCmd.
    
    1.2.8 (27-Sep-2010)
        - Changed the fix for auto grab creating two grenades.
    
    1.2.7 (27-Sep-2010)
        - Fixed auto grab creating two grenades!
        - Delaying all bots for 3 seconds after they receive an item.
    
    1.2.6 (26-Sep-2010)
        - Optimized code.
        - TraceFilter added on survivors so they don't block transfers.
    
    1.2.5 (22-Sep-2010)
        - Delayed bots auto give for 3 seconds after they are given an item.
    
    1.2.4 (21-Sep-2010)
        - Fixed auto give when sb_all_bot_team.
    
    1.2.3 (21-Sep-2010)
        - Added weapon_given hook to stop pills/adrenaline being given back!
    
    1.2.2 (21-Sep-2010)
        - Minor changes.
    
    1.2.1 (21-Sep-2010)
        - Added adrenaline and pain pills to transfers. You can only use the reload key to switch.
        - Added cvars to allow/disallow the above transfers.
        - Added vocalize on first aid kit transfers.
    
    1.2.0 (19-Sep-2010)
        - Renamed more appropriately to "Gear Transfer".
        - Added defibrillators, first aid kits, explosive and incendiary rounds to transfers.
        - Added cvars to allow/disallow the transfer of certain items.
        - Changed the transfer being triggered by the Use key to the Reload key.
        - Disabled auto give/grab in versus games (as they should be full with players!).
    
    1.1.2 (15-Sep-2010)
        - Removed HookSingleEntityOutput, which was causing crashes.
    
    1.1.1 (11-Sep-2010)
        - Some fixes.
    
    1.1.0 (09-Sep-2010)
        - Added "AtomicStryker"'s Vocalize with scenes.
    
    1.03.0 (08-Sep-2010)
        - Removed Vocalize stuff.
    
    1.02.0 (08-Sep-2010)
        - Changed things "AtomicStryker" suggested.
    
    1.0.1 (08-Sep-2010)
        - Fixed UnhookEvent error.
        - Added check in case of over 64 grenades.
    
    1.0.0 (07-Sep-2010)
        - Initial release.


    Installation:
    1. Click "Get Plugin" and put the .smx file into your servers \addons\sourcemod\plugins\ folder.
    2. Download "translations_gear_transfer.zip" and extract the "translations" folder to your servers \addons\sourcemod\ folder.

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

    Current Translations: English (en), Chinese Traditional (zho), Danish (da), German (de), Portuguese (pt), Russian (ru), Spanish (es).
    Attached Files
    File Type: zip translations_gear_transfer.zip (3.8 KB, 12966 views)
    File Type: sp Get Plugin or Get Source (l4d_gear_transfer.sp - 52 views - 69.9 KB)
    __________________

    Last edited by Silvers; 03-31-2020 at 22:57.
    Silvers is offline
    Silvers
    AlliedModders Donor
    Join Date: Aug 2010
    Location: SpaceX
    Old 09-07-2010 , 12:35   Re: [L4D2] Bot Grenade Transfer
    Reply With Quote #2

    Space.... (While we're on the subject of space, look at this: https://apod.nasa.gov/)
    __________________

    Last edited by Silvers; 10-10-2019 at 04:05.
    Silvers is offline
    Sev
    Veteran Member
    Join Date: May 2010
    Old 09-07-2010 , 13:23   Re: [L4D2] Bot Grenade Transfer
    Reply With Quote #3

    Add in 'bot throw grenade' on top of bot transfer grenade and im sold.
    Sev is offline
    LTR.2
    Veteran Member
    Join Date: Aug 2009
    Old 09-07-2010 , 16:28   Re: [L4D2] Bot Grenade Transfer
    Reply With Quote #4

    awesome!
    LTR.2 is offline
    IronWarrior
    Veteran Member
    Join Date: Jan 2010
    Old 09-08-2010 , 00:46   Re: [L4D2] Bot Grenade Transfer
    Reply With Quote #5

    Awesome, thank you.
    IronWarrior is offline
    mikhdenis
    Member
    Join Date: Aug 2009
    Location: Ukraine
    Old 09-08-2010 , 08:44   Re: [L4D2] Bot Grenade Transfer
    Reply With Quote #6

    Code:
     09/08/2010 - 15:34:51: [SM] Native "UnhookEvent" reported: Invalid hook callback specified for game event "player_shoved"
    L 09/08/2010 - 15:34:51: [SM] Displaying call stack trace for plugin "l4d2_bot_grenade_transfer_1.0.smx":
    L 09/08/2010 - 15:34:51: [SM]   [0]  Line 173, D:\left4dead2VS\left4dead2\left4dead2\addons\sourcemod\scripting\l4d2_bot_grenade_transfer_1.0.sp::UnhookEvents()
    L 09/08/2010 - 15:34:51: [SM]   [1]  Line 120, D:\left4dead2VS\left4dead2\left4dead2\addons\sourcemod\scripting\l4d2_bot_grenade_transfer_1.0.sp::Event_RoundEnd()
    mikhdenis is offline
    Silvers
    AlliedModders Donor
    Join Date: Aug 2010
    Location: SpaceX
    Old 09-08-2010 , 12:46   Re: [L4D2] Bot Grenade Transfer
    Reply With Quote #7

    Thank you, it's updated, should not happen anymore.
    __________________
    Silvers is offline
    AtomicStryker
    Veteran Member
    Join Date: Apr 2009
    Location: Teutonia!!
    Old 09-08-2010 , 14:24   Re: [L4D2] Bot Grenade Transfer
    Reply With Quote #8

    After looking over it, some suggestions:


    PHP Code:
    public PlaySound(client, const String:s_Sound[32]) 
    Theres no reason for this to be public

    You might want to add a trigger delay/timer to your OnClientRunCmd because if everyone pressed USE at once and kept it pressed im fairly certain the server would feel a spike

    PHP Code:
        decl i_UserIDi_Victimi_Attacker
    decl is not needed or useful for single Cell (=int) types

    PHP Code:
                    if (GetConVarInt(c_SoundsOn)) {PlaySound(i_VictimSOUND_LITTLEREWARD);}
                    if (
    GetConVarInt(c_SoundsOn)) {PlaySound(i_AttackerSOUND_BIGREWARD);} 
    Why not just use one if


    Consider using CheatClientCommand and the likes of "give pipe_bomb" instead, to fix equip issues

    PHP Code:
    ClientCommand(i_Attacker,g_Vocalize[i]); 
    I dont think Clientcommand vocalizing works. Does it?



    PHP Code:
        for (new client 1client MaxClientsclient++) {

            
    // Client in game, team survivor, is alive, with no grenade
            
    if (IsClientInGame(client) && GetClientTeam(client) == && GetClientHealth(client) > && GetPlayerWeaponSlot(client2) == -1) {
                
    decl Float:f_TargetPos[3]; // = grenade (auto grab)
                
    decl Float:f_ClientPos[3]; // = bot
                
    decl Float:f_PlayerPos[3]; // = human player
                
    decl String:s_EdictClassName[32];
                
    decl String:s_Temp[32]; 
    Put the local variables infront of the loop
    AtomicStryker is offline
    Silvers
    AlliedModders Donor
    Join Date: Aug 2010
    Location: SpaceX
    Old 09-08-2010 , 14:46   Re: [L4D2] Bot Grenade Transfer
    Reply With Quote #9

    Thanks for pointing those out, seems fairly obvious now!

    Edit: Clientcommand vocalizing does not work.
    __________________

    Last edited by Silvers; 10-22-2010 at 10:48.
    Silvers is offline
    cheewongken
    Senior Member
    Join Date: Feb 2009
    Old 09-08-2010 , 15:24   Re: [L4D2] Bot Grenade Transfer
    Reply With Quote #10

    wow.. you uploaded it after all!

    will grab this tomorrow morning.
    cheewongken 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 00:26.


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