Enhanced voting for Enemy Territory - Wolfenstein.

  • 2 heads
  • git clone https://klva.cz/src/etwolf/votexx.git
  • Sanitize team specific vote when defender is not set. a23d757, 21 Nov 2021
    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 etpro folder.
    2. Create an empty vote++.config.lua file (that's where the configuration goes).
    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.

    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")
    

    ETAdmin integration

    ETAdmin can, under certain conditions, automatically cancel or pass votes. It does so by executing cancelvote or passvote to server console. ETPro doesn't propagate this command to Lua modules, so you need to change it to cancelvote++ and passvote++. Native functionality is preserved.