Timed Permissions

Allows you to grant permissions or groups for a specific time

Total Downloads: 1,443 - First Release: May 20, 2016 - Last Update: Apr 7, 2017

5/5, 18 likes
  1. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    I don't think this plugin has anything to do with RCON messages.
     
  2. SeBL4RD 2

    SeBL4RD 2 Shack Builder

    yes, and I just realized that it worked perfectly. Thanks.
     
  3. Windamyre

    Windamyre Wood Hoarder

    One thing I'd been looking for with this plug-in was a way for players to find out when they're permissions expire. I use this along with Server Rewards to 'sell' VIP perks in exchange for rewards points, and wanted people to be able to avoid re-buying permissions they already had, or to know that that permission was no longer valid for them.

    Eventually, I figured out a way to do this. It's a bit of a kludge; my c# skills are not on par with LaserHydra or Wulf. Most of it is just a butchered version of the /pinfo command with a tweak or two. You can paste this into the TimedPermissions.cs file. I put it around line 363, just above the [Command("pinfo", "global.pinfo"), Permission("timedpermissions.use")] line.

    If anyone has any improvements, such as correcting clumsy code, or excising parts I left behind that are unnecessary, chime in. I'm thinking the part where it checks for null values of the player are probably not needed, but again I'm a noob at this.

    Code (Text):
    [Command("myinfo", "global.myinfo")]
            void cmdMyInfo(IPlayer player, string cmd, string[] args)
            {
             
                ulong steamID = 0;
                IPlayer target = null;

                target = player;
                if (target != null)
                {
                    if (Player.GetOrCreate(target) == null)
                        _players.Add(new Player(target));

                    Player pl = Player.Get(target);
                    if (steamID == 0 && target == null)
                        return;

                    if (pl == null)
                        player.Reply(GetMsg("Player Has No Info"));
                    else
                    {
                        string msg = GetMsg("Player Info");

                        msg = msg.Replace("{player}", "your VIP permissions:");
                        msg = msg.Replace("{groups}", string.Join(", ", (from g in pl.groups select $"{g.@group} until {g.expireDate}").ToArray()));
                        msg = msg.Replace("{permissions}", string.Join(", ", (from p in pl.permissions select $"{p.permission} until {p.expireDate}").ToArray()));

                        player.Reply(msg);
                    }
                }

            }
    Use at your own discretion. I provide no warranty of fitness for any purpose. All I can say is it works on my server.
     
    Last edited: Nov 8, 2016
    Findles and Dream 5 like this.
  4. Cerber0s

    Cerber0s Wood Hoarder

    Hello. It may be better to use a timestamp? Simply with MYSQL.
     
  5. Cerber0s

    Cerber0s Wood Hoarder

    it is possible to reduce
    Code (Text):

            [Command("myinfo", "global.myinfo")]
            void cmdMyInfo(IPlayer player, string cmd, string[] args)
            {
                Player pl = Player.Get(player);
                if (pl == null)
                    player.Reply(GetMsg("Player Has No Info"));
                else
                {
                    string msg = GetMsg("Player Info");

                    msg = msg.Replace("{player}", "your VIP permissions:");
                    msg = msg.Replace("{groups}", string.Join(", ", (from g in pl.groups select $"{g.@group} until {g.expireDate}").ToArray()));
                    msg = msg.Replace("{permissions}", string.Join(", ", (from p in pl.permissions select $"{p.permission} until {p.expireDate}").ToArray()));

                    player.Reply(msg);
                }
            }
     
    Windamyre likes this.
  6. Casper ;3

    Casper ;3 Shack Builder

    Please, add custom command ExpireDate for all permitable players.
    Example /vip or /premium
    And... Command for revoke permission and remove users from TimedPermissions.
     
    StreetDog and SeBL4RD 2 like this.
  7. Windamyre

    Windamyre Wood Hoarder

    (Quick Note: I thought I had posted about this a week ago, but can't find the post - I probably didn't hit Post Reply button or something. In case someone's seen the post in the wrong forum, let me know so I can clean up my mess.)

    I love the Timed Permissions plug-in as it lets me easily sell limited VIP perks in the Rewards Store. The catch I'm running into is when a player tries to buy a perk before it's expired.

    Each time the grantperm command is run, the plug-in creates an _exipreDate in the data file. It doesn't do any checking, just appends it to the players list of permissions. The problem comes if a second grantperm is run before the first one expires. Let me illustrate using the following command "grantperm Windamyre NTeleportation.VIP 7d".
    • Dec 1st: buy the perk. Permission is granted and _expireDate is set at Dec 8th
    • Dec 5th: buy the perk again. Original _expireDate is not affected, a second _expireDate of Dec 12th is appended.
    • Dec 8th: Perk is revoked as original _expireDate has been reached. Second _expireDate stays in file.
    • Dec 9th: Confused, I buy it again. Plug grants permission, creates a third _expireDate for Dec 16th (only second and third are in the file at this time).
    • Dec 12th: Perk is revoked again, as second _expireDate of Dec 12 has come around.
    This continues until the player gives up.
    Some things that might prevent this:
    • Adding a command such as revokeperm with a syntax of /revokeperm <player|steamid> <permission> that could be run before the grantperm to clear out old _expireDates.
    • Changing the grantperm to check the data file for an existing _expireDate and modifying it - either changing it to the target date or adding the time to the _expireDate.
     
    Dream 5, StreetDog and LaserHydra like this.
  8. LaserHydra

    LaserHydra Grenade Master Plugin Developer

    Indeed I need to implement better handling of existant permissions. I hope that I will find time to do that soon, but I can nit guarantee it as I am quite busy lately.
     
    StreetDog and Windamyre like this.
  9. qqept

    qqept Scavenger

    I so sory 4 google translate^^:

    I use host-store plugin for issuing purchases. I would like the player to buy VIP for a one month and more for a one week.
    The store can not sell it as "addgroup 37d", only two separate command "addgroup 30d" and "addgroup 7d" (they are two different goods in the basket). As a result, when both of these commands are executed, we have TWO VIP record in datafile - for a one month and for one week. But after one week deleted BOTH records - 7days and 30 days and player has no longer have VIP privilegies (30 days purged).
    How can we realize that in the execute "addgroup" date is not duplicate but was summed in one datafile record?
     
    Last edited: Jan 2, 2017
  10. LaserHydra

    LaserHydra Grenade Master Plugin Developer

    As said above, that is a todo for me.
     
    Windamyre likes this.
  11. Fill^Kosel-->

    Fill^Kosel--> Wood Hoarder

    Hey, write me in PM, I need help
     
  12. HISHNIK__

    HISHNIK__ Scavenger

    whether it is possible to make that a privilege is added to the group, and not per player?
     
  13. Windamyre

    Windamyre Wood Hoarder

    Not as written. Could be added, but only with some work.
     
  14. LaserHydra

    LaserHydra Grenade Master Plugin Developer

    Why would you need that?
     
  15. HISHNIK__

    HISHNIK__ Scavenger

    say after a wipe to give any privilege to a large part of the players
     
  16. q1LLa

    q1LLa Wood Hoarder

    how to reset the counter for the player and remove it from the group?
     
  17. sami37

    sami37 Master Researcher Plugin Developer

    @LaserHydra Hello mate,

    Did we have a chance to get a reset and/or remove command?
     
  18. Mister Mo

    Mister Mo Naked Wanderer

    Hello, how do I set up a temporary results players group in the plugin Better Chat? I have TimedPermission, there is the opportunity to give permission for minutes, days and so on, but that would be to assign a group plugin Better Chat, you need to enter the command in chat. How to be in this situation?
     
  19. RencaR

    RencaR Wood Hoarder

    omg i didnt knew about this plugin, is exactly what i was looking for! Ty LaserHydra!
     
  20. RencaR

    RencaR Wood Hoarder

    "TimedPermissions has replaced the 'grantperm' command previously registered by TimedPermissions
    TimedPermissions has replaced the 'addgroup' command previously registered by TimedPermissions
    TimedPermissions has replaced the 'pinfo' command previously registered by TimedPermissions"

    got this on the console. ??