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

[CS:GO/CS:S] Simple Weapon Restrictor


MYGO.pl
 Udostępnij

Rekomendowane odpowiedzi

  • RSSy
Simple Weapon Restrictor
This plugin simply restricts weapons, so they can't be used. All weapons can easily be restricted by the use of commands or the config file. The plugin is "sv_cheats"-friendly, and it's impossible to equip a restricted weapon. (If that's not the case, please contact me)

Feature list
  • Very simple to use
  • Prevent specific weapons from being used
  • Control restricted weapons through commands
  • Easy-to-use config file for permanent restrictions

Commands
  • wr_restrict <weapon*> - Restricts the given weapon.
  • wr_unrestrict <weapon*> - Unrestricts the given weapon.
  • wr_reload - Reloads the config files. (Note: This removes all temporary restrictions.)
All commands require the config admin flag.
*: The weapon parameter can either be the classname (e.g. weapon_awp) or the weapon alias (e.g. awp). It's also case-insensitive.

Config
The config adds a neat and simple way to permanently restrict weapons. It's not needed and does not have to be present at all. The config is located in addons/sourcemod/configs/restricted_weapons.txt. It's a plain text file, where each line is an entry in the restrictions list. A line consists of just a weapon alias, which works the same way as the commands. The plugin will yield warning, if a line is an invalid weapon or if the same weapon is listed multiple times. An example of a config file could be:
Code:

awp
p90
weapon_Glock
rpg
weapon_deagle
weapon_stunstick
P90

The config uses both class names and aliases, but there's some invalid weapons and some other weapons are listed multiple times. The plugin skips the invalid entries and works fine even with errors in the config, but it does print some warnings in the console to assist the server manager:
Code:

[WR] Config file: WARNING - Invalid entry: rpg! (Line: 4)
[WR] Config file: WARNING - Invalid entry: stunstick! (Line: 6)
[WR] Config file: WARNING - Duplicate entry: p90! (Line: 7)
[WR] Config file: Loaded 4 restriction(s).

This makes it easy to identify mistakes. It loaded 4 restrictions in total: awp, p90, glock, and deagle. The other lines were simply skipped. A more detailed description of the loading process can be seen with debug enabled. The ConVar config is located in cfg/sourcemod/restricted_weapons.txt

Installation
If you want to utilize the config file, then you have to manually create the file: addons/sourcemod/configs/restricted_weapons.txt. Otherwise, it's a normal plugin installation.

ConVars
  • wr_debug (default: false/0) - Prints debug information to the console.
  • wr_version - The current version of the plugin.

Plans
  • Commenting in config file
  • Listing restrictions
  • Further customization
I see this plugin as done, because I want to keep it simple. But I'm open for suggestions.

Notes
This plugin must be compiled with SourceMod v1.8 or higher.
I know this plugin isn't anything major, but I've been working with SourcePawn for about a year now, and I've mostly done private plugins. I thought this simple plugin, which I made for a friend, might be a good start on AM. So, yea, this is also my first post, so the formatting might be odd. Thanks for giving my plugin a look!

Attached Files
File Type: sp Get Plugin or Get Source (SimpleWeaponRestrictor.sp - 9.1 KB)
File Type: smx SimpleWeaponRestrictor.smx (17.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ę...