thankyou
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: Voting Plugin (by danger89)  (Read 37313 times)

Offline danger89

  • Full Member
  • ***
  • Posts: 129
    • JoinMyServer - Game Servers
Voting Plugin (by danger89)
« on: January 15, 2011, 12:10:57 AM »
I try to get the "Voting plugin" working of Ismael, however he didn't updated since 2009.
There where several bugs in the code and some missing vote options, so... I fixed some bugs and created some new features  ;D

The code is tested mainly with Call of Duty 4, however this plugin should also works with other games.
Please report any bug  :D

Version: 2.2

Fixed / new features:
  • Fixed to accept the vote the total count of yes must be higher or equal to the minimum vote setting.
  • Bug fixed votemap.
  • Fixed minium vote for each vote type.
  • Added !votemapgametype and !votemaprotate
  • Fixed default values for more security. And level 1 instead of level 2 group in config file.
  • Both kick & tempban commands have as reason description "Voted out" and saves the caller in admin field of the database, this allows you to search to all the kick/tempban votes and to find the caller again.
  • Extended / fixed configuration file
  • New configuration options
  • Added !votegametype
  • Fixed some small bugs
  • The exact full map and gametype name is only allowed. The server (CoD4) hangs for example at !vm killhouse instead of !vm mp_killhouse
  • Fixed bug: "A vote is already in progress"

Download / GitLab can be found here (together with other plugins):
https://gitlab.melroy.org/melroy/b3-plugins


********* Installation of Votekick for B3 by danger89 *********

* Place plugins/voting.py in plugins/ and conf/voting.xml, conf/maplist.txt and conf/gametypelist.txt in conf/ map
* In your b3.xml config, add in the plugin section (choose the correct priority):

<plugin name="voting" priority="14" config="@b3/conf/voting.xml"/>

* Adjust the minimal level for each command and set the values in voting.xml

* Set all the maps you wish to allow to be voted in the server in maplist.txt

* Set all the gametypes you wish to allow to be voted in the server in gamelist.txt

* Ready to go!

********* New functionality provided & bugs fixed *********

Fixed minium vote for all vote types.

Fixed default values and added try/except for security if the config file didn't load properly.

!votemapgametype
With this command you can vote for a gametype and also directly vote for a map.

!votemaprotate
This will skip the current map and rotate to the next map in of the map rotation.

Configuration file vote_interval is changed to vote_interval_failed
It's the time in minutes after a failed vote and re-vote

Configuration file vote_interval_announcements added
It's the time in minutes between each announcement

Configuration file tempban_interval changed to tempban_duration
To make it clear.

Added comment in the configuration file.

!votekick and !votetempban commands have same reason "Voted out"
This allows you to search to all the kick/tempban votes.

!votekick and !votetempban commands saves the caller in the admin field
This allows you to find the caller again.

!votegametype or !vg
Initate a votemap for a gametype.
If the gametype is in gametypelist.txt, a vote will be carried out. Players need to write the full gametype abbreviation. See the list in gametypelist.txt

!gametypelist or !gamel
Lists all the available gametypes on the server. (It reads the maplist.txt file)

!votekick or !vk
Initiate a votekick against a player.
The votes can only be initated by players above configured level. Admins can't be voted out.
If more than tempban_minvotes players vote, and more than tempban_percent of them are "yes", the player will be tempbanned for tempban_interval.

!votemap or !vm
Initate a votemap for a map.
If the map is in maplist.txt, a vote will be carried out. Players only need to write the full map's name. For example, if they wish to vote "Shipment", they can type "!vm mp_shipment" (assuming no other map has that string in their name).

!maplist or !mapl
Lists all the available maps on the server. (It reads the maplist.txt file)

!voteyes or !vy
!voteno or !vn
Vote yes or no in the current vote.

!voteveto or !vveto
Veto the current vote

*** Configurable variables ***
min_level_*
Set the minimal level for the command.

vote_times
Number of times the bot tells how the vote is going and asks for votes. When the times are up, the vote ends.

vote_interval_announcements
Time in minutes between each announcement.

vote_interval_failed
Time in minutes between failed votes.

