Donate to the B3 fund!

"even a small donation helps!"
Donate with PayPal!
Most of the plugins here are made by B3 users and the authors may not visit frequently. If you need support for plugins or if questions remain unanswered, you will have to contact the author directly. Read the full Support Disclaimer here

NOTE: Do not attach plugins to your forumtopics! Attachements are periodically removed by maintenance tasks. Upload your plugins to our Downloads section instead!

Author Topic: WeaponLimiter Plugin  (Read 26428 times)

Offline ozon

  • Full Member
  • ***
  • Posts: 107
    • GitHub
WeaponLimiter Plugin
« on: December 15, 2011, 03:18:21 PM »
Hi,
I've written in the last hours, a small plugin which allows to limit the abuse of weapons on some maps.
Anticipation - I use since about 2 weeks b3 and this is my first plugin. I am not yet familiar with the API.

What makes this plugin?
It will allow you controll depending on the game mode and map the weapons.  The user is cautioned to use a prohibited weapon and kicked depending on your configuration of your Warn setup. Even if I do not like regimentation of any kind, but it helps just on infantry maps the abuse of rocket and grenades launchers to prevent.

current functions:
  • setup forbidden Weapons - depend on GameType and Map
  • start and stop the Plugin

I still plan to add a few little things to add. I would appreciate any suggestions, bug reports and testing.

Here is the Code.
https://github.com/ozon/b3-plugin-weaponlimiterbf3
Even if everything is not perfect, but performs it clean for hours thanks to b3,).

The Stuff is heavy in development - but testet and works live on my Server. I  add important changes now here.

* player with weapon abuse will killed without scoring effects ( configurable in the future )
* WeaponLimiter is per default disabled
« Last Edit: December 18, 2011, 02:54:51 AM by ozon »

Offline SanKen

  • Sr. Member
  • ****
  • Posts: 212
    • ProGaming - Only Multigaming is the most important
Re: WeaponLimiter Plugin
« Reply #1 on: December 15, 2011, 04:46:58 PM »
Thx you!!!


Error in Readme
* copy weaponlimiterbf3.py into b3/extplugins
* copy conf/plugin_weaponlimiterbf3.xml into b3/extplugins/conf
* add `<plugin name="teamspeakbf" config="@conf/extplugins/plugin_teamspeakbf.xml"/>` in you main b3 config file

* modify plugin_weaponlimiterbf3.xml

And
what gives this command in xml <set name="forbidden_weapons">0</set>

Add, Killer gets a warning and is killed  - Can be configured in the xml file.
« Last Edit: December 15, 2011, 05:16:37 PM by SanKen »
Very sorry for my English I do not know him enough to be understood.
That is why I use the google translator.

Offline Courgette

  • Senior Dev.
  • Hero Member
  • *
  • Posts: 4883
    • Github repository
Re: WeaponLimiter Plugin
« Reply #2 on: December 15, 2011, 05:28:05 PM »
Nice plugin indeed. May I suggest you wrap
Code: python [Select]
self._weapon_limiter_is_active = self.config.getboolean('settings', 'autostart')
in a try catch as any junk value in the config file here will raise an exception.

Offline ozon

  • Full Member
  • ***
  • Posts: 107
    • GitHub
Re: WeaponLimiter Plugin
« Reply #3 on: December 15, 2011, 08:03:10 PM »
Error in Readme
...
Thanks. Looks Courgette code inspired me ;)

what gives this command in xml <set name="forbidden_weapons">0</set>
The Idea behind - The user can "ask" what weapons are prohibited. But it was still not implemented.

Courgette, ny approach is bad anyway. I just change it....

Offline MordyT

  • Moderator
  • Hero Member
  • *
  • Posts: 3644
  • Over $300 Donated to B3!
    • MordyT
Re: WeaponLimiter Plugin
« Reply #4 on: December 15, 2011, 09:07:06 PM »
Without getting into it too much, be aware that using a plugin such as this may cause your server to be locked. Well, using it for kicking players at least.

See EAs ROC

That being said, I like this plugin and warning the player probably would slide under the radar.
Help will be given to those with a b3.log

If drop off the map it is due to RL becoming busy :)

System: Python 2.7.3 - Deb 7 - B3 Source Code - 128MB RAM box (rented at $5 a year) - remote MySQL - Remote Web Services

Offline ozon

  • Full Member
  • ***
  • Posts: 107
    • GitHub
Re: WeaponLimiter Plugin
« Reply #5 on: December 15, 2011, 09:32:04 PM »
That there may be problems with automation, which should be aware of these plugins using any. Therefore the same option to start this plugin only for certain maps / game modes to use.

In addition, I will use a slight variation in the future - may be used in the user verbotenene weapons - although not too often. Sample, you kill 20people with a M320 in 5 mins ....its time for a warning ;).

Offline Mariodu62

  • Sr. Member
  • ****
  • Posts: 466
Re: WeaponLimiter Plugin
« Reply #6 on: December 16, 2011, 11:19:55 AM »
What it could be very usefull is :

Killing player using tanks or hel or planes when the server is under X vs Y number of player.


Offline SanKen

  • Sr. Member
  • ****
  • Posts: 212
    • ProGaming - Only Multigaming is the most important
Re: WeaponLimiter Plugin
« Reply #7 on: December 17, 2011, 08:42:32 PM »
please fix it working, next not working,screen
Randomly chooses whom to give warning
and
Plugin is off after map change, autostart is ON

