LFG

LFG 1.1.4

UNLOAD AND DELETE CONFIG BEFORE UPDATE.
Added some null checks added new option to config for lfg on connect.
Fix for Rust update
Fix for EnqueueGet and End of File error.
PLEASE DELETE YOUR CONFIG FILE PRIOR TO LOADING THIS!

Added config options to enable/disable PlayTime Hours, ShareDoors, and LustyMap Support.

***These were default options prior to this update.***

Use_LustyMap ---> If 'true' group members will be shown on lustymap as a "friend".
ShareLocks ---> If 'true' group members will be able to open any lock owned by a group member that they are also authorized on the tool cupboard for. So if a group member has TC access they also can open any locked door, box, etc. within that TC radius.
Disable_PlayTime ---> If 'true' all players will have a PlayTime of 0 in the Menu. This will skip the hours check.
Complete re-write, code refactoring, performance enhancing.

CONFIG FILE HAS CHANGED!

I will not lie, this is very different from a code perspective so please don't get upset about bugs we will fix them if any arise. I have done a ton of testing and it all seems to work well. If you have major issues just go back to the old version and help me fix it. Thanks!!

CHANGES:
Added the ability to save groups and players. So the plugin works the same where it only shows players online but if you leave the game and rejoin you are still in the same group.

Added Ban List for if you leave a group or are kicked and want to try and rejoin it (config option)

I added custom chat tags, colors, logos, and group names.

I added an Onscreen UI Menu button.. (see image below) ->> can be disabled in config.

The names and logos don'y really have any purpose within LFG but I am actually use it in other plugins to render group images within UI and such (attaching a picture to show how that can work).

I added LustyMap support so group members see each-other on the map.

Added a BetterChat hook to ensure you don't get double chat messages when talking within group private chat.

Added several APIs for plugin development.

When a player creates a group or becomes the leader they are given instructions for changing the group variables stated above. For the purpose of this post they are as follows:

/lfg name <type name - can include spaces>
/lfg logo <image url>
/lfg tag <chat tag max 5 characters>
/lfg color <color> --> if wrong color is typed it provides a list of acceptable colors

API HOOKS ADDED:
C#:
[HookMethod("GetGroupInfo")]
        object GetGroupInfo(ushort ID, string request)
        {
            if (ID == 0 || !data.SavedGroups.ContainsKey(ID)) return false;
            switch (request.ToLower())
            {
                case "name":
                    return data.SavedGroups[ID].GroupName;
                case "logo":
                    return data.SavedGroups[ID].logo;
                case "tag":
                    return data.SavedGroups[ID].tag;
                case "color":
                    return data.SavedGroups[ID].color;
                case "members":
                    return data.SavedGroups[ID].Members;
                case "leader":
                    return data.SavedGroups[ID].Leader;
                default:
                    return false;
            }
        }
        [HookMethod("GetPlayerGroup")]
        ushort GetPlayerGroup(ulong id)
        {
            if (data.PlayerGroup.ContainsKey(id))
                return data.PlayerGroup[id].ActiveGroup;
            return 0;
        }

        [HookMethod("GetGroupLeader")]
        BasePlayer GetGroupLeader(ushort groupId)
        {
            if (ActiveGroups.ContainsKey(groupId))
                return ActiveGroups[groupId].OnlineMembers.Where(k=>k.userID == ActiveGroups[groupId].groupData.Leader).Select(k=>k).FirstOrDefault();
            return null;
        }

        [HookMethod("GetLeaderDisplayName")]
        string GetLeaderDisplayName(ushort groupId)
        {
            if (ActiveGroups.ContainsKey(groupId))
                return GetDisplayName(ActiveGroups[groupId].groupData.Leader);
            return "UNKNOWN";
        }

        [HookMethod("isGroup")]
        bool isGroup(ushort groupId)
        {
            if (data.SavedGroups.ContainsKey(groupId)) return true;
            return false;
        }

        [HookMethod("BroadcastGroup")]
        void BroadcastGroup(string msg, ushort groupId)
        {
            if (!ActiveGroups.ContainsKey(groupId)) return;
            foreach (var entry in ActiveGroups[groupId].OnlineMembers)
                OnScreen(entry, msg);
        }

Attachments

  • UIButtons.png
    UIButtons.png
    207.5 KB · Views: 498
  • GroupNameANDLogoExample.png
    GroupNameANDLogoExample.png
    233.6 KB · Views: 523
  • BannedMessage.png
    BannedMessage.png
    328.6 KB · Views: 504
This should be it.... omg! What a mess.
Fix for finding and storing images. This plugin was missing a ResourceId.
You MUST update ImageLibrary. This update is solely for the ImageLibrary update.

Thanks!
Fixed console spam for private profile players.
Sorry.. missed a permission check! How has no one complained about this yet!