1. Well, I just started with C# and tried something easy, rewriting my Easy Broadcast plugin.
    But, when I tried to use BroadcastChat or SendChatMessage and so on, it gave me an error, that it wasnt able to find that. (tried it with and without "rust.") For now I used the method Reneb used in AirdropControl:
    Code:
    using System.Collections.Generic;
    using System.Reflection;
    using System;
    using System.Data;
    using Oxide.Core;namespace Oxide.Plugins
    {
    [Info("Easy Broadcast", "LaserHydra", 2.0)]
    class EasyBroadcast : RustPlugin
    {
        [ChatCommand("bcast")]
        void cmdBroadcast(BasePlayer player, string cmd, string[] args)
        {
            string allArgs, message;
            allArgs = "";
            foreach(string arg in args)
                allArgs = allArgs + " " + arg;
            message = "<color=orange>BROADCAST</color>:" + allArgs;
            BroadcastToChat(message);
        }
        
        void BroadcastToChat(string msg)
        {
            ConsoleSystem.Broadcast("chat.add \"SERVER\" " + msg.QuoteSafe() + " 1.0", new object[0]);
        }
    }
    }
    
    Also I may be "using" stuff I don't really need. How do I know what I need for the stuff I want to do?
     
  2. Wulf

    Wulf Community Admin

  3. Okay, so that is the alternative for BroadcastChat, whats the alternative for the other stuff like SendChatMessage, UserIDFromPlayer and so on? Are there alternatives?
     
  4. Wulf

    Wulf Community Admin

    Take a look at the link, it shows them all. ;)

    You don't need UserIDFromPlayer, that's only needed for languages that can't handle int64. Just grab the SteamID directly from the player or connection.
     
  5. I see some of them are rewritten as CSharp code in the docs but only a few

    Thanks
     
  6. Wulf

    Wulf Community Admin

    The link I provided above shows both PrintToChat methods for sending chat messages.
     
  7. Another quick question. In the docs, its shown like that:
    [Info("Easy Broadcast", "Broadcast a message around the server", "LaserHydra", "2.0.0", ResourceID = 863)]
    But when I am using it like this, it tells me that it does not accept 4 args or more
     
  8. Wulf

    Wulf Community Admin

    I added it to the Docs wrong. Clarification from Mughisi:
    Code:
    [Info("Plugin", "Author", 1.0, ResourceId = 9999)]
    [Description("This is what my plugin does")]
     
  9. okay thanks. So you can only specify 1.0 and not 1.0.0 for example.
     
  10. Wulf

    Wulf Community Admin

    It can be int or string. 1.0 would be the same as using "1.0.0", and 0.1 would be the same as using "0.1.0", but you can't use 1.0.0 without quotes.
     
  11. Okay thanks!
    [DOUBLEPOST=1433285705][/DOUBLEPOST]... Im always getting this message:
    [Oxide] 12:59 AM [Debug] Plugin is already being loaded: EasyBroadcast
    Reloading or unloading the plugin doesn't help. Even deleteing it doesn't help
    [DOUBLEPOST=1433286732][/DOUBLEPOST]Also Im not getting the permissions to work....
    Code:
    using System.Collections.Generic;
    using System.Reflection;
    using System;
    using System.Data;
    using UnityEngine;
    using Oxide.Core;namespace Oxide.Plugins
    {
    [Info("Easy Broadcast", "LaserHydra", "2.0.0", ResourceId = 863)]
    [Description("Broadcast a message around the server")]
    class EasyBroadcast : RustPlugin
    {
        [ChatCommand("bcast")]
        void cmdBroadcast(BasePlayer player, string cmd, string[] args)
        {
            string uid;
            uid = Convert.ToString(player.userID);
            if (!permission.UserHasPermission(uid, "canBroadcast"))
            {
                SendReply(player, "<color=orange>BROADCAST</color>: You have no permission to use this command!");
                return;
            }
            if (args == null || args.Length < 1)
            {
                SendReply(player, "<color=orange>BROADCAST</color>: Syntax: /bcast [message]");
            }
            string allArgs, message;
            allArgs = "";
            foreach (string arg in args)
                allArgs = allArgs + " " + arg;
            PrintToChat("<color=orange>BROADCAST</color>:" + allArgs);
        }    }
    }
    
    I gave myself the permission "canBroadcast" also reconnected but it still says I got no permission
     
    Last edited by a moderator: Jun 3, 2015