Allows players to upvote/downvote other players

Supported Games
GameServerKingsGameServerKings

Karma System offers a reddit-like reputation system. It also offers a wide variety of methods for other plugins to make use of. This plugin doesn't really serve much purpose on it's own, however I do plan on making a lot of addon plugins for it.

Chat Commands

  • /upvote <player> -- Upvote a players karma by the amount set in the config
  • /downvote <player> -- Downvote a players karma by the amount set in the config
  • /karma -- Display your karma information, amount of karma you have and amount of votes you have
  • /karma <player> -- Display the karma of the player specified
  • /karma top -- Display the top configurable amount of players with the highest karma
  • /karma bottom -- Display the bottom configurable amount of players with the lowest karma

Configuration

{
  "UpvoteSettings": {
    "Amount": 1,
    "EnableCommand": true
  },
  "DownvoteSettings": {
    "Amount": 1,
    "EnableCommand": true
  },
  "Top": {
    "ShowAmount": 5
  },
  "Bottom": {
    "ShowAmount": 5
  },
  "EnableKarmaCommand": true,
  "Cooldown": 60.0,
  "OneVotePerPlayer": false
}

Localization

Developer API

private int GetKarma(IPlayer player)

Used to get the amount of karma a player

private void AddKarma(IPlayer player, int amount)

Used to add an amount of karma to a player

private void RemoveKarma(IPlayer player, int amount)

Used to remove an amount of karma from a player

private void AddPlayer(IPlayer player)

Adds a player to the data file

private void AddVoted(IPlayer player, string ID)

Adds a steamid to the players voted list

private void OnKarmaVote(IPlayer player, IPlayer target, int amount)
{
    // Your code here
}

Used to perform actions when a player upvotes/downvotes someone, UI refreshes, etc.

Add a plugin reference in your plugin to use these methods:

[PluginReference]
private Plugin KarmaSystem;

Example of how you can use the methods inside of another plugin:

private void MyAPIMethodExample(IPlayer player, IPlayer target)
{
    // Getting players karma
    (int)KarmaSystem.Call("GetKarma", player);
    // Adding karma to a player (adds 1 karma)
    KarmaSystem.Call("AddKarma", player, 1);
    // Removing karma from a player (removes 1 karma)
    KarmaSystem.Call("RemoveKarma", player, 1);
    // Adding a player to KarmaSystems data
    KarmaSystem.Call("AddPlayer", player);
    // Adding a players steam ID to a players voted list
    KarmaSystem.Call("AddVoted", player, target.Id);
}

Addon Ideas

  • Permission granting on # amount of karma, ie: mute player if less than -10 karma, or kit permission on 20 karma
  • Game specific plugins such as UI's displaying information (karma amounts, etc.)
  • Plugin that adds karma every # kills on players/animals

Credits

  • maxaki, for the idea and suggestion
This plugin is unlicensed and the original author reserves all rights to it.

The original author may request that this plugin be removed and there is a risk that the plugin may be unavailable in the future.

Note that the current maintainer may not have permission to assign a license to the plugin if they are not the original author, so explicit permission would need to be obtained from the original author in order for the plugin to remain openly available and guarantee that it will be around for all to enjoy going forward.

6.3K downloads
36 watchers

rewardsapi