Skocz do zawartości

Nowy szablon forum

mygo.pl

Stworzyliśmy dla Was nowy wygląd forum. Z pewnością znajdziesz rzeczy, które wg Ciebie mogą zostać zmienione - wspomnij o tym w specjalnym wątku.

Czytaj więcej

Jak założyć własną sieć

serwerów CS

Zastanawiasz się nad prowadzeniem własnej sieci serwerów? Przeczytaj podstawowe informacje, na które należy zwrócić uwagę, przy takim projekcie.

Czytaj więcej

Tworzymy spis sieci

dodaj swoją

Dodaj sieć do której należysz, pozwoli to na promocję i budowę ogólnopolskiej bazy sieci CS.

Czytaj więcej

[l4d2] Smart Item Selector


MYGO.pl
 Udostępnij

Rekomendowane odpowiedzi

  • RSSy
Introduction
Smart Item Selector (sIs) is based on [L4D & L4D2] Round Start Items Giver by kwski43, but takes "item giving" to another level.
sIs intelligently gives selected items to survivors each time they spawn and includes an option to give different items to VIP/admins.
This is my first public plugin so constructive feedback is welcome.


sIs Goals
Simplify: by eliminating the need for numerous timers there are fewer cvars to set and hopefully, increased reliability.
Add intelligence: only give items if they are needed or according to a prioritization system. No brute-force item giving and no excess item spawns.
Add VIP/admin options: offer server operators the option to give different items to VIP/admins based on one or more flags.
Add flexibility: give items anytime a player spawns (first spawn, bot takeover, rescue closet, re-spawn, joining an in-progress map, etc.) not just at round start.


The Prioritization System
sIs uses a 3-tier prioritization system comprised of base, random, and VIP item selections.
A base item selection is overridden by a random item selection and both of those are overridden by a VIP item selection.
However, an override will only occur for the same item type (i.e. a VIP primary weapon selection only overrides the other primary weapon selections).

1. Example: if you configure a base primary weapon and a random primary weapon and a vip primary weapon, survivors will receive a random primary weapon (overrides the base item)
but VIPs will receive the VIP weapon (overrides the base and random item).
2. Example: if you configure a base primary weapon and a random SECONDARY weapon and a VIP primary weapon, survivors will receive the base primary weapon and a random secondary weapon.
VIPs will receive the VIP primary weapon (overrides the base item) and a random secondary weapon.


Item Replacement Logic
1. Health Items: These always have priority. If a survivor has an ammo upgrade pack on their back and a health item is configured (base, random or VIP),
the health item will replace (but not destroy) the upgrade pack.
2. Default pistol: when a player spawns on the first map of a new campaign, he receives a default pistol. If you configured a secondary weapon selection AND set l4d2_sis_remove_pistol "1", sIs
will remove (destroy) the default pistol and replace it with the selected secondary weapon. This is done primarily to eliminate pistol drop clutter on large co-op servers when new items are given.
3. All other weapons/items: sIs looks at each survivor's weapon slots and if they are occupied (other than with a default pistol) it will not give them a new item.
VIP selections are the exception. If the VIP's existing weapon/item is not the configured VIP item, it will be replaced by the VIP selection, but not destroyed.

Note: incendiary and explosive ammo upgrades are treated as equal and mutually exclusive. If a survivor has either one of them and your item configuration calls for the other
ammo upgrade, the existing ammo upgrade will not be replaced. An argument can be made that either incendiary or explosive should have priority (I think explosive should), but I chose
not to make that judgement call for this first release. If there is sufficient need for a prioritized ammo selection, I will try to add it.


Using Vip/Admin flags:
Add one or more admin flags that should receive Vip/admin items to l4d2_sis_vip_flags Multiple flags are accepted, just don't separate them with spaces or other characters.
Players with any of those flags will receive the VIP/Admin items. This was done to provide greater flexibility for server operators when configuring VIP options.
To disable the VIP option, just set the VIP item cvars to zero. No need to remove the flag(s) from l4d2_sis_vip_flags setting.

1. Example: if you set l4d2_sis_vip_flags "a", only players with the "a" flag will recieve VIP items.
2. Example: if you set l4d2_sis_vip_flags "abo", players with either the "a", "b" or "o" (custom1) flag will receive VIP items.


