View Single Post
Author Message
kwski43
Senior Member
Join Date: Mar 2009
Old 03-28-2010 , 09:10   [L4D & L4D2] Round Start Items Giver
Reply With Quote #1

This plugin gives selected/random items to survivors on round start, just customizable version of Pills Here.

l4d_itemgiver.cfg (Left 4 Dead)
Code:
// This file was auto-generated by SourceMod (v1.3.3)
// ConVars for plugin "l4d2_itemgiver.smx"


// Advertisements after round start delay? 0-disable
// -
// Default: "15.0"
// Minimum: "0.000000"
// Maximum: "120.000000"
l4d_ig_adsdelay "15.0"

// Granade Item give delay from round start. Float in Seconds.
// -
// Default: "37.0"
// Minimum: "0.000000"
// Maximum: "120.000000"
l4d_ig_delay_granade "37.0"

// Health Item give delay from round start. Float in Seconds.
// -
// Default: "40.0"
// Minimum: "0.000000"
// Maximum: "120.000000"
l4d_ig_delay_health "40.0"

// Melee Item give delay from round start. Float in Seconds.
// -
// Default: "46.0"
// Minimum: "0.000000"
// Maximum: "120.000000"
l4d_ig_delay_melee "46.0"

// Primary Weapon Item give delay from round start. Float in Seconds.
// -
// Default: "30.0"
// Minimum: "0.000000"
// Maximum: "120.000000"
l4d_ig_delay_primweapon "30.0"

// Secondary Weapon Item give delay from round start. Float in Seconds.
// -
// Default: "34.0"
// Minimum: "0.000000"
// Maximum: "120.000000"
l4d_ig_delay_secweapon "34.0"

// Supply Item give delay from round start. Float in Seconds.
// -
// Default: "43.0"
// Minimum: "0.000000"
// Maximum: "120.000000"
l4d_ig_delay_supply "43.0"

// What Granade item should We give to survivors? 0-disable, 1-pipe, 2-molotov
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "2.000000"
l4d_ig_give_granade "1"

// What Health item should We give to survivors? 0-disable, 1-medkit
// -
// Default: "0"
// Minimum: "0.000000"
// Maximum: "1.000000"
l4d_ig_give_health "0"

// What Melee item should We give to survivors? 0-disable, 1-oxygentank, 2-gascan, 3-propanetank
// -
// Default: "0"
// Minimum: "0.000000"
// Maximum: "3.000000"
l4d_ig_give_melee "0"

// What Primary Weapon item should We give to survivors? 0-disable, 1-smg, 2-rifle, 3-pumpshotgun, 4-hunting_rifle, 5-autoshotgun
// -
// Default: "0"
// Minimum: "0.000000"
// Maximum: "5.000000"
l4d_ig_give_primweapon "0"

// What Secondary Weapon item should We give to survivors? 0-disable, 1-pistol
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
l4d_ig_give_secweapon "1"

// What Supply item should We give to survivors? 0-disable, 1-pills
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
l4d_ig_give_supply "1"

// Enables info for players at round start about items they get. 0-disable, 1-chat, 2-hint
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "2.000000"
l4d_ig_giveinfo "1"

// Should We give random Granade item to survivors? Overrides previous item settings.
// -
// Default: "0"
// Minimum: "0.000000"
// Maximum: "1.000000"
l4d_ig_random_granade "0"

// Should We give random Health item to survivors? Overrides previous item settings.
// -
// Default: "0"
// Minimum: "0.000000"
// Maximum: "1.000000"
l4d_ig_random_health "0"

// Should We give random Melee item to survivors? Overrides previous item settings.
// -
// Default: "0"
// Minimum: "0.000000"
// Maximum: "1.000000"
l4d_ig_random_melee "0"

// Should We give random Primary Weapon item to survivors? Overrides previous item settings.
// -
// Default: "0"
// Minimum: "0.000000"
// Maximum: "1.000000"
l4d_ig_random_primweapon "0"

// Should We give random Secondary Weapon item to survivors? Overrides previous item settings.
// -
// Default: "0"
// Minimum: "0.000000"
// Maximum: "1.000000"
l4d_ig_random_secweapon "0"