tempban_minvotes
Minimum necessary votes in order to pass the vote.

tempban_percent
If more than tempban_minvotes players vote, and more than tempban_percent of them are "yes", the player will be tempbanned for tempban_interval.

tempban_duration
Tempban duration in minutes.

mapfile
File to read the allowed maps for voting.

gametypefile
File to read the allowed gametypes for voting.

Download
Download can be found on the B3 plugin repository: https://gitlab.melroy.org/melroy/b3-plugins

-Melroy van den Berg
« Last Edit: March 21, 2016, 04:47:41 PM by danger89 »
JoinMyServer.com
Call of Duty 4 Game Servers

Offline LiKaNtRoP

  • Jr. Member
  • **
  • Posts: 47
Re: Voting Plugin (by danger89)
« Reply #1 on: January 17, 2011, 01:33:20 AM »
first of all thanks for the plugin  great tool.  i have only one little question, i want to configure it corretly but i need to know:

<set name="vote_times">2</set> this is how many times the bot will inform the situation  of the voting and ask for votes correct? but  how many time will pass between the 2 announcements? because yesterday i tried a gametype voting (i was alone in the server) and the two announcements were made followed and voting was passed instantly

<set name="vote_interval">2</set> this is Approximate time between failed votes. ok but seconds? minutes?  ???

<set name="tempban_interval">2</set> same here, seconds? minutes?

thanks in advance  ;D

Offline danger89

  • Full Member
  • ***
  • Posts: 129
    • JoinMyServer - Game Servers
Re: Voting Plugin (by danger89)
« Reply #2 on: January 17, 2011, 10:24:09 AM »
first of all thanks for the plugin  great tool.  i have only one little question, i want to configure it corretly but i need to know:

<set name="vote_times">2</set> this is how many times the bot will inform the situation  of the voting and ask for votes correct? but  how many time will pass between the 2 announcements? because yesterday i tried a gametype voting (i was alone in the server) and the two announcements were made followed and voting was passed instantly

<set name="vote_interval">2</set> this is Approximate time between failed votes. ok but seconds? minutes?  ???

<set name="tempban_interval">2</set> same here, seconds? minutes?

Good questions.

You must know the voting plugin works with CronTabs which means a function will be called very x minutes. So with that knowledge, vote_times means you got 2 times to vote (at least that is what you see). The interval between each time is 1 minute, this one minute is a defined static variable. So you have a total of 2*1=2 minutes to vote :) I hope I clarified it for you.

After you see 2 vote announcements you will see the final result of the vote -> the vote passed (because you started a voted and by default the vote-caller votes YES).

Code example:
Code: python [Select]
if self._times > 0:
OneTimeCronTab(self.function,  "*/1")

Here you change the _times variable.

The vote_interval works the same way, but here you change the CronTab interval time. This time is in minutes. This is not approximate.

Code example:
Code: python [Select]
OneTimeCronTab(let_caller_vote,  0, "*/%s" %self._vote_interval)

Here you change the _vote_interval variable.

The tempban_interval is also in minutes.

Code example:
Code: python [Select]
    def tempban(...., duration=2, .....):
        duration = functions.time2minutes(duration)

Here you change the duration variable.

Note:
In my new version of the Voting Plugin I will add "B3" to the admin of the tempban, so you can see that a player was temp banned by the voting system (of B3). Besides that I also change tempban_interval to tempban_duration to make it clear.
Maybe I will make a variable of "*/1" so you can change the vote_interval(_failed) of a vote that failed (so the vote-caller can't vote again in x minutes) and vote_interval(_announcements) of the announcements.
« Last Edit: January 17, 2011, 10:45:37 AM by danger89 »
JoinMyServer.com
Call of Duty 4 Game Servers

Offline LiKaNtRoP

  • Jr. Member
  • **
  • Posts: 47
Re: Voting Plugin (by danger89)
« Reply #3 on: January 17, 2011, 12:35:05 PM »
« Last Edit: January 17, 2011, 12:46:03 PM by LiKaNtRoP »

Offline danger89

  • Full Member
  • ***
  • Posts: 129
    • JoinMyServer - Game Servers
Re: Voting Plugin (by danger89)
« Reply #4 on: January 17, 2011, 12:54:26 PM »
JoinMyServer.com
Call of Duty 4 Game Servers

Offline LiKaNtRoP

  • Jr. Member
  • **
  • Posts: 47
Re: Voting Plugin (by danger89)
« Reply #5 on: January 17, 2011, 01:15:57 PM »
« Last Edit: January 17, 2011, 01:32:26 PM by LiKaNtRoP »

Offline danger89

  • Full Member
  • ***
  • Posts: 129
    • JoinMyServer - Game Servers
Re: Voting Plugin (by danger89)
« Reply #6 on: January 17, 2011, 02:33:08 PM »
is wrong?
No it's good, it should work well.
JoinMyServer.com
Call of Duty 4 Game Servers

Offline danger89

  • Full Member
  • ***
  • Posts: 129
    • JoinMyServer - Game Servers
Re: Voting Plugin (by danger89)
« Reply #7 on: January 17, 2011, 08:35:00 PM »
New version released: 1.7
Edit:
txt files added, I forgot ::)
« Last Edit: January 17, 2011, 09:34:22 PM by danger89 »
JoinMyServer.com
Call of Duty 4 Game Servers

Offline LiKaNtRoP

  • Jr. Member
  • **
  • Posts: 47
Re: Voting Plugin (by danger89)
« Reply #8 on: January 17, 2011, 09:27:12 PM »
thx i will try it later  ;D

Offline gabarram

  • Sr. Member
  • ****
  • Posts: 186
Re: Voting Plugin (by danger89)
« Reply #9 on: February 01, 2011, 05:07:05 AM »

Offline gabarram

  • Sr. Member
  • ****
  • Posts: 186
Re: Voting Plugin (by danger89)
« Reply #10 on: February 01, 2011, 06:28:47 AM »

Offline danger89

  • Full Member
  • ***
  • Posts: 129
    • JoinMyServer - Game Servers
Re: Voting Plugin (by danger89)
« Reply #11 on: February 04, 2011, 07:08:09 PM »
JoinMyServer.com
Call of Duty 4 Game Servers

Offline LiKaNtRoP

  • Jr. Member
  • **
  • Posts: 47
Re: Voting Plugin (by danger89)
« Reply #12 on: February 05, 2011, 01:00:22 AM »
there are something wrong with your plugin mate.  a minutes ago i was in the server and i see 2 votings.  in the two the players was kicked with only 1 vote and there was no interval of time between the announcements (and the server was full 16/16)

my settings

- <configuration plugin="votekick">
- <settings name="settings">
  <set name="min_level_vote">0</set>
  <set name="vote_times">3</set>
- <!--  number of times it shows an announcement
  -->
  <set name="vote_interval_announcements">1</set>
- <!--  time in minutes between each announcement
  -->
  <set name="vote_interval_failed">5</set>
- <!--  time in minutes after a failed vote and re-vote
  -->
  </settings>
- <settings name="votekick">
  <set name="min_level_kick">1</set>
  <set name="tempban_minvotes">4</set>
- <!--  minimum necessary votes in order to pass the vote
  -->
  <set name="tempban_percent">75</set>
- <!--  minimum necessary percentage that voted in order to pass the vote
  -->
  <set name="tempban_duration">2</set>
- <!--  tempban duration in minutes
  -->
  </settings>
- <settings name="votemap">
  <set name="min_level_map">80</set>
  <set name="mapfile">@conf/maplist.txt</set>
  </settings>
- <settings name="votegametype">
  <set name="min_level_gametype">80</set>
  <set name="gametypefile">@conf/gametypelist.txt</set>
  </settings>
  </configuration>

with this config i thought should be 3 minutes for vote not 5 seconds.  and why the player is kicked if only one person voted yes and i have 4 minimum votes and 75 %  in config?  ???

sorry but i have to remove this plugin because is very dangerous. people can kick a player with only 1 positive vote and almost instantly  :-\
« Last Edit: February 05, 2011, 01:04:12 AM by LiKaNtRoP »