Chat Message:
l4d2_sis_info_message 1 will display a message like this to each player if they are given items. The message is customized to only show the item(s) they received.

68747470733a2f2f692e696d6775722e636f6d2f


Thank You:
Dragokas - code review, help and ideas, and the Russian translation.
nosoop - example code to handle the weapon upgrade bitvec and optimization
Crasher_3637 - code review and optimization
Lux - code review
Silvers - for his great formatting
l4d Competitive community for creating the original l4d2_weapon_stocks.inc


Optional dependency for the Knife:
To use the knife option for a secondary weapon, your must have the [L4D2] Knife Unlock plugin by Silvers installed on your server.
Smart Item Selector checks for the Knife Unlock plugin and if it is not found, substitutes another melee weapon for the knife.


Bugs:
None so far...


To Do:
1. Release an update to add support for l4d.


Possible Future Upgrade:
1. Add a menu for VIP/admins to configure a personalized equipment load-out. Data storage method TBD.
2. Add Silvers game mode toggle code so server operators can chose in which modes sIs is enabled.


CVars:
- All cvars, except for the plugin enable cvar, VIP/admin flag, and pistol replace cvar, are set to 0 or off by default for easier configuration.
PHP Code:

 /* ============  General Settings  ============ */
// Is the Smart Item Selector plugin enabled? 0=Plugin off, 1=Plugin on.
// -
// Default: "1"
l4d2_sis_enable "1"

// Send each player a message informing them which item(s) they recieved?. 0=off, 1=on.
// -
// Default: "0"
l4d2_sis_info_message "0"

// Survivors with any of these flags will receive VIP/admin items. [example admin flags: a=Reservation, b=Generic, c=Kick, d=Ban, o=custom1, etc.]
// -
// Default: "a"
l4d2_sis_vip_flags "a"

// Remove the default pistol before giving another secondary weapon?. 0=No, 1=Yes.
// -
// Default: "1"
l4d2_sis_remove_pistol "1"


/* ============  Base Item Section  ============ */
// Give the survivors a Primary Weapon? 0=disable, 1=pumpshotgun, 2=chrome shotgun, 3=spas shotgun, 4=autoshotgun, 5=smg, 6=smg silenced, 7=smg mp5, 8=M16 rifle, 9=AK47 rifle, 10=Desert rifle, 11=SG552 rifle, 12=Hunting rifle, 13=Scout sniper rifle, 14=Military sniper rifle, 15=AWP sniper rifle
// -
// Default: "0"
l4d2_sis_primary_choice "0"

// Give the survivors a Secondary Weapon? 0=disable, 1=magnum pistol, 2=knife (requires [L4D2]Knife Unlock plugin), 3=frying pan, 4=tonfa, 5=crowbar, 6=cricket bat, 7=baseball bat, 8=machete, 9=katana, 10=golf club, 11=fire axe, 12=electric guitar.
// -
// Default: "0"
l4d2_sis_secondary_choice "0"

// Give the survivors a Health Item? 0=disable, 1=medkit, 2=defib
// -
// Default: "0"
l4d2_sis_health_choice "0"

// Give the survivors a Throwable? 0=disable, 1=pipe bomb, 2=molotov, 3=bile jar
// -
// Default: "0"
l4d2_sis_throwable_choice "0"

// Give the survivors Meds? 0=disable, 1=pills, 2=adrenaline
// -
// Default: "0"
l4d2_sis_meds_choice "0"

// Give the survivors an Upgrade? 0=disable, 1=laser, 2=incendiary ammo, 3=explosive ammo
// -
// Default: "0"
l4d2_sis_upgrade_choice "0"


/* ============  Random Item Section  ============ */
// Give the survivors a random Primary Weapon? Overrides previous primary weapon setting. 0=disable, 1=enable.
// -
// Default: "0"
l4d2_sis_random_primary "0"

// Give the survivors a random Secondary Weapon? Overrides previous secondary weapon setting. 0=disable, 1=enable.
// -
// Default: "0"
l4d2_sis_random_secondary "0"

