EasyVote

Moved

Total Downloads: 4,114 - First Release: Aug 27, 2016 - Last Update: Mar 24, 2018

5/5, 14 likes
  1. EasyVote storage how much time player has voted. You found it from data/easyvote,json
     
  2. is it possible for people to click the link in the chat when typing /vote?
     
  3. need help and new version:

    (23:30:01) | [Oxide] 01:29 [Info] Invalid Time Format: Ex: 1d12h30m | d = days, h = hours, m = minutes


    "addgroup: vip 2h"

    "addgroup": "addgroup {playerid} {value} {value2}",


    ??? how to fix?
     
  4. Its addgroup: vip-2h
    [DOUBLEPOST=1473392802][/DOUBLEPOST]
    Solved - Clicking links in the chat? | Oxide
     
  5. Hey @Excel80 I think you have done a wonderful job on this plugin. It's more in line for what I was looking for in a voting plugin and is definitely easier to use. I did have some issues with getting rewards as I did not understand what the api call was supposed to return and it was not documented on the rust-servers.net site. It would not call the RewardHandler method and if debug was on it would always call it. Since you have a well-developed backbone for this plugin I decided to add features that provided the experience i was looking for. I have attached the updated plugin and I have documented all the changes and additions below. I believe I added everything that i did but I may have missed a few things. Feel free to use anything in there for future development and thank you for all your hard work.

    Changes:
    • rust-servers.net api call now returns a json of every vote. The number of times the user has voted is calculated by how many times their userId appears in the json response. The way that way their before was not documented in the rust-servers.net api and I could see that other vote plugins did use it but It's response didn't make much sense.
    • When calling the api only one api is called from either rust-server.net or toprustservers. This is because if a player were to vote on both they would receive rewards for both servers and this would result in issues when granting rewards.
    • The method addvote was changed so that it set's the vote to the number received from the web request. The name of the method was changed to SetVote.
    • Changed some of the naming of variables and methods to be more in line with C# standards
    • Updated zlevels command to add to the mining level the command was zlvl {playername} MG +{value} but should be zlvl {playername} M +{value}
    Added:
    • At the beginning of every month the vote data is backed up to EasyVote.bac.json in the data folder. An empty vote data is then written over it
    • Rewards can now have a negative number in the format "vote-2" in the config file. If a vote is negative it means it will happen every 1st, 2nd, 3rd vote etc. For example, "vote-3" will give that reward every 3rd vote. So the 3rd, 6th, 9th, etc vote will receive this reward. If the reward number is positive the vote must equal that for them to receive their reward.
    • Players will receive all missed rewards. If the player fails to receive their rewards and votes again they will still get that reward when they go to claim it.
    • Every reward a player receives is announced to them in chat. This includes each item and the amount. It will also announce each command that is run for them. In the future This should probably be cleaned up to actually tell the player what happened and not the command.
    • The player gets notified in chat which vote the rewards that come below it are for so the user know that their vote counted and their rewards are received.
    • If a user claims a reward and their inventory is full the item will be dropped on the ground for them to pick up. This will prevent players from losing rewards if they fail to realize that their inventory can't hold it all.
    • If a player does not have any new rewards a message is displayed to them that lets them know and displays the /vote command to let them know where to vote.
    • Added an option in the config to broadcast to every player that the player voted and just received their rewards. This allows people to see if there is a known bug that could grant multiple rewards. It also tells new players where to vote and how to see what rewards are available for each vote. Updated the config to support this as well as the default config where it is set to false.
    Removed:
    • Removed several using statements that weren't being used.
    TODO:
    • The TopRustServers api was not updated to return a json or to be detected that this should be handled differently. I currently don't have one setup so this would need to be fixed in the code or to use an api that returns a similar result.
    • Update the reward list chat command to display if the vote is every 3rd vote or if the vote must match that number (In Testing) (Not Public)
    • Clean up the item name in chat that the user sees from the item short name to the display name. (In Testing) (Not Public)
    • When a command is run the text that is displayed to them is changed based on the command. This should probably be added to the config to allow server admins to change it. (In Testing) (Not Public)
    • Make sure the players vote isn't updated to a vote less than what they're already at (In Testing) (Not Public)
    • Add the strings that are displayed to the player to the lang (In Testing) (Not Public)
     

    Attached Files:

    Last edited by a moderator: Sep 9, 2016
  6. Wow, you have done really amazing job!
    Thankfully now is weekend and i can get work right away.

    In next update i will include bit of your codes in my Universal plugin.
    I need to add more vote sites and also i check/add your TODO list.

    I don't really know what to say. Im so surprised that you want to use your own personal time to "re-code" this project.
    Thank you again and i will add some credits to you to!

    Anyway, have a nice weekend.
    And see you soon ;)

    "When a command is run the text that is displayed to them is changed based on the command. This should probably be added to the config to allow server admins to change it."
    I think, that i already have that done. Language config in oxide/lang
     
  7. Thank you. :)

    What I meant by that was currently how i had it when the reward contained a command like zlvl {playername} WC +{value} it would say "zlvl MJSU WC +1" to the user in chat which doesn't really make much sense to them. So i changed it to say "You have gained 1 woodcrafting level(s)" instead which makes a lot more sense. Not sure if it should be part of the config or the lang section. I do believe the users should be able to edit it so i think that part would be better off in the config where the server owner can change it to suit their needs.
     
  8. The following TODO's have been tested and incorporated into the plugin i have attached. If the plugin errors out when receiving rewards delete your lang/EasyVote.en.json file and reload the plugin.
     

    Attached Files:

  9. Hi
    I want to my players can only earn ONE reward, even when they vote many times... so what i must put in config? This will be ok?:
    I used MJSU latest version from up.

    {
    "BroadcastVoteToAll": false,
    "Reward": {
    "vote1": [
    "supply.signal: 1"
    ]
    },
    "Settings": {
    "Prefix": "<color=#009afd>[EasyVote]</color>",
    "RustServersID": "**",
    "RustServersKEY": "**",
    "TopRustServersID": "**",
    "TopRustServersKEY": "**"
    },
    "Variables": {
    "addgroup": "addgroup {playerid} {value} {value2}",
    "addlvl": "xp addlvl {playername} {value}",
    "grantperm": "grantperm {playerid} {value} {value2}",
    "money": "eco.c deposit {playerid} {value}",
    "rp": "sr add {playername} {value}",
    "zlvl-c": "zlvl {playername} C +{value}",
    "zlvl-mg": "zlvl {playername} M +{value}",
    "zlvl-s": "zlvl {playername} S +{value}",
    "zlvl-wc": "zlvl {playername} WC +{value}"
    }
    }
     
  10. Hey @quickick,

    Your config is correct for receiving 1 supply signal for the first vote and nothing after that.
     
  11. Code:
    (15:06:01) | [Oxide] 15:07 [Error] Failed to call hook 'OnPluginLoaded' on plugin 'EasyVote v1.1.0' (NullReferenceException: Object reference not set to an instance of an object)
    (15:06:01) | [Oxide] 15:07 [Debug]   at Oxide.Plugins.EasyVote.OnPluginLoaded (Oxide.Core.Plugins.Plugin name) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.EasyVote.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.CSharpPlugin.InvokeMethod (HookMethod method, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.Plugin.CallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0
     
  12. Backup and remove old config
     
  13. I did dad <3
     
  14. Thank You so much. Version 1.1.0 works brilliant
    :)
    [DOUBLEPOST=1473749705][/DOUBLEPOST]
    Remove old EasyVote.json in config folder and EasyVote.en.json in lang folder.
    Reload and all will be fine.
     
  15. mass spam, was doing this every 3 sec or so
     

    Attached Files:

  16. I have issue with this:

    Reward will give stuff when you vote 1st time and will give items for vote 10 and 15, because it starts with 1, can you fix that?

    ],
    "vote10": [
    "metal.fragments: 3000",
    "largemedkit: 9"
    ],
    "vote15": [
    "rifle.ak: 1",
    "largemedkit: 10",
    "explosives: 100"

    ],
    "vote20": [
    "metal.facemask: 1",
    "metal.plate.torso: 1",
    "rifle.ak: 1",
    "ammo.rifle: 200",
    "explosives: 300"
     
  17. Check that your interval settings is 60 or higher. Or you can disable it by replace number to false.
    [DOUBLEPOST=1473828987][/DOUBLEPOST]
    That can also be that because you dont have number 1, script think that number 10 is closest. I check what i can do later today. Thank you for report that.
     
  18. I have it. I just copied a portion that I have issue with. It seems like it would give reward for 10 and 15 place even though player voted only 1 time.


    "Reward": {
    "vote1": [
    "hatchet: 1",
    "pickaxe: 1",
    "chicken.cooked: 20"
    ],
    "vote2": [
    "supply.signal: 1",
    "largemedkit: 1"

    ],
    "vote3": [
    "lock.code: 1",
    "largemedkit: 2"

    ],

    "vote4": [
    "lantern: 2",
    "largemedkit: 3"

    ],
    "vote5": [
    "ammo.pistol: 100",
    "largemedkit: 4"

    ],
    "vote6": [
    "fat.animal: 300",
    "largemedkit: 5"
    ],
    "vote7": [
    "cloth: 300",
    "largemedkit: 6"

    ],
    "vote8": [
    "rifle_bolt: 1",
    "largemedkit: 7"

    ],
    "vote9": [
    "syringe_medical: 5",
    "largemedkit: 8"
    ]
     
  19. Okay, good to know. I will fix this today