[attachment deleted by maintenance]
« Last Edit: December 17, 2011, 08:44:32 PM by SanKen »
Very sorry for my English I do not know him enough to be understood.
That is why I use the google translator.

Offline ozon

  • Full Member
  • ***
  • Posts: 107
    • GitHub
Re: WeaponLimiter Plugin
« Reply #8 on: December 18, 2011, 01:25:56 AM »
Hm, the Plugin runs on our Server over 48h with mapchanges and without any issues. I pushed my latest Code to Github. Now ist the Limiter disabled by default. You must activate it ingame (!wpl on).

Offline SanKen

  • Sr. Member
  • ****
  • Posts: 212
    • ProGaming - Only Multigaming is the most important
Re: WeaponLimiter Plugin
« Reply #9 on: December 18, 2011, 10:45:41 AM »
 I have enabled by default. In my GitHub. I apologize for it: (

latest version has a problem
Code: [Select]
111218 11:28:41	CONSOLE	"['player.onKill', 'Verherrlicher', 'kostyasm123456', 'RPG-7', 'false']"
111218 11:28:41 DEBUG 'Weaponlimiterbf3Plugin: RPG-7 in pattern detected'
111218 11:34:59 ERROR "handler Weaponlimiterbf3Plugin could not handle event Client Kill: TypeError: _punish_player() takes exactly 2 arguments (3 given) [('D:\\\\ProGaming\\\\Python\\\\BigBrotherBot\\\\b3\\\\parser.py', 1000, 'handleEvents', 'hfunc.parseEvent(event)'), ('D:\\\\ProGaming\\\\Python\\\\BigBrotherBot\\\\b3\\\\plugin.py', 158, 'parseEvent', 'self.onEvent(event)'), ('D:\\\\ProGaming\\\\B3\\\\extplugins\\\\weaponlimiterbf3.py', 83, 'onEvent', 'self._punish_player(self, event)')]"
« Last Edit: December 18, 2011, 11:51:13 AM by SanKen »
Very sorry for my English I do not know him enough to be understood.
That is why I use the google translator.

Offline ozon

  • Full Member
  • ***
  • Posts: 107
    • GitHub
Re: WeaponLimiter Plugin
« Reply #10 on: December 18, 2011, 03:55:36 PM »
Thanks for your Report. The Problem is fixed. I testet it inganme the last 2Hours - it works fine ;).

Offline SanKen

  • Sr. Member
  • ****
  • Posts: 212
    • ProGaming - Only Multigaming is the most important
Very sorry for my English I do not know him enough to be understood.
That is why I use the google translator.

Offline ozon

  • Full Member
  • ***
  • Posts: 107
    • GitHub
Re: WeaponLimiter Plugin
« Reply #12 on: December 18, 2011, 06:17:52 PM »
The comment explain it ;). I forget to remove it.....
Users like Admins are Wihte and ignored by the WeaponLimiter. Or with other Words - we can use forbidden Weapons. I Use it for Testing with my Clan Mates. But a remove this little Function every time.

Sorry for the Misstakes.

Offline SanKen

  • Sr. Member
  • ****
  • Posts: 212
    • ProGaming - Only Multigaming is the most important
Re: WeaponLimiter Plugin
« Reply #13 on: December 18, 2011, 06:41:46 PM »
Again problem,
Code: [Select]
111218 18:39:38	CONSOLE	"['player.onKill', 'Chkval', 'El_Hormono', 'RPG-7', 'false']"
111218 18:39:38 DEBUG 'Weaponlimiterbf3Plugin: RPG-7 in pattern detected'
111218 18:39:38 ERROR "handler Weaponlimiterbf3Plugin could not handle event Client Kill: AttributeError: Weaponlimiterbf3Plugin instance has no attribute 'data' [('D:\\\\ProGaming\\\\Python\\\\BigBrotherBot\\\\b3\\\\parser.py', 1000, 'handleEvents', 'hfunc.parseEvent(event)'), ('D:\\\\ProGaming\\\\Python\\\\BigBrotherBot\\\\b3\\\\plugin.py', 158, 'parseEvent', 'self.onEvent(event)'), ('D:\\\\ProGaming\\\\B3\\\\extplugins\\\\weaponlimiterbf3.py', 83, 'onEvent', 'self._punish_player(self, event)'), ('D:\\\\ProGaming\\\\B3\\\\extplugins\\\\weaponlimiterbf3.py', 116, '_punish_player', 'weapon = event.data[1]')]"
111218 18:39:39 CONSOLE "['player.onSpawn', 'KOXsu', '2']"
...
Please add a warning for player.onTkKill to forbidden weapons.
« Last Edit: December 18, 2011, 06:55:02 PM by SanKen »
Very sorry for my English I do not know him enough to be understood.
That is why I use the google translator.

Offline ozon

  • Full Member
  • ***
  • Posts: 107
    • GitHub
Re: WeaponLimiter Plugin
« Reply #14 on: December 18, 2011, 07:58:39 PM »
Hi again.
I come from just a few games where running this plugin. I once compared my version with my developer server. As you can see the git log, you would have my last work.

The problem must lie elsewhere. Which version of b3 you are using?

Here some output from my log:
http://pastebin.com/diLxVWJt

Only a Python Error come up, if the code try to kill a Play if he is Death.... but not realy a Problem.

 


Rate this page +1 at Google Search

anything