domingo, 20 de dezembro de 2015

HurtWorld - Better Chat


Better Chat lets you change the name colors and prefixes as you want to, by using oxide permissions.

Note: The standard groups are automatically set up.

How to:
  1. Create a group in the config as shown in the preset groups
  2. Go into your chat
  3. Create a Oxide Group (if you want to give those Settings you made to a group) using: /group add <GROUPNAME>
  4. Give the Oxide group the Settings you made using: /grant group <GROUPNAME> <PERMISSION>
  5. or if you want to give it to a User not to a group, then do: /grant user <USERNAME> <PERMISSION>
  6. if you wanted to use it on groups, you can add users to the group using: /usergroup add <USERNAME> <GROUPNAME>
Now lets do that with the example of the V.I.P. group.
  1. creating a group:
    Code (Javascript):
      "vip": {
        "ConsoleFormatting": "{Title} {Name}: {Message}",
        "Formatting": "{Title} {Name}<color={TextColor}>:</color> {Message}",
        "NameColor": "yellow",
        "Permission": "color_vip",
        "Rank": 2,
        "TextColor": "white",
        "Title": "[V.I.P.]",
        "TitleColor": "orange"
      }
  2. so it should look like this:
    Code (Javascript):
    {
      "mod": {
        "ConsoleFormatting": "{Title} {Name}: {Message}",
        "Formatting": "{Title} {Name}<color={TextColor}>:</color> {Message}",
        "NameColor": "blue",
        "Permission": "color_mod",
        "Rank": 3,
        "TextColor": "white",
        "Title": "[Mod]",
        "TitleColor": "yellow"
      },
      "owner": {
        "ConsoleFormatting": "{Title} {Name}: {Message}",
        "Formatting": "{Title} {Name}<color={TextColor}>:</color> {Message}",
        "NameColor": "blue",
        "Permission": "color_owner",
        "Rank": 4,
        "TextColor": "white",
        "Title": "[Owner]",
        "TitleColor": "red"
      },
      "vip": {
        "ConsoleFormatting": "{Title} {Name}: {Message}",
        "Formatting": "{Title} {Name}<color={TextColor}>:</color> {Message}",
        "NameColor": "yellow",
        "Permission": "color_vip",
        "Rank": 2,
        "TextColor": "white",
        "Title": "[V.I.P.]",
        "TitleColor": "orange"
      },
      "player": {
        "ConsoleFormatting": "{Title} {Name}: {Message}",
        "Formatting": "{Title} {Name}<color={TextColor}>:</color> {Message}",
        "NameColor": "blue",
        "Permission": "color_player",
        "Rank": 1,
        "TextColor": "white",
        "Title": "[Player]",
        "TitleColor": "blue"
      },
      "WordFilter": {
        "Enabled": false,
        "FilterList": [
          "fuck",
          "bitch",
          "faggot"
        ]
      }
    }
  3. Open up your Chat
  4. Type: /group add vip
  5. Type: /grant group vip color_vip
  6. Type: /usergroup add LaserHydra vip

To set priority ( means if someone has multiple groups, setting which formatting is actually used ) just change the rank of it ( the higher the value the higher the rank )

Commands:
  • /colors shows all available colors (You can also use -> HEX Codes!)
Permissions:
  • betterchat.formatting - needed for the usage of formatting tags like <color=orange>
Extra features:
  • different colors and prefixes depending on oxide groups
  • You can do alot with the "Formatting" of a group. you can customize it with
    • {Rank} = Group Rank
    • {Title} = Group Title
    • {TitleColor} = Group Title Color
    • {NameColor} = Group Name Color
    • {TextColor} = Group Text Color
    • {Name} = Player Name
    • {ID} = Player SteamID
    • {Message} = Message
And also just add words, letters, numbers, and symbols to it. Its everything possible. You can also just out the Title behind the name or stuff like that.

