1. Messing around with the SkipNightVote plugin and attempting to modifying it so that it only displays the votes in chat every 5 votes, rather than every 1. How would you go about doing it?

    I imagine it's as simple as changing

    Code:
                public int tallyVotes() {
                    int yesVotes = 0;
                    foreach (var votes in votesReceived) {
                        if (votes.Value)
                            yesVotes = yesVotes + 1;
                    }
                    return yesVotes;
    but I ain't great with C#
     
  2. Wulf

    Wulf Community Admin

    Replace yesVotes = yesVotes + 1; with yesVotes++;
     
  3. You need to work out if the current number is divisible by the amount you want it displayed at. I did this in ServerRewards, The % operator computes the remainder after dividing the 1st operand by the second.
    Pretty much it returns the remainder of a division. For example 25 % 24 = 1 because 25 fits in 24 once, and you have 1 left. When the number fits perfectly it will return a 0

    Here is a example method
    Code:
    bool IsDivisble(int x, int y) => (x % y) == 0;
    // x is the current count
    // y is the amount you want it displayed at
    // returns true if the count can be equally divided by the amount you want it displayed at
     
  4. This still just increments it by one doesn't it? It wouldn't perform the print every five votes rather than every vote ;_;
     
  5. Wulf

    Wulf Community Admin

    If you want it every X amount, add an if check like what was posted above.
     
  6. I'll admit that I'm not great when it comes to this, but I imagine doing so would trigger a "cannot convert bool to int", right?
     
  7. The function I posted calculates whether the 2nd number is equally divisible by the first number and then returns true if it is. I thought my explanation was pretty simple. Here is another example
    Code:
    if (isDivisable(yesVotes.Count, 5)
    SendReply(player, "Current count is a division of 5, therefore this message is being sent");
     
  8. Imagine you're talking to a 10 year old, I'd say that's probably my experience with C#/Rust Programming. Sorry. Thanks for the help though.
     
  9. Lol, all g. Did the last example make sense?
     
  10. Yeah, it did. Cheers.