Voter Rewards

Rewards players who vote for your server on rust-servers.net

Total Downloads: 3,457 - First Release: Jan 5, 2015 - Last Update: Jun 18, 2017

5/5, 18 likes
  1. Code:
        "Rewards": [
          {
            "price": 4,
            "reward": {
              "wood": 10000                                          WORK
            }
          },
          {
            "price": 4,
            "reward": {
              "stones": 10000                                               WORK
            }
          },
          {
            "price": 4,
            "reward": {
              "cloth": 10000                                                 WORK
            }
          },
          {
            "price": 4,
            "reward": {
              "animal": {                                                        No WORK
                "Animal Fat": 10000
              }
            }
          },
          {
            "price": 4,
            "reward": {
              "HQ Metal": {
                "High Quality Metal": 400                       No WORK
              }
            }
          },
          {
            "price": 4,
            "reward": {
              "sulfur": {
                "Sulfur": 10000                                        No WORK
              }
            }
          },
          {
            "price": 4,
            "reward": {
              "Pistol Bullet": 64,                                     No WORK
              "pistol_revolver": 1
            }
          },
          {
            "price": 6,
            "reward": {
              "Pistol Bullet": 64,                                   No WORK
              "Thompson": 1
            }
          },
          {
            "price": 8,
            "reward": {
              "5.56 Rifle Ammo": 64,                                       No WORK
              "Bolt Action Rifle": 1
            }
          },
          {
            "price": 10,
            "reward": {
              "Handmade Shell": 32,
              "Pump Shotgun": 1                                       No WORK
            }
          },
          {
            "price": 12,
            "reward": {
              "5.56 Rifle Ammo": 64,                             No WORK
              "Assault Rifle": 1
            }
          }
        ],

    wen im use name type ammo_rifle or ammo.rifle NO WORK TO ... its say you got your reward but nothin in inventory .
     
  2. Code:
    {
      "Messages": {
        "ChatFormat": "<color=#af5>{NAME}:</color> {MESSAGE}",
        "ChatName": "[Voter]",
        "ChatPlayerIcon": true,
        "Help": [
          "/vote -- show a list of available urls for voting and get points for voting",
          "/rewards -- show the rewards information and your points",
          "/rewards [ID] -- get the reward"
        ],
        "RewardGived": "You got your reward!",
        "RewardNotFound": "Reward with this ID cann't be found!",
        "RewardNotPoints": "You do not have enough points for this reward!",
        "RewardsBalance": "Your points: %s",
        "RewardsBegin": "-------- /rewards [id] (Get Reward) --------",
        "RewardsEnd": "-------------------------------------------------",
        "RewardsList": "Points: {PRICE}, Reward: {REWARD}",
        "StatusBadApiKey": "Invalid API key.",
        "StatusCanVote": "You can vote at '%s' (Points for voting: %i)",
        "StatusGetPoint": "Thanks for vote! (Points received: %s)",
        "StatusNotAvailable": "The tracker is not available now. Please try again later."
      },
      "Settings": {
        "DataFile": "VoterData",
        "Rewards": [
          {
            "price": 4,
            "reward": {
              "wood": 10000
            }
          },
          {
            "price": 4,
            "reward": {
              "stones": 10000
            }
          },
          {
            "price": 4,
            "reward": {
              "cloth": 10000
            }
          },
          {
            "price": 4,
            "reward": {
              "animal": {
                "Animal Fat": 10000
              }
            }
          },
          {
            "price": 4,
            "reward": {
              "HQ Metal": {
                "metal": {
                  "refined": 400
                }
              }
            }
          },
          {
            "price": 4,
            "reward": {
              "sulfur": {
                "sulfur": 10000
              }
            }
          },
          {
            "price": 4,
            "reward": {
              "ammo": {
                "pistol": 64
              },
              "pistol": {
                "revolver": 1
              }
            }
          },
          {
            "price": 6,
            "reward": {
              "ammo": {
                "pistol": 64
              },
              "smg": {
                "thompson": 1
              }
            }
          },
          {
            "price": 8,
            "reward": {
              "ammo": {
                "rifle": 64
              },
              "rifle": {
                "bolt": 1
              }
            }
          },
          {
            "price": 10,
            "reward": {
              "ammo": {
                "shotgun": 32
              },
              "Pump Shotgun": 1
            }
          },
          {
            "price": 12,
            "reward": {
              "ammo": {
                "rifle": 64
              },
              "rifle": {
                "ak": 1
    
    When im use short name the confing after oxide.reload is changet to other shor names withnout "." and ingame i see any XTABLE error in every rewards line
    http://images.akamai.steamuserconte...459/CB02F547731F0FBC1F2BCB478C88CB232033235D/

    and when im use this "ammo.rifle" or this "ammo_rifle" its same no work
     
    Last edited by a moderator: Jan 18, 2016
  3. It's because it has to be re-written in C# since dots == "." are considered tables in Lua.
    Seems no one wants to re-write it in C#.
     
  4. when i try to add the supply signal short name to the config, it's disable the command
    /rewards 1
    the 1 (it's my ID).
    what i need to do to fix it?
     
    Last edited by a moderator: Jan 26, 2016
  5. Hi guys, the plugin is not working for me, not sure if I´m the only one. Compiles but nothing happens when typing /vote.
     
  6. I think because the plugin not support rust experimental items…
     
  7. Plugin works fine for me. Any short name item with a "." will not work with lua but needs to be re-written in c# as Hollyezz states above.

    Code:
    function PLUGIN:C_Rewards(player, cmd, args)
        local arg2 = args.Length > 0 and tonumber(args[0])
        if arg2 then
            local reward = settings.Rewards[arg2] 
            if reward then
                local steamid = rust.UserIDFromPlayer(player)
                local data = USERS[steamid] or 0
                if data >= reward.price then
                    local inv = player.inventory
                    for shortname, amount in pairs(reward.reward) do
                        if shortname == "Money" then
                            if API then API:GetUserDataFromPlayer(player):Deposit(amount) end
                        else
                            local name, count = shortname:gsub("_bp", "")
                            if count == 0 then
                                item = global.ItemManager.CreateByName(name, amount)
                            else
                                local def = global.ItemManager.FindItemDefinition.methodarray[1]:Invoke(nil, util.TableToArray( { name } ) )
                                if def then item = global.ItemManager.CreateByItemID(def.itemid,amount,true) end
                            end
                            if item then inv:GiveItem(item) end
     
  8. What is this code?
     
  9. it is the current lua item give code for this plugin. It needs to be re-written in c# order for items like "supply.signal" to work
     
  10. Where do I put this exactly?
     
  11. Oh nevermind, apparently the file was reset after the update (weird) and just needed to add the rewards and the key again.
    Now it's working like a charm again.
    :)
     
  12. you don't need to put this anywhere. It is the code already written for this plugin. I am just saying that it needs to be re-written in order for it to work with item shortnames that have a "." in them.
     
  13. Is anyone going to re-write/fix this?
     
  14. @Bombardir
    Please re-write it bro we need you here ;)
    Thanks
     
  15. +1
    Please do!
     
  16. +1 Please!
     
  17. Ive got people voting and not being rewarded. Telling them that its broken isnt getting me any brownie points. Uninstalling this mod.
     
  18. What is the correct way to reward Money from the Economy plugin?

    Code:
    "Rewards": [
          {
            "price": 1,
            "reward": {
              "Money": 100,
            }
          },
          {
            "price": 2,
            "reward": {
              "Money": 250,
            }
          },
          {
            "price": 3,
            "reward": {
              "Money": 400,
            }
          }
        ],
    I have 1 point and typed /rewards 1 and do not get the reward.
    Actually, none of these work.

    Ooo error codes:
    Code:
    [Error] Failed to call hook 'C_Rewards' on plugin 'voter v1.4.0'
    File: voter.lua Line: 130 attempt to call method 'GetUserDataFromPlayer' (a nil value):
      at NLua.Lua.ThrowExceptionFromError (Int32 oldTop) [0x00000] in <filename unknown>:0
      at NLua.Lua.CallFunction (System.Object function, System.Object[] args, System.Type[] returnTypes) [0x00000] in <filename unknown>:0
      at NLua.Lua.CallFunction (System.Object function, System.Object[] args) [0x00000] in <filename unknown>:0
      at NLua.LuaFunction.Call (System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Ext.Lua.Plugins.LuaPlugin.OnCallHook (System.String hookname, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.Plugin.CallHook (System.String hookname, System.Object[] args) [0x00000] in <filename unknown>:0 
     
    Last edited by a moderator: Feb 8, 2016