// Should We give random Supply item to survivors? Overrides previous item settings.
// -
// Default: "0"
// Minimum: "0.000000"
// Maximum: "1.000000"
l4d_ig_random_supply "0"
l4d2_itemgiver.cfg (Left 4 Dead 2)
Code:
// This file was auto-generated by SourceMod (v1.3.3)
// ConVars for plugin "l4d2_itemgiver.smx"


// Granade Item give delay from time when player enters the game. Float in Seconds.
// -
// Default: "37.0"
// Minimum: "0.000000"
// Maximum: "120.000000"
l4d2_ig_delay_granade "37.0"

// Health Item give delay from time when player enters the game. Float in Seconds.
// -
// Default: "40.0"
// Minimum: "0.000000"
// Maximum: "120.000000"
l4d2_ig_delay_health "40.0"

// Melee Item give delay from time when player enters the game. Float in Seconds.
// -
// Default: "46.0"
// Minimum: "0.000000"
// Maximum: "120.000000"
l4d2_ig_delay_melee "46.0"

// Primary Weapon Item give delay from time when player enters the game. Float in Seconds.
// -
// Default: "30.0"
// Minimum: "0.000000"
// Maximum: "120.000000"
l4d2_ig_delay_primweapon "30.0"

// Secondary Weapon Item give delay from time when player enters the game. Float in Seconds.
// -
// Default: "34.0"
// Minimum: "0.000000"
// Maximum: "120.000000"
l4d2_ig_delay_secweapon "34.0"

// Supply Item give delay from time when player enters the game. Float in Seconds.
// -
// Default: "43.0"
// Minimum: "0.000000"
// Maximum: "120.000000"
l4d2_ig_delay_supply "43.0"

// Upgrade give delay from time when player enters the game. Float in Seconds.
// -
// Default: "32.0"
// Minimum: "0.000000"
// Maximum: "120.000000"
l4d2_ig_delay_upgrade "32.0"

// What Granade item should We give to survivors? 0-disable, 1-pipe, 2-molotov, 3-puke
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "3.000000"
l4d2_ig_give_granade "1"

// What Health item should We give to survivors? 0-disable, 1-medkit, 2-defib, 3-fire bullets pack, 4-explosive bullets pack
// -
// Default: "0"
// Minimum: "0.000000"
// Maximum: "4.000000"
l4d2_ig_give_health "0"

// What Melee item should We give to survivors? 0-disable, 1-oxygentank, 2-gascan, 3-propanetank, 4-fireworkcrate, 5-cola bottles, 6-gnome :)
// -
// Default: "0"
// Minimum: "0.000000"
// Maximum: "6.000000"
l4d2_ig_give_melee "0"

// What Primary Weapon item should We give to survivors? 0-disable, 1-pumpshotgun, 2-autoshotgun, 3-shotgun_spas, 4-shotgun_chrome, 5-smg, 6-smg_mp5, 7-smg_silenced, 8-rifle, 9-rifle_ak47
// 10-rifle_desert, 11-rifle_sg552, 12-sniper_military, 13-sniper_awp, 14-sniper_scout, 15-hunting_rifle, 16-grenade_launcher, 17-m60
// -
// Default: "0"
// Minimum: "0.000000"
// Maximum: "17.000000"
l4d2_ig_give_primweapon "0"

// What Secondary Weapon item should We give to survivors? 0-disable, 1-pistol, 2-pistol_magnum, 3-cricket_bat, 4-chainsaw, 5-baseball_bat, 6-crowbar, 7-electric_guitar, 8-fireaxe, 9-katana, 10-machete
// 11-tonfa, 12-frying_pan, 13-golfclub
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "13.000000"
l4d2_ig_give_secweapon "1"

// What Supply item should We give to survivors? 0-disable, 1-pills, 2-adrenaline
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "2.000000"
l4d2_ig_give_supply "1"

// What Upgrade should We give to survivors? 0-disable, 1-laser, 2-fire bullets, 3-explosive bullets
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "3.000000"
l4d2_ig_give_upgrade "1"

// Should We give random Granade item to survivors? Overrides previous item settings.
// -
// Default: "0"
// Minimum: "0.000000"
// Maximum: "1.000000"
l4d2_ig_random_granade "0"