Offline danger89

  • Full Member
  • ***
  • Posts: 129
    • JoinMyServer - Game Servers
Re: Voting Plugin (by danger89)
« Reply #13 on: February 05, 2011, 02:25:07 AM »
there are something wrong with your plugin mate.  a minutes ago i was in the server and i see 2 votings.  in the two the players was kicked with only 1 vote and there was no interval of time between the announcements (and the server was full 16/16)

my settings
with this config i thought should be 3 minutes for vote not 5 seconds.  and why the player is kicked if only one person voted yes and i have 4 minimum votes and 75 %  in config?  ???
sorry but i have to remove this plugin because is very dangerous. people can kick a player with only 1 positive vote and almost instantly  :-\

I understand your worries. I need to test the plugin with your configuration as soon as possible. Thanks for noticing.
Can you place also your b3.xml config file, where you use the voting plugin?

I created a new version! which fixed the default values to safe values, so if the config file didn't load properly the plugin should still work safe.
I also added 2 new commands:
  • !votemapgametype With this command you can vote for a gametype and also directly vote for a map.
  • !votemaprotate This will skip the current map and rotate to the next map in of the map rotation.

Version: 2.0

You can try version 2.0 and maybe the security problem is fixed of you or wait until i tested your config file.

I also changed level group 2 to level group 1, because I created a group that is level 2. However by default there is only a level 1 group and no level 2 at all :) You can try version 2.0.

« Last Edit: February 05, 2011, 02:17:47 PM by danger89 »
JoinMyServer.com
Call of Duty 4 Game Servers

Offline LiKaNtRoP

  • Jr. Member
  • **
  • Posts: 47
Re: Voting Plugin (by danger89)
« Reply #14 on: February 05, 2011, 03:34:14 PM »
my b3.xml

 <?xml version="1.0" ?>
- <configuration>
- <settings name="b3">
  <set name="parser">cod6</set>
  <set name="database">removed</set>
  <set name="bot_name">M&M</set>
  <set name="bot_prefix">^0(^2b3^0)^7:</set>
  <set name="time_format">%I:%M%p %Z %m/%d/%y</set>
  <set name="time_zone">CET</set>
  <set name="log_level">9</set>
  <set name="logfile">logs\b3.log</set>
  </settings>
- <settings name="server">
  <set name="rcon_password">removed</set>
  <set name="port">removed</set>
  <set name="game_log">removed</set>
  <set name="public_ip">removed</set>
  <set name="rcon_ip">removed</set>
  <set name="punkbuster">off</set>
  </settings>
- <settings name="autodoc">
  <set name="type">html</set>
  <set name="maxlevel">100</set>
  <set name="destination">/path/to/b3_doc.html</set>
  </settings>
- <settings name="messages">
  <set name="kicked_by">%s^7 was kicked by %s^7 %s</set>
  <set name="kicked">%s^7 was kicked %s</set>
  <set name="banned_by">%s^7 was banned by %s^7 %s</set>
  <set name="banned">%s^7 was banned %s</set>
  <set name="temp_banned_by">%s^7 was temp banned by %s^7 for %s^7 %s</set>
  <set name="temp_banned">%s^7 was temp banned for %s^7 %s</set>
  <set name="unbanned_by">%s^7 was un-banned by %s^7 %s</set>
  <set name="unbanned">%s^7 was un-banned %s</set>
  </settings>
- <settings name="plugins">
  <set name="external_dir">@b3/extplugins</set>
  </settings>
- <plugins>
  <plugin name="admin" config="@conf/plugin_admin.xml" />
  <plugin name="adv" config="@conf/plugin_adv.xml" />
  <plugin name="stats" config="@conf/plugin_stats.xml" />
  <plugin name="voting" config="@conf/voting.xml" />
  <plugin name="welcome" config="@conf/plugin_welcome.xml" />
  <plugin name="pingkicker" config="@conf/plugin_pingkicker.xml" />
  </plugins>
  </configuration>

I've also seen that the b3 database does not record the kicks made by this plugin in penalty column  :-\
« Last Edit: February 05, 2011, 03:39:20 PM by LiKaNtRoP »

 


Rate this page +1 at Google Search

anything