Rating System

Discussion in 'Plugin Development' started by bubblefat_, Jul 6, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    bubblefat_

    I want to create a rating system for rating kits, so you will type /rate <1-5> and then someone else you can see the average rating. How would I do this? I was thinking about making a list in a config with all the rating then getting the average out of all the numbers, but I don't know how to do that.
     
  2. Offline

    teej107

    @bubblefat_ It depends on how you store the player's rating in the config whether they are all combined together with the number of times the kit has been rated or storing each individual rating.
     
  3. @bubblefat_ ye @teej107 is right. If you only want to know the average, you would need 2 variables. One which saves how often the kit has been rated (int rateAmount) and the other one stores the values of the ratings (int rateSum). So every time player rates a kit, you would do rateAmount++; rateSum += value; (value is the amount he intered in the command (1-5)). So you can calculate your average by int average = rateSum/rateAmount; By using this implementation, players would be able to rate a single kit more than once.

    When you save every rate you could tell if a player already rated a kit. but you still would need to calculate the average by getting the rateSum and the rateAmount like in the upper example. So this way is like an extended version to the first one.

    I would prefer you to use the second way, because this way you would be able to give the players information about their own ratings. they could look up what they rated how good and maybe even change their rating after a while when they changed their mind or missclicked or something like that
     
  4. Offline

    teej107

  5. save them the results, and then just calculate the avarage
     
Thread Status:
Not open for further replies.

Share This Page