AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [L4D & L4D2] Gear Transfer (1.6.3) [10-Oct-2019] (https://forums.alliedmods.net/showthread.php?t=137616)

Silvers 09-07-2010 12:27

[L4D & L4D2] Gear Transfer (1.6.3) [10-Oct-2019]
 
17 Attachment(s)
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 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.
  • l4d_gear_transfer_notify 1 will display text to chat like this:
http://i.imgur.com/i2Enc9w.jpg


How to use:

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



Potential issues:

There may be lag skips/pauses each time l4d_gear_transfer_timer and l4d_gear_transfer_timer_item execute. The first timer runs if l4d_gear_transfer_auto_give or l4d_gear_transfer_auto_grab is enabled. The first timer checks if the bots are in range to a survivor to transfer an item or in range to pick up an item. If auto grab is enabled the second timer (l4d_gear_transfer_timer_item) will execute, which searches for the items to pick up.



CVars:

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

PHP Code:

// 0=Off, 1=Enables the transfer of adrenaline.
l4d_gear_transfer_allow_adr "1"

// 0=Off, 1=Enables the transfer of defibrillators.
l4d_gear_transfer_allow_def "1"

// 0=Off, 1=Enables the transfer of explosive rounds.
l4d_gear_transfer_allow_exp "1"

// 0=Off, 1=Enables the transfer of first aid kits.
l4d_gear_transfer_allow_fir "1"

// 0=Off, 1=Enables the transfer of incendiary ammo.
l4d_gear_transfer_allow_inc "1"

// 0=Off, 1=Enables the transfer of molotovs.
l4d_gear_transfer_allow_mol "1"

// 0=Off, 1=Enables the transfer of pain pills.
l4d_gear_transfer_allow_pil "1"

// 0=Off, 1=Enables the transfer of pipe bombs.
l4d_gear_transfer_allow_pip "1"

// 0=Off, 1=Enables the transfer of vomit jars.
l4d_gear_transfer_allow_vom "1"

// 0=Off, 1=Enables. Make bots give their items to players with none.
l4d_gear_transfer_auto_give "1"

// 0=Off, 1=Enables. Make bots automatically pick up nearby items.
l4d_gear_transfer_auto_grab "1"

// 0=Off, 1=Both, 2=Bots can give, 3=Bots can grab adrenaline.
l4d_gear_transfer_bot_adr "1"

// 0=Off, 1=Both, 2=Bots can give, 3=Bots can grab defibrillators.
l4d_gear_transfer_bot_def "1"

// 0=Off, 1=Both, 2=Bots can give, 3=Bots can grab explosive rounds.
l4d_gear_transfer_bot_exp "1"

// 0=Off, 1=Both, 2=Bots can give, 3=Bots can grab first aid kits.
l4d_gear_transfer_bot_fir "1"

// 0=Off, 1=Both, 2=Bots can give, 3=Bots can grab incendiary ammo.
l4d_gear_transfer_bot_inc "1"

// 0=Off, 1=Both, 2=Bots can give, 3=Bots can grab molotovs.
l4d_gear_transfer_bot_mol "1"

// 0=Off, 1=Both, 2=Bots can give, 3=Bots can grab pain pills.
l4d_gear_transfer_bot_pil "1"

// 0=Off, 1=Both, 2=Bots can give, 3=Bots can grab pipe bombs.
l4d_gear_transfer_bot_pip "1"

// 0=Off, 1=Both, 2=Bots can give, 3=Bots can grab vomit jars.
l4d_gear_transfer_bot_vom "1"

// How close you have to be to transfer an item.
l4d_gear_transfer_dist_give "150.0"

// How close the bots need to be for them to pick up an item.
l4d_gear_transfer_dist_grab "150.0"

// 0=Plugin off, 1=Plugin on.
l4d_gear_transfer_enabled "1"

// 0=Shove only, 1=Reload key only, 2=Shove and Reload key to transfer items.
l4d_gear_transfer_method "2"

// Disallow bots from auto give/grab in these game modes.
l4d_gear_transfer_modes "versus"

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

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

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

// 0=Off, 1=Display transfer info to everyone through chat messages.
l4d_gear_transfer_notify "0"

// 0=Off, 1=Play a sound to the person giving/receiving an item.
l4d_gear_transfer_sounds "1"

// How often to check the bot positions to survivors/items for auto give/grab.
l4d_gear_transfer_timer "1.0"

// How often to update all the item positions for auto grab.
l4d_gear_transfer_timer_item "5.0"

// 0=Off. 1=Players vocalize when transferring items.
l4d_gear_transfer_vocalize "1"

// Gear Transfer plugin version.
l4d_gear_transfer_version 



Changes:
Code:

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 diplaying 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.5.9 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).

Silvers 09-07-2010 12:35

Re: [L4D2] Bot Grenade Transfer
 
Space.... (While we're on the subject of space, look at this: https://apod.nasa.gov/)

Sev 09-07-2010 13:23

Re: [L4D2] Bot Grenade Transfer
 
Add in 'bot throw grenade' on top of bot transfer grenade and im sold.

LTR.2 09-07-2010 16:28

Re: [L4D2] Bot Grenade Transfer
 
awesome!

IronWarrior 09-08-2010 00:46

Re: [L4D2] Bot Grenade Transfer
 
Awesome, thank you.

mikhdenis 09-08-2010 08:44

Re: [L4D2] Bot Grenade Transfer
 
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()


Silvers 09-08-2010 12:46

Re: [L4D2] Bot Grenade Transfer
 
Thank you, it's updated, should not happen anymore.

AtomicStryker 09-08-2010 14:24

Re: [L4D2] Bot Grenade Transfer
 
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

Silvers 09-08-2010 14:46

Re: [L4D2] Bot Grenade Transfer
 
Thanks for pointing those out, seems fairly obvious now!

Edit: Clientcommand vocalizing does not work.

cheewongken 09-08-2010 15:24

Re: [L4D2] Bot Grenade Transfer
 
wow.. you uploaded it after all!

will grab this tomorrow morning.


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

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