1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Sign up for news, events and more!

    You're currently visiting the official DarkRP Forums as a guest. Sign up now to participate in our community and we'll let you know when we have news.

Release Simple Radio/Comms command for DarkRP

Discussion in 'DarkRP Addon & Plugin Releases' started by [TXG] Church, Jul 23, 2016.

  1. [TXG] Church

    [TXG] Church New Member

    Hey everyone, this is my first attempt at creating a Gmod script of any kind.

    Basically its a re-do of the /advert command but instead of /advert its /radio, /comms, or /coms that puts out text in the format of [Radio] *yourname* : *your message in bright blue*

    This is a simple script I made because I needed it for a MilitaryRP server and thought maybe others could use it too.

    Warning : If you use the default DarkRP /radio command, this will override that. You can fix that by simply removing the line "DarkRP.defineChatCommand("radio", Radio, 1.5)" completely from the script.

    To install it put it in the following directory of your server :
    addons/darkrpmodification-master/lua/darkrp_modules/*make a new folder* and name the file sv_radio.lua then place it in the folder.

    Hope you all enjoy and it proves useful for someone else!

    Here's the script :

    Code (Text):

    function Radio(ply, args)
        if args == "" then
            DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("invalid_x", "argument", ""))
            return ""
        end
        local DoSay = function(text)
            if text == "" then
                DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("invalid_x", "argument", ""))
                return
            end
            for k,v in pairs(player.GetAll()) do
                local col = team.GetColor(ply:Team())
                DarkRP.talkToPerson(v, col, "[Radio] " .. ply:Nick(), Color(0, 200, 255, 255), text, ply)
            end
        end
        return args, DoSay
    end
    DarkRP.defineChatCommand("radio", Radio, 1.5)
    DarkRP.defineChatCommand("comms", Radio, 1.5)
    DarkRP.defineChatCommand("coms", Radio, 1.5)
     
    Last edited: Jul 23, 2016
  2. Can you set it so only certain teams can use the radio/comms? What I'm thinking is it could be an alternative to group chats for Gov Officials. Basically what I'm saying is instead of creating a group chat for Gov Officials, you create it through this radio addon. That way instead of "(group) John Smith: Yada yada yada", it would be "[Radio] John Smith: Unit 107 to base, copy?". It would look so much cooler.

    And just if it wasn't clear I wouldn't want citizen jobs to see the radio.
     
  3. cj2tech

    cj2tech Member

    What's wrong with /radio already built into dark rp?
     
  4. [TXG] Church

    [TXG] Church New Member

    The server owner that I originally made this for didn't like the /radio in DarkRP for whatever reason (I like it fine) but instead wanted it overriden and /radio to put out text like the old /advert but say [Radio] *name* : *text*
     
  5. Anybody know why mine just wont work its in the correct directory
     

Share This Page