// Should We give random Health item to survivors? Overrides previous item settings.
// -
// Default: "0"
// Minimum: "0.000000"
// Maximum: "1.000000"
l4d2_ig_random_health "0"

// Should We give random Melee item to survivors? Overrides previous item settings.
// -
// Default: "0"
// Minimum: "0.000000"
// Maximum: "1.000000"
l4d2_ig_random_melee "0"

// Should We give random Primary Weapon item to survivors? Overrides previous item settings.
// -
// Default: "0"
// Minimum: "0.000000"
// Maximum: "1.000000"
l4d2_ig_random_primweapon "0"

// Should We give random Secondary Weapon item to survivors? Overrides previous item settings.
// -
// Default: "0"
// Minimum: "0.000000"
// Maximum: "1.000000"
l4d2_ig_random_secweapon "0"

// Should We give random Supply item to survivors? Overrides previous item settings.
// -
// Default: "0"
// Minimum: "0.000000"
// Maximum: "1.000000"
l4d2_ig_random_supply "0"

// Should We give random Upgrade to survivors? Overrides previous item settings.
// -
// Default: "0"
// Minimum: "0.000000"
// Maximum: "1.000000"
l4d2_ig_random_upgrade "0"

// Advertisements after round start delay? 0-disable
// -
// Default: "15.0"
// Minimum: "0.000000"
// Maximum: "120.000000"
l4d2_ig_settings_adsdelay "15.0"

// Enables info for players at round start about items they gets. 0-disable, 1-chat, 2-hint
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "2.000000"
l4d2_ig_settings_giveinfo "1"
If you set the l4d2_ig_random_xxx (xxx = item name) cvar to 1 previous setting are overrided, plugin will randomize item. Setting l4d2_ig_xxx (xxx = item name) to 0 makes plugin won't give item of that kind.

Known bugs/issues:
- To unlock german weapons and m60 use Weapon Unlock but after that plugin can give double items like crazy...

Credits:
-Crimson_Fox for original code
-Oshroth (post) for randomization code example

Changelog:
1.0 - Public release
1.1 - Initial support for L4D, plugin will load, but will not give items which are not supported in L4D
1.2 - Support for L4D(Pipe got 66% chance for being given and Pills 100%), Plugin can inform players about "whats going on with the additional items", Remember to delete plugin's config!
1.3 - Plugin rewrite, seperated functions, configs, cvar possibilities for L4D and L4D2, fixed bug with not giving pipe when selected to
1.4 - Moved to translation files, included languages: en, pl, higher delays
2.0 - Rewrite #1 You can now set to give survivors, medkit slot item(medkit, defib) first weapon slot and second weapon slot item, melee weapon, rewritten some stuff, cleaned up some things etc, Watch out! Delete old config file because cvars has changed and new arrived! this update concerns L4D2 only
2.1 - misc fixes and changes, updated: plugin
2.2 - advertisements fixes, fixed translation with missing oxygentank entry, updated: translations, plugin
2.3 - completed weapons part for L4D, updated: translations, plugin
2.4 - added check if there is specific campaing/map to disable this item because players can bypass part of the map with cola and with gnome earn achievement, updated: plugin
2.5 - fixed translations and translations calls in plugin, updated: translations, plugin
2.6 - [trying to fix reported issue when plugin does not give items]
2.7 - fixed reported issue when plugin does not give items, updated translations with missing defibrilator entry
2.8 - lowered minimum delays, I still recommend the default values or similar, some tweaks
2.9 - lowered delays
3.0 - support for DLC weapons
3.1 - m60 not gave bugfix
3.2 - found a wrong operator in code, fixed
3.3 - fixed not giving defibrillator
3.4 - misc fixes and tweaks
3.5 - fixed reported issues with medkit and defib, updated plugin and translations
3.6 - changed plugin's code, tested with all gametypes and it works fine
3.7 - swapped firebullets with explosive bullets in code, my mistake >.>
3.8 - patched security hole mentioned in post #121
(yeah I know, best versioning ever )
Attached Files
File Type: txt l4d2_itemgiver.phrases.txt (2.9 KB, 5381 views)
File Type: sp Get Plugin or Get Source (l4d2_itemgiver.sp - 6505 views - 29.1 KB)

Last edited by kwski43; 02-09-2014 at 13:40.
kwski43 is offline