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 Police Radio

Discussion in 'DarkRP Addon & Plugin Releases' started by LordiAnders, Mar 12, 2014.

  1. LordiAnders

    LordiAnders Active Member


    DarkRP 2.5.0+ only!

    Simple module that allows permitted jobs to commune with each other through voice chat, at any distance.

    To activate your radio you simply press your T key and it will toggle through being activated and not
    (Can be changed in Q > Options > Police Radio > Keybindings if you already have a bind placed on T *Changed binds only affects you, and not other players*)

    All jobs that has been added to the table inside the config file of the module (or jobs part of GAMEMODE.CivilProtection) will see a new thing on their HUD and hear every single cop who currently has their radio on!
    Even though CPs can hear you... That doesnt mean that people around you still cant

    When a player is a cop they will be greeted by this hud: (You can edit/remove the text and change the icon)

    Like pretty much every other DarkRP addon, there's a config file you can edit. (located in lua/darkrp_modules/police_radio/sh_p_radio_config.lua)
    Code (Lua):

    Police_Radio_Config["Allow_Teams"] = { --The script will normally use the jobs set by GAMEMODE.CivilProtection. If it doesnt work add the remaining team here
       ["cp"] = true,
       ["chief"] = true,
       ["mayor"] = true

    Police_Radio_Config["Require_Admin_Approval"] = false --Whether or not its required for admins to approve users first before they can use their radio

    Police_Radio_Config["CanHear_Default"] = true --The default state of whether or not people can hear one another over the radio

    Police_Radio_Config["HUD_Text_On"] = "Radio is on - All Police can hear your voicechat!" --The text that appears above the radio icon if enabled (Set to "" to disable text)
    Police_Radio_Config["HUD_Text_Off"] = "Radio is off (Press %s to enable)" --If the radio is disabled this text will appear (choose "" to disable text)
    Police_Radio_Config["HUD_Text_On_Receive"] = "Received audio is enabled (Press %s to disable)" --The text that appears above the radio icon if their received audio is disabled (Set to "" to disable text)
    Police_Radio_Config["HUD_Text_Off_Receive"] = "Received audio is disabled (Press %s to enable)" --If the received audio is disabled this text will appear (choose "" to disable text)

    Police_Radio_Config["HUD_Enable"] = true --Set to true to enable the HUD icons
    Police_Radio_Config["HUD_Use_Textures"] = false --If enabled. The HUD will use texture files (vtf) instead of a png file
    Police_Radio_Config["HUD_Texture_On"] = "vgui/lordi/darkrp/police_radio_on" --If enabled. The HUD will use texture files (vtf) instead of a png file
    Police_Radio_Config["HUD_Texture_Off"] = "vgui/lordi/darkrp/police_radio_off" --Texture that appears if the radio is currently off
    You can even restrict it to only allow it if the player has been approved by an admin first! (Incase some people abuse it at first... Mic spamming or not using it in a proper manner)

    Use /giveradio <Player's name> and /removeradio <Player's name>
    You must be admin to use those chatcommands


    Place the police_radio folder in the .zip inside your addons folder

    Feel free to leave any feedback!​

    radioicon.zip is an optional icon set that you have to configure manually, darkrp_police_radio.zip is the main addon

    Attached Files:

    Last edited: Jan 17, 2017
  2. nzkfc

    nzkfc Member


    First off thank you SOOOO much for making this, I was about to put a coder hire job up to make one! Do you have a paypal donation I can donate to you?

    I can't seem to get this going, my server and local gmod install have the darkrpmodification folder but it's not showing up.

    Are you sure it's suppose to be set in the garrysmod\addons\darkrpmodification-master\lua\darkrp_police_radio location?
  3. LordiAnders

    LordiAnders Active Member

    Ive heard some people saying it doesnt work...
    Yes, its supposed to be placed in the area i specified above. However, for some reason it doesnt seem to find the variables properly...
    Ill clean my Gmod and test this, and fix any bugs i may encounter

    EDIT: Seems to work just fine in a Listen server with the version i posted above... Ill look further into it
    EDIT2: Just downloaded a completly clean Dedicated Server and tested this... Worked aswell, no clue why it doesnt work then... Add me on steam and ill see if i can help you
    Last edited: Apr 27, 2014
  4. nzkfc

    nzkfc Member

    I will install it onto my dev dedi and see what happens.

    my steam:nzkfc
  5. [GG]Tense!

    [GG]Tense! Member

    I've got this working, but for some reason, it's not accepting jobs other than CP and CP_Chief. I'll do some retests to make sure it isn't me being stupid. Although I do have this placed simply into /addons and it's working~ish.

    Also, a workshop version would be advised, especially because it has custom textures.

    Like nzkfc said, Brillint to include this function into DarkRP and not as some PERP exclusive.
    Last edited: Apr 28, 2014
  6. LordiAnders

    LordiAnders Active Member

    Im sadly not gonna include this for the workshop... I tend not to upload anything if its strictly for DarkRP
    Which is why im posting this here instead
  7. nzkfc

    nzkfc Member

    I also have the same issue, put in TEAM_POLICE, TEAM_SWAT, TEAM_CHIEF and it won't detect.

    I have disabled the jobs in disableddefaults.lua too and made custom jobs (related?)

    Tense, just use fastdl for the materials, they are tiny.
  8. LordiAnders

    LordiAnders Active Member

    Let me see what i can do...

    EDIT: Ah yes, it seems to only work for default jobs at the moment... Ill have a look at it
    Last edited: Apr 28, 2014
  9. nzkfc

    nzkfc Member

    Sweet, im online for next 4 hours so chat on steam if you want me to test.
  10. LordiAnders

    LordiAnders Active Member

    Updated it with a temporary fix.
    Youll have to specify the job's chat command instead of team name, until i can find out why my previous method didnt work
  11. nzkfc

    nzkfc Member

    Hmmm not sure why this isn't work on my single player, my dedi is too full atm to take down to install and test on multiplayer :S
  12. [GG]Tense!

    [GG]Tense! Member

    Quick question, would it not be easier to just use whichever teams is classed as CP. I suck too hard at Lua to make a working concept.
  13. LordiAnders

    LordiAnders Active Member

    It would. But some people are apparantly a bit too confused to actually get it working...
    With all those communities ive seen... Every 1/3 server who had a custom police job, wouldnt be able to wanted people

    Its easier this way... But of course, it takes a second or two more

    EDIT: But since it doesnt make any sense though. Ill just go ahead and check if they are marked as CP or if they are in the table

    EDIT2: If my assumptions are correct... Were gonna run into the same issue we had as before.
    Either way... It will check if the player's team has been set by GAMEMODE.CivilProtection or the table inside the config
    Last edited: Apr 29, 2014
  14. [GG]Tense!

    [GG]Tense! Member

    If you can't set a job to be included in the police force, I would argue, you shouldn't be a server admin.
    Just add ",[TEAM_NAME] = true" to the right part in jobs.lua (in the DarkRPMod addon, don't want falco correcting me) and you're done.

    I'll give this a test, cheers for the update.
  15. nzkfc

    nzkfc Member

    Working? been playing around but can't get it to work :(
  16. [GG]Tense!

    [GG]Tense! Member

    In your jobs.lua - Where you have the line: command = "secret",
    You add the "secret" part to Police_Radio_Allow_Teams = {"cp","chief","swat","swatleader","mayor","secret"} bit.
    It's working for me, I've added it to an arbitrary job. I've also got mine inside the DarkRP modification, I doubt it makes that much of a difference, but hey.
  17. nzkfc

    nzkfc Member

    Hmm i'm using those command names e.g. "police" and "chief" and "swat" but nada :S
  18. [GG]Tense!

    [GG]Tense! Member

    Extract this zip into your darkrp_modules folder. Backup/Remove your current police radio, I hope this one helps.

    Attached Files:

  19. nzkfc

    nzkfc Member

    Yep that's working without the lua folder structure.

    BUT how do you get the icons working? I guess you have to put them in an addon folder and then relink to this folder via the code?
  20. nzkfc

    nzkfc Member

    Ahah worked it all out, got some nice custom icons working too!

    Question though, when you Alt+E to turn the radio off, I can still hear the police voice chat?

    I flew right outside the map too and turned it off but still heard voices, after awhile it does stop casting voices but not for a good 1-2 mins :S

Share This Page