Enhanced voting for Enemy Territory - Wolfenstein.

  • 2 heads
  • git clone https://klva.cz/src/etwolf/votexx.git
  • Fixed team and side votes. d300a82, 26 Aug 2023
    examples/
    README.md
    vote++.lua

    Vote++

    This is a Lua module for Enemy Territory - Wolfenstein server introducing extended voting functionality and providing an easy way to define new commands.

    Usage

    1. Put vote++.lua in legacy folder.
    2. Create an empty vote++.config.lua file or put individual files in legacy/vote++ folder,
    3. Append vote++.lua to lua_modules cvar.

    Client interface does not reflect the casted vote, or it can incorrectly render as already casted without that being actually the case. You can fix that in ETPro by switching to patched qagame. It is not mandatory, the votes are casted anyway; it's only the yellow popup that's wrong.

    Configuration

    All the configuration belongs to vote++.config.lua or legacy/vote++ folder.

    Apart from defining commands, you can define any ET callback (like et_RunFrame) and use any API (et.* and stdlib).

    Defining vote commands

    Vote:new("nohw")
        :description("Disable heavy weapons")
        :pass("exec nohw.cfg")
    

    This command can be executed as: callvote nohw, ref nohw (in server console or as an authenticated referee).

    The module automatically validates number of passed arguments and prints a help message when not enough of them is given. There's a special reserved argument <player>, which always resolves to a slot number. Caller can use part of name instead. When using string as argument to callback functions (see below), you can use: <player:%d> or <player:%s>, which resolves to a slot number or player name, respectively.

    All arguments defined in the Vote:new() constructor will be passed to callback functions (vote, pass, fail).

    Vote:new("remove <player>")
        :vote("PUTSPEC <player:%s>") -- PUTSPEC ETPlayer
    
    Vote:new("kill <player>")
        :vote(function(player)
    
            if math.random() < 0.5 then
                return false, "No, you're out of luck." -- you can optionally return error message
            end
    
            return string.format("KILL %s", et.gentity_get(player, "pers.netname"))
        
        end)
    

    Disabling vote commands

    You can disable any or all the vote commands, including the built-in ones.

    V.disable("*") -- disables all commands
    V.disable("warmupdamage")
    V.enable("kick")