Results 1 to 8 of 8

Thread: Using voting system for Jim's punishment

  1. #1

    Default Using voting system for Jim's punishment

    Hi guys,

    Does anyone know if it's possible to use the voting system in conjuntion with Jim's punisment script?
    For example I want players to have the option to call a vote for a pistol-only match.

    So a player could call a vote and if passed a punishment-command is given to all players to drop all weapons and give a pistol.
    In this case the Jim command would be something like: "!all pistol" (without the quotes).

    I added the command !all pistol to the allowed votes script but when I try to call that vote MOHAA gives an error
    saying "This command is not valid for voting"

    Maybe the space between "!all" and "pistol" is not allowed so I tried adding it to allowedvotes.cfg with and without quotes but still
    a no-go.
    Doesn't it work because you need admin rights to use Jim's punishment commands? Or does the voting system only allows for "standard" internal commands like restart and mapchange?

    If anyone could enlighten me about the voting system it would be much appreciated!
    Last edited by Midnight1138; February 2nd, 2018 at 08:08 AM.
    -=With One Well Placed Blow Thorin Cleaves Your Skull=-

    http://www.twinbee.org/hob/play.php?snap=hobbit


    <KILL THORIN>
    You attack Thorin.
    But the effort is wasted. His defense is
    too strong.
    Thorin attacks -you- !!!
    With one well placed blow Thorin cleaves
    your skull.
    You are dead.
    You have mastered 0.0% of this adventure.

  2. #2

    Default

    just add !all to the allowed votes.

  3. #3
    Purple Developer Purple Elephant1au's Avatar
    Join Date
    Feb 2012
    Location
    Australia
    Posts
    1,269

    Default

    Unfortunately i believe it will only accept MOHAA commands like you have said, although i have never tried Zappas suggestion of just adding it to the allowedvotes.cfg.

    This was an idea i had to implement into the reborn voting system to make it more versatile, allowing custom commands to be added to the regular voting system.
    I believe i even started to make a server-side voting menu aswell, but cant remember how far i got in that, think i got stuck on getting the mouse to work.

    One could also implement a completely new voting system using scmd events, but much easier to use exisiting system.

    Purple's Playground
    OBJ :
    103.29.85.127:12203
    xfire: purpleelephant1au
    email: purpleelephant1au@gmail.com
    skydrive: PurpleElephantSkydrive




  4. #4

    Default

    but the reborn voting system already works with custom commands



    but with "!all" people will be able to vote for every value for the !all command, not just "!all pistol"
    you should extract the code and make a new script with a new command to avoid that

  5. #5
    Purple Developer Purple Elephant1au's Avatar
    Join Date
    Feb 2012
    Location
    Australia
    Posts
    1,269

    Default

    Well there you go, you can include different commands into the voting,
    on that note that, if someone was to callvote crash, and it passed, would it crash the server?
    Or if you called a vote to make yourself invincible (nodamage) before anyone else was on the server...

    Also my idea would be expand on the current one, allowing you to specify which arguments could be allowed in the vote, exactly how the allowedmaps.cfg works, but allowing you to create your own.
    So in your above problem, you could create a allowed!all.cfg file which contains a list of all arguments allowed after the !all command.
    Last edited by Purple Elephant1au; February 3rd, 2018 at 01:18 AM.

    Purple's Playground
    OBJ :
    103.29.85.127:12203
    xfire: purpleelephant1au
    email: purpleelephant1au@gmail.com
    skydrive: PurpleElephantSkydrive




  6. #6

    Default

    Thanks guys for your input! So it looks like the voting system is indeed (somewhat) flexible.
    About extracting the code Zappa mentioned, how would I go about that? I'm not handy when it comes to compiling/decompiling source codes but can do some basic scripting. I could create an allowedall.cfg script but how would I "tie" it in with the voting system?
    So please give me a few pointers to work with if possible?


    P.S.
    I tried to find as much info as I could about the voting system, on google and here on XNull, but documentation about it is hard to find.

  7. #7

    Default

    I have made this way and works.

    First set the pistol command on the allowedvotes.cfg:

    Code:
    pistol
    Next put this script running on the server:


    while(1)
    {
    wait 0.02

    local.pistol = getcvar "pistol"

    if(local.pistol == "1")
    {


    $player takeall

    for(local.i = 1;local.i <= $player.size;local.i++)
    {

    local.player = $player[local.i]

    if(local.player == NULL)
    end

    if(local.player.dmteam == "allies")
    {

    local.player give "weapons/colt45.tik"

    local.player useweaponclass pistol

    }
    else
    {

    local.player give "weapons/p38.tik"
    local.player useweaponclass pistol

    }
    }

    setcvar "pistol" "0"

    //set the timout you whant to dont allow a player to vote again during the gametype you whant
    //setcvar "g_votetimeout "0"

    }
    }


    Call the vote using callvote pistol 1

    Note: If a player dont call the vote using 1 the script will not work.

  8. #8

    Default

    It works!

    Thanks Double, Purple and Zappa!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •