TimedPermissions

Moved

Total Downloads: 2,967 - First Release: May 20, 2016 - Last Update: Apr 7, 2017

5/5, 22 likes
  1. Wulf

    Wulf Community Admin

    I don't think this plugin has anything to do with RCON messages.
     
  2. yes, and I just realized that it worked perfectly. Thanks.
     
  3. 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:
    [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 by a moderator: Nov 8, 2016
  4. Hello. It may be better to use a timestamp? Simply with MYSQL.
     
  5. it is possible to reduce
    Code:
            [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);
                }
            }
     
  6. Please, add custom command ExpireDate for all permitable players.
    Example /vip or /premium
    And... Command for revoke permission and remove users from TimedPermissions.
     
  7. (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.
     
  8. 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.
     
  9. 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 by a moderator: Jan 2, 2017
  10. As said above, that is a todo for me.
     
  11. Hey, write me in PM, I need help
     
  12. whether it is possible to make that a privilege is added to the group, and not per player?
     
  13. Not as written. Could be added, but only with some work.
     
  14. Why would you need that?
     
  15. say after a wipe to give any privilege to a large part of the players
     
  16. how to reset the counter for the player and remove it from the group?
     
  17. @LaserHydra Hello mate,

    Did we have a chance to get a reset and/or remove command?
     
  18. 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. omg i didnt knew about this plugin, is exactly what i was looking for! Ty LaserHydra!
     
  20. "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. ??