[Mod] Vote [0.1] [vote] - an API

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

[Mod] Vote [0.1] [vote] - an API

by rubenwardy » Thu Jul 16, 2015 16:46

Image

An API to allow players to vote on things.

Dependencies: None
License: CC0
Download: https://github.com/minetest-mods/vote/a ... master.zip
or browse the code on GitHub

For kick voting, see https://github.com/rubenwardy/vote_kick/

Example API:


Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
vote.new_vote(name, {
   description = "Kick player " .. param,
   help = "/yes,  /no  or  /abstain",
   name = param,
   duration = 60,
   perc_needed = 0.8, -- fraction needed to pass the vote.

   on_result = function(self, result, results)
      if result == "yes" then
         minetest.chat_send_all("Vote passed, " ..
               #results.yes .. " to " .. #results.no .. ", " ..
               self.name .. " will be kicked.")
         minetest.kick_player(self.name, "The vote to kick you passed")
      else
         minetest.chat_send_all("Vote failed, " ..
               #results.yes .. " to " .. #results.no .. ", " ..
                     self.name .. " remains ingame.")
      end
   end,

   on_vote = function(self, name, vote)
      minetest.chat_send_all(name .. " voted " .. vote .. " to '" ..
            self.description .. "'")
   end
})


Todo



  • Show time remaining in HUD.
  • Show queued votes on HUD.
Last edited by rubenwardy on Fri Mar 17, 2017 23:55, edited 6 times in total.
 

User avatar
cd2
Member
 
Posts: 552
Joined: Mon Jun 01, 2015 06:30
GitHub: cdqwertz
IRC: freenode - cd2 InchraNet - cd
In-game: cd cd2

Re: [Mod] Vote (with Kick voting) [0.1] [vote] - an API

by cd2 » Fri Aug 21, 2015 09:18

Thats cool!
I already thaught about making something like that, but your api is great!
 

User avatar
Minetestforfun
Member
 
Posts: 936
Joined: Tue Aug 05, 2014 14:09
GitHub: Darcidride
IRC: Darcidride + MinetestForFun
In-game: Darcidride + MinetestForFun

Re: [Mod] Vote (with Kick voting) [0.1] [vote] - an API

by Minetestforfun » Fri Aug 21, 2015 09:22

Great work !
Needs to be used somewhere now :p
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: [Mod] Vote (with Kick voting) [0.1] [vote] - an API

by rubenwardy » Fri Aug 21, 2015 09:37

It's used on my Capture the Flag server.
 

User avatar
Minetestforfun
Member
 
Posts: 936
Joined: Tue Aug 05, 2014 14:09
GitHub: Darcidride
IRC: Darcidride + MinetestForFun
In-game: Darcidride + MinetestForFun

Re: [Mod] Vote (with Kick voting) [0.1] [vote] - an API

by Minetestforfun » Fri Aug 21, 2015 10:00

And aren't you afraid about player kick abuse ?

Example (wich happens very often in my HG server) :
10 players on the servers
A very great player wich play on a computer beat easily the android/tablet/weak other players.
So, three or four of the beated players say in loop "xxx cheat !" (because xxx, the great player, wins the 5 last games...)
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: [Mod] Vote (with Kick voting) [0.1] [vote] - an API

by rubenwardy » Fri Aug 21, 2015 13:07

It's used to vote in a next game.
 


Return to Mod Releases

Who is online

Users browsing this forum: Bing [Bot] and 26 guests

cron