AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [L4D & L4D2] Round Start Items Giver (https://forums.alliedmods.net/showthread.php?t=122558)

kwski43 03-28-2010 09:10

[L4D & L4D2] Round Start Items Giver
 
3 Attachment(s)
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 :P)

marvel 03-28-2010 09:31

Re: [L4D2] Round Start Items Giver (1.0)
 
I was looking for this, thanks! I'll test it.

Oshroth 03-28-2010 11:09

Re: [L4D2] Round Start Items Giver (1.1)
 
Heh, you managed to beat me, making this plugin before I had a chance to. The important thing is that someone made it though.

But anyway, unless you removed the delay code from the original plugin, it should work fine in a 16 person server.
Also if you need help with the code, I can help out a lot. My other plugins do similar things to what you are trying to do.
In my other plugins I add/remove items and weapons from survivors, and add/remove items from the map.
My Backpack plugin is a really good example of the stuff you want to do, if you aren't bothered by reading through a fairly large plugin source.

So tell me if you want any help, i'll be glad to help.

P.S. I once used the Pills Here plugin to give a gnome to each player for a plugin that I never released.

marvel 03-28-2010 11:14

Re: [L4D2] Round Start Items Giver (1.1)
 
Works great, even with 20 players. Randomizer works good too.

Maybe you can add medkits as well because I'm still facing that bug with superversus where only 6 or 8 from the 10 players get a medpack :wink:

Thanks!

dani1341 03-28-2010 11:28

Re: [L4D2] Round Start Items Giver (1.1)
 
Well sorry for stupid question :D Where can I download it ?

PS:I'm a noob :(

kwski43 03-28-2010 11:30

Re: [L4D2] Round Start Items Giver (1.1)
 
Quote:

Originally Posted by dani1341 (Post 1131317)
Well sorry for stupid question :D Where can I download it ?
PS:I'm a noob :(

You just viewed the page when I was uploading new version.
Quote:

Originally Posted by marvel (Post 1131307)
Maybe you can add medkits as well because I'm still facing that bug with superversus where only 6 or 8 from the 10 players get a medpack :wink:

Yes, it's on my TODO list.
Quote:

Originally Posted by Oshroth (Post 1131300)
Also if you need help with the code, I can help out a lot. My other plugins do similar things to what you are trying to do.
So tell me if you want any help, i'll be glad to help.

Your help will be appreciated, however I want to use this plugin to learn some things of the sourcepawn, if I get stuck I will ask you for the help! Thanks!
Quote:

Originally Posted by Oshroth (Post 1131300)
The important thing is that someone made it though.

Where? o0 I haven't found anything that could do same thing.
Quote:

Originally Posted by Oshroth (Post 1131300)
P.S. I once used the Pills Here plugin to give a gnome to each player for a plugin that I never released.

Nice idea, but does they achieved achievement?

Oshroth 03-28-2010 12:21

Re: [L4D2] Round Start Items Giver (1.1)
 
Quote:

Originally Posted by kwski43 (Post 1131320)
Where? o0 I haven't found anything that could do same thing.

I meant you making this plugin

Quote:

Originally Posted by kwski43 (Post 1131320)
Nice idea, but does they achieved achievement?

I think they could but I never tested if they did or not. For my first plugin I was trying to make versus harder for teams that wanted it.
Basically at the start of the round each survivor is given a gnome to take with them or not, through the level. For each of the 4 gnomes that made it to the safe room, the survivors got a nice point boost to make up for the difficultly in getting it there.

I made the plugin but didn't want to release it due to how much code I borrowed from the Pills Here plugin and the L4D1 Versus Scoring plugin.

My first official plugin is the backpack one that I released a few weeks ago. I've only been coding for a month or so, so I'm still learning a lot of stuff.

kwski43 03-28-2010 12:27

Re: [L4D2] Round Start Items Giver (1.1)
 
Quote:

Originally Posted by Oshroth (Post 1131382)
I think they could but I never tested if they did or not. For my first plugin I was trying to make versus harder for teams that wanted it.
Basically at the start of the round each survivor is given a gnome to take with them or not, through the level. For each of the 4 gnomes that made it to the safe room, the survivors got a nice point boost to make up for the difficultly in getting it there.

The next idea could be doing the plugin in which players gets points for escorting gnome, without gnome 0 points, this would be funny lol
Quote:

Originally Posted by Oshroth (Post 1131382)
I meant you making this plugin

I misunderstood you.

marvel 03-29-2010 07:11

Re: [L4D2] Round Start Items Giver (1.4)
 
There's a glitch. When the map loads the first team doesn't get any items, the second survivor team does.

I think it's because survivors need longer than 10 seconds to connect the first time, so I increased the delay to 30 seconds to see if that helps.

kwski43 03-29-2010 07:13

Re: [L4D2] Round Start Items Giver (1.4)
 
Quote:

Originally Posted by marvel (Post 1132176)
There's a glitch. When the map loads the first team doesn't get any items, the second survivor team does.

I think it's because survivors need longer than 10 seconds to connect the first time, so I increased the delay to 30 seconds to see if that helps.

Yes, I recommend values above 20. Also try 1.4 version as there was item bug in 1.2 and lower. 30 seconds was in Pills Here plugin by default because of this. I'll raise the minimum delay later.


All times are GMT -4. The time now is 15:23.

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