BetterChat

Moved

Total Downloads: 26,139 - First Release: Apr 21, 2015 - Last Update: Jan 12, 2018

4.9898/5, 98 likes
  1. CHR

    CHR

    I got 0 use for chayhandler. ^^ Just waiting for u r update. I really don't know anything about permissions
     
  2. I just know very less. So I just needed to put up a thread into the forum on how to create a group ^^
    Actually I don't really understand how the whole thing is working. I didn't find anything explaining the system well.
    ----
    kk kinda understand it...
    You got groups which you can add.
    Then you got permissions added by plugins,
    which you can add to the group.
     
    Last edited by a moderator: Apr 22, 2015
  3. LaserHydra if u want help withe the permission system check the chathandler or my version or some other changed versions like m-Godmode
     
  4. yeah I wanna work with groups, you did it with directly adding the permission to a player in your version so imma take a look at some others.
     
  5. Its possible to make this plugin compatible to ChatHandler but its not really worth since the functionality can completely be done by ChatHandler itself so it yould be redundant to use both plugins.
    Im also not sure if @LaserHydra would have enough knowledge to do so.
     
  6. LaserHydra updated Name Colors with a new update entry:

    Update 1.1.0

     
    Last edited by a moderator: Apr 23, 2015
  7. LaserHydra updated Name Colors with a new update entry:

    standard config

     
  8. CHR

    CHR

    Code:
    [Oxide] 1:10 PM [Error] Failed to load plugin namecolors
    File: namecolors.lua Line: 112 invalid arguments to method call:
      at NLua.Lua.ThrowExceptionFromError (Int32 oldTop) [0x00000] in <filename unknown>:0
      at NLua.Lua.CallFunction (System.Object function, System.Object[] args, System.Type[] returnTypes) [0x00000] in <filename unknown>:0
      at NLua.Lua.CallFunction (System.Object function, System.Object[] args) [0x00000] in <filename unknown>:0
      at NLua.LuaFunction.Call (System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Lua.Plugins.LuaPlugin.Load () [0x00000] in <filename unknown>:0
      at Oxide.Lua.Plugins.LuaPluginLoader.Load (System.String directory, System.String name) [0x00000] in <filename unknown>:0
      at Oxide.Core.OxideMod.LoadPlugin (System.String name) [0x00000] in <filename unknown>:0
    
    :(
     
  9. Worked for me when I released.. im looking for it and try to fix it.
     
  10. CHR

    CHR

    Ok i just tested the Colors and they work now...

    But as a owner i write double Posts in 2 diffrent Colors. How to manage this <-- fixed with the auth false
    after disabled auth getting this error

    Code:
     [Error] Failed to run a 60.00 timer
    File: namecolors.lua Line: 122 invalid arguments to method call:
      at NLua.Lua.ThrowExceptionFromError (Int32 oldTop) [0x00000] in <filename unknown>:0
      at NLua.Lua.CallFunction (System.Object function, System.Object[] args, System.Type[] returnTypes) [0x00000] in <filename unknown>:0
      at NLua.LuaFunction.Call (System.Object[] args, System.Type[] returnTypes) [0x00000] in <filename unknown>:0
      at NLua.Method.LuaDelegate.CallFunction (System.Object[] args, System.Object[] inArgs, System.Int32[] outArgs) [0x00000] in <filename unknown>:0
      at LuaGeneratedClass1.CallFunction () [0x00000] in <filename unknown>:0
      at Oxide.Core.Libraries.Timer+TimerInstance.Update () [0x00000] in <filename unknown>:0 
     
    Last edited by a moderator: Apr 23, 2015
  11. Just keep getting this error as well, no matter how I set the config up and it won't work
    :
    Code:
    [Oxide] 9:42 AM [Error] Failed to call hook 'OnPlayerChat' on plugin 'Custom Nam
    e Colors'
    File: namecolors.lua Line: 135 argument number 2 is invalid:
      at NLua.Method.LuaMethodWrapper.Call (LuaState luaState) [0x00000] in <filenam
    [Oxide] 9:42 AM [Error] Failed to call hook 'OnPlayerChat' on plugin 'Custom Nam
    e Colors'
    File: namecolors.lua Line: 135 argument number 2 is invalid:
      at NLua.Method.LuaMethodWrapper.Call (LuaState luaState) [0x00000] in <filenam
     
  12. Im going to work on it as soon as I am At home. You can put the version 1.0.2 back onto you server until I fixed it ;) thank you for understanding. Also try Deleting your config and reloading the plugin. That may fix some issues.
    [DOUBLEPOST=1429803571][/DOUBLEPOST]
    And tell me please if deleting the Config changes anything at the error you get. Maybe you get another error or even none. Please respose.
    Im at home soon.

    State: Done!
     
    Last edited by a moderator: Apr 24, 2015
  13. LaserHydra updated Name Colors with a new update entry:

    permission system fixed

     
  14. Wont load
    [Oxide] 8:39 PM [Error] Failed to load plugin namecolors
    File: namecolors.lua Line: 112 invalid arguments to method call:
     
  15. Won't load for me either
     
  16. Wulf

    Wulf Community Admin

    Try the attached version.
    Code:
    PLUGIN.Title       = "Name Colors"
    PLUGIN.Description = "Change default chat name colors."
    PLUGIN.Author      = "LaserHydra"
    PLUGIN.Version     = V(1, 1, 2)
    PLUGIN.ResourceId  = 979function PLUGIN:Init()
        command.AddChatCommand("colors", self.Plugin, "ColorList")
        if self.Config.PermissionsEnabled == "true" then
            if not permission.GroupExists("vip") then permission.CreateGroup("vip", "V.I.P.", 0) end
            permission.RegisterPermission("color_mod", self.Plugin)
            permission.RegisterPermission("color_owner", self.Plugin)
            permission.RegisterPermission("color_player", self.Plugin)
            permission.RegisterPermission("color_vip", self.Plugin)
            permission.GrantGroupPermission("admin", "color_owner", self.Plugin)
            permission.GrantGroupPermission("moderator", "color_mod", self.Plugin)
            permission.GrantGroupPermission("player", "color_player", self.Plugin)
            permission.GrantGroupPermission("vip", "color_vip", self.Plugin)
        end
        self:LoadDefaultConfig()
    endfunction PLUGIN:LoadDefaultConfig()
        self.Config.AuthlevelColors = self.Config.AuthlevelColors or {}
        self.Config.AuthlevelColors.AuthLevel2 = self.Config.AuthlevelColors.AuthLevel2 or "orange"
        self.Config.AuthlevelColors.AuthLevel1 = self.Config.AuthlevelColors.AuthLevel1 or "yellow"
        self.Config.AuthlevelColors.AuthLevel0 = self.Config.AuthlevelColors.AuthLevel0 or "lime"
        self.Config.PermissionColors = self.Config.PermissionColors or {}
        self.Config.PermissionColors.player = self.Config.PermissionColors.player or "lime"
        self.Config.PermissionColors.moderator = self.Config.PermissionColors.moderator or "yellow"
        self.Config.PermissionColors.owner = self.Config.PermissionColors.owner or "orange"
        self.Config.PermissionColors.vip = self.Config.PermissionColors.vip or "aqua"
        self.Config.PermissionsEnabled = tostring(self.Config.PermissionsEnabled) or "false"
        self.Config.AuthlevelEnabled = nil -- Removed
        self.Config.ConsoleWarningDelaySeconds = nil -- Removed
        self:SaveConfig()
    endfunction PLUGIN:ColorList(player)
        local colorList = { "aqua", "black", "blue", "brown", "darkblue", "green", "grey", "lightblue", "lime",
            "magenta", "maroon", "navy", "olive", "orange", "purple", "red", "silver", "teal", "white", "yellow"
        }
        local colors = ""
        for k, color in pairs(colorList) do
            colors = colors .. "\n" .. "<color=" .. color .. ">" .. string.upper(color) .. "</color>"
        end
        rust.SendChatMessage(player, "Available name colors:" .. colors)
    endfunction PLUGIN:OnPlayerChat(arg)
        local player = arg.connection.player
        local userId = rust.UserIDFromPlayer(player)
        local message = arg:GetString(0, "text")    if self.Config.PermissionsEnabled == "true" then
            if permission.UserHasPermission(userId, "color_player") then
                rust.BroadcastChat("<color=" .. self.Config.PermissionColors.player .. ">" .. player.displayName .. "</color><color=white>", "</color>" .. message, userId)
            elseif permission.UserHasPermission(userId, "color_mod") then
                rust.BroadcastChat("<color=" .. self.Config.PermissionColors.moderator .. ">" .. player.displayName .. "</color><color=white>", "</color>" .. message, userId)
            elseif permission.UserHasPermission(userId, "color_owner") then
                rust.BroadcastChat("<color=" .. self.Config.PermissionColors.owner .. ">" .. player.displayName .. "</color><color=white>", "</color>" .. message, userId)
            elseif permission.UserHasPermission(userId, "color_vip") then
                rust.BroadcastChat("<color=" .. self.Config.PermissionColors.vip .. ">" .. player.displayName .. "</color><color=white>", "</color>" .. message, userId)
            end
        else
            if player.net.connection.authLevel == 0 then
                rust.BroadcastChat("<color=" .. self.Config.AuthlevelColors.AuthLevel0 .. ">" .. player.displayName .. "</color><color=white>", "</color>" .. message, userId)
            elseif player.net.connection.authLevel == 1 then
                rust.BroadcastChat("<color=" .. self.Config.AuthlevelColors.AuthLevel1 .. ">" .. player.displayName .. "</color><color=white>", "</color>" .. message, userId)
            elseif player.net.connection.authLevel == 2 then
                rust.BroadcastChat("<color=" .. self.Config.AuthlevelColors.AuthLevel2 .. ">" .. player.displayName .. "</color><color=white>", "</color>" .. message, userId)
            end
        end    return false
    end
     

    Attached Files:

  17. Thanks wulf!
     
  18. Thanks Wulf. Still don`t understand why it doesn't work as it worked perfectly for me before releasing.
     
  19. Wulf

    Wulf Community Admin

    The error is with your timer, which should really be inside a function. If you take a look at the version I posted, I did away with some of the redundancy, removed some a lot of unneeded checks, and cleaned up a few portions related to the config and /colors command. Also keep in mind that the HasConfig isn't needed anymore at the top, as Oxide checks for LoadDefaultConfig() now instead. There's probably a bit more that could be done, but those are a good start and should hopefully point out a few ways to make it more dynamic. :)