Standard Config file:
Code (Javascript):
{
  "mod": {
    "ConsoleFormatting": "{Title} {Name}: {Message}",
    "Formatting": "{Title} {Name}<color={TextColor}>:</color> {Message}",
    "NameColor": "blue",
    "Permission": "color_mod",
    "Rank": 2,
    "TextColor": "white",
    "Title": "[Mod]",
    "TitleColor": "yellow"
  },
  "owner": {
    "ConsoleFormatting": "{Title} {Name}: {Message}",
    "Formatting": "{Title} {Name}<color={TextColor}>:</color> {Message}",
    "NameColor": "blue",
    "Permission": "color_owner",
    "Rank": 3,
    "TextColor": "white",
    "Title": "[Owner]",
    "TitleColor": "red"
  },
  "player": {
    "ConsoleFormatting": "{Title} {Name}: {Message}",
    "Formatting": "{Title} {Name}<color={TextColor}>:</color> {Message}",
    "NameColor": "blue",
    "Permission": "color_player",
    "Rank": 1,
    "TextColor": "white",
    "Title": "[Player]",
    "TitleColor": "blue"
  },
  "WordFilter": {
    "Enabled": false,
    "FilterList": [
      "fuck",
      "bitch",
      "faggot"
    ]
  }
}
For Developers:

API methods:
  • Dictionary<string, object> GetPlayerFormatting(BasePlayer player)
  • Dictionary<string, object> GetGroup(string name)
  • List<string> GetGroups()
  • List<string> GetPlayersGroups(BasePlayer player)
  • bool GroupExists(string name)
  • bool AddPlayerToGroup(BasePlayer player, string name)
  • bool RemovePlayerFromGroup(BasePlayer player, string name)
  • bool PlayerInGroup(BasePlayer player, string name)
  • bool AddGroup(string name, Dictionary<string, object> name)

Data from GetPlayerFormatting(BasePlayer player):
  • Formatting = Config[Formatting]
  • ConsoleFormatting = Config[ConsoleFormatting]
  • GroupRank = Config[GroupRank]
  • Title = Config[Title]
  • TitleColor = Config[TitleColor]
  • NameColor = Config[NameColor]
  • TextColor = Config[TextColor]
[EXAMPLE GetPlayerFormatting(BasePlayer player)]
Code (Lua):
PLUGIN.Title ="Better Chat Data Grabbing"
PLUGIN.Version = V(1,0,0)
PLUGIN.Description ="Data Grabbing"
PLUGIN.Author ="LaserHydra"

function PLUGIN:Init()
    command.AddChatCommand("grab", self.Object, "cmdGrab")
end

function PLUGIN:cmdGrab(player)
   local betterChat = plugins.Find("BetterChat")
   if betterName then
        data = betterChat:Call("GetPlayerFormatting", player)
        rust.SendChatMessage(player, "Your Prefix", data.Title)
        rust.SendChatMessage(player, "Your Prefix Color", data.TitleColor)
        rust.SendChatMessage(player, "Your Name Color", data.NameColor)
        rust.SendChatMessage(player, "Your Text Color", data.TextColor)
   end
end
Code (C#):
using System.Collections.Generic;
using System.Reflection;
using System;
using System.Data;
using Oxide.Core;

namespace Oxide.Plugins
{
    [Info("Better Chat Data Grabbing""LaserHydra""1.0.0", ResourceId = 0)]
    [Description("Data Grabbing")]
    class ChatnameDataGrab : HurtworldPlugin
    {
        [ChatCommand("grab")]
        void cmdGrab(BasePlayer player)
        {
           Plugin betterChat = null;
           betterChat = plugins.Find("BetterChat");
           if(betterChat!= null)
           {
                var data = betterChat.Call("GetPlayerFormatting", player);
                SendReply(player, "Your Prefix: " + data.Title);
                SendReply(player, "Your Prefix Color: " + data.TitleColor);
                SendReply(player, "Your Name Color: " + data.NameColor);
                SendReply(player, "Your Text Color: " + data.TextColor);
           }
        }
    }
}



Download


Download



Google Plus
← Postagem mais recente Postagem mais antiga → Página inicial

0 comentários:

Postar um comentário