// Give the survivors a random Health item? Overrides previous health item setting. 0=disable, 1=enable.
// -
// Default: "0"
l4d2_sis_random_health "0"

// Give the survivors a random Throwable? Overrides previous throwable setting. 0=disable, 1=enable.
// -
// Default: "0"
l4d2_sis_random_throwable "0"

// Give the survivors random Meds? Overrides previous meds setting. 0=disable, 1=enable.
// -
// Default: "0"
l4d2_sis_random_meds "0"

// Give the survivors a random Upgrade? Overrides previous upgrade settings. 0=disable, 1=enable.
// -
// Default: "0"
l4d2_sis_random_upgrade "0"


/* ============  VIP Item Section  ============ */
// Give the VIPs a Primary Weapon? Overrides ALL other primary weapon settings. 0=disable,1=pumpshotgun, 2=chrome shotgun, 3=spas shotgun, 4=autoshotgun, 5=smg, 6=smg silenced, 7=smg mp5, 8=M16 rifle, 9=AK47 rifle, 10=Desert rifle, 11=SG552 rifle, 12=Hunting rifle, 13=Scout sniper rifle, 14=Military sniper rifle, 15=AWP sniper rifle
// -
// Default: "0"
l4d2_sis_vip_primary_choice "0"

// Give the VIPs a Secondary Weapon? Overrides ALL other secondary weapon settings. 0=disable, 1=magnum pistol, 2=knife (requires [L4D2]Knife Unlock plugin), 3=frying pan, 4=tonfa, 5=crowbar, 6=cricket bat, 7=baseball bat, 8=machete, 9=katana, 10=golf club, 11=fire axe, 12=electric guitar.
// -
// Default: "0"
l4d2_sis_vip_secondary_choice "0"

// Give the VIPs a health item? Overrides ALL other health item settings. 0=disable, 1=medkit, 2=defib
// -
// Default: "0"
l4d2_sis_vip_health_choice "0"

// Give the VIPs a Throwable? Overrides ALL other throwable settings. 0=disable, 1=pipe bomb, 2=molotov, 3=bile jar
// -
// Default: "0"
l4d2_sis_vip_throwable_choice "0"

// Give the VIPs Meds? Overrides ALL other meds settings. 0=disable, 1=pills, 2=adrenaline
// -
// Default: "0"
l4d2_sis_vip_meds_choice "0"

// Give the VIPs an Upgrade? Overrides ALL other upgrade settings. 0=disable, 1=laser, 2=incendiary ammo, 3=explosive ammo
// -
// Default: "0"
l4d2_sis_vip_upgrade_choice "0" 

Changes:
PHP Code:

1.0 (24-Feb-2019)
    - 
Initial release


Compiling:
1. Put the l4d2_weapon_stocks_sis.inc include into your \addons\sourcemod\scripting\include\ folder.
2. Put the plugins .sp file into your scripting folder and compile the plugin.


Installation:
1. Put the l4d2_smart_item_selector.smx file in your server's \addons\sourcemod\plugins\ folder.
2. Put the l4d2_smart_item_phrases.txt file in your server's \addons\sourcemod\translations\ folder.
3. Restart your server and then set your item preferences in the \cfg\sourcemod\l4d2_smart_item_selector.cfg file.
4. Restart your server or change the map.

Attached Files
File Type: smx l4d2_smart_item_selector.smx (14.3 KB)
File Type: sp Get Plugin or Get Source (l4d2_smart_item_selector.sp - 19.7 KB)
File Type: txt l4d2_smart_item.phrases.txt (5.3 KB)
File Type: inc l4d2_weapon_stocks_sis.inc (10.7 KB)

Wyświetl pełny artykuł

Odnośnik do komentarza
Udostępnij na innych stronach

Jeśli chcesz dodać odpowiedź, zaloguj się lub zarejestruj nowe konto

Jedynie zarejestrowani użytkownicy mogą komentować zawartość tej strony.

Zarejestruj nowe konto

Załóż nowe konto. To bardzo proste!

Zarejestruj się

Zaloguj się

Posiadasz już konto? Zaloguj się poniżej.

Zaloguj się
 Udostępnij

  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...