1. 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. Pab14567

    Pab14567 Well-Known Member

    the config file
     
  2. FletcherTime

    FletcherTime Member

    Code (Text):

    Police_Radio_Allow_Teams = {"cp","chief","mayor","swat","detect", "bhunter"} --The script will normally use the jobs set by GAMEMODE.CivilProtection. If it doesnt work add the remaining team here
    --^^ These are CHAT COMMANDS!! Not teamnames

    Police_Radio_Require_Admin_Approval = false --Whether or not its required for admins to approve users first before they can use their radio

    Police_Radio_Only_If_On = false --Only transmit voice if the receiving player has their own radio on

    if CLIENT then
    Police_Radio_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_HUD_Text_Off = "Radio is off (%s + %s to enable it)" --If the radio is disabled this text will appear (choose "" to disable text)
    Police_Radio_HUD_Vehicle_Text_Off = "Radio is off (%s to enable it)" --If the radio is disabled and the player is in a vehicle this text will appear (choose "" to disable text)
    --%s will be replaced with the key bound by the player that needs to be pressed
    end

    Police_Radio_HUD_Enable = true --Set to true to enable the HUD icons
    Police_Radio_HUD_Use_Textures = false --If enabled. The HUD will use texture files (vtf) instead of a png file
    Police_Radio_HUD_Texture_On = "vgui/lordi/darkrp/police_radio_on" --If you want to... You can set your own custom texture for the radio icon
    Police_Radio_HUD_Texture_Off = "vgui/lordi/darkrp/police_radio_off" --Texture that appears if the radio is currently off
    --******* ^^ These settings will affect your download! *******

    --When selecting a texture, MAKE SURE THE EXTENSION ISNT INCLUDED (.png/.vmt)
    --The script does this by itself
     
    Would I change the "Police_Radio_HUD_Text_Off" string? Wouldn't that just change the the text and not the actual keypress?
     
  3. Pab14567

    Pab14567 Well-Known Member

    waaaat. @LordiAnders you didn't a option to change key of which is can be turned off and on ? I thought you did

    @FletcherTime just try to see if you can change the opening key for the other addon
     
  4. LordiAnders

    LordiAnders Active Member

    I suppose I'll have a look at implementing it later today, seeing as it's been one of the most requested features.
    It will probably function identically to surrender's shout key, so server owners won't enforce it on a key people keep binds on.

    EDIT: Also, sorry about the late response! I forgot to view the forum while logged in, so I didn't receive any e-mails about people posting here.
    --- Double Post Merged, Oct 15, 2016 ---
    Took a little longer than expected, thanks to me forgetting... Oh well.
    • Fixed an issue where the F1 help menu entries didn't turn green, because I forgot to change the variable to the new format.
    • Changed the order for job detection (Previously: jobtable or isCP, is now: isCP or jobtable, not really important though)
    • Replaced a few ! with . in the chat messages for the /giveradio and /removeradio commands.
    • Changed SetPData("Police_Radio_Allow",false) to RemovePData("Police_Radio_Allow") to clear the data entirely.
    • SendLua has been changed to networked messaging instead.
    • Replaced a few LocalPlayer function calls with a cached variable instead.
    • Removed the "automatic download" functionality, as it didn't even seem to work. You need to add the textures to download manually.
    • Players can now customize their key to toggle between the radio's states. This replaces ALT+E with T, and can be changed in Q > Options > Police Radio > Keybindings
    • The HUD_Vehicle_Text_Off variable is no longer used, as it's no longer neccesary now that the key can be changed to something that doesn't interfere with vehicle functionality.
    The way the addon is to be installed has also changed. It's to be installed in the addons folder now, instead of darkrpmodification.
     
    Last edited: Oct 15, 2016
  5. Mike Lee

    Mike Lee New Member

    Very Big thx.
     
  6. LordiAnders

    LordiAnders Active Member

    God damnit.... I forgot to change the name of the hook when copying the code over from the surrender code.
    If you've recently downloaded the update, redownload it again, or you may experience issues with surrender's shout key when run along this.
     
  7. atmiz47

    atmiz47 New Member

    Yo this error pops up in console sometimes even though i dont touch the file, sometimes theres no error sometimes there is?

    [ERROR]
    1. unknown - [C]:-1

    Error in hook Think: addons/police_radio/lua/darkrp_modules/police_radio/cl_p_radio.lua:12: attempt to index a nil value
    stack traceback:
    addons/police_radio/lua/darkrp_modules/police_radio/cl_p_radio.lua:12: in function 'fn'
    addons/ulib-master/lua/ulib/shared/hook.lua:109: in function <addons/ulib-master/lua/ulib/shared/hook.lua:92>
    [C]: in function '‌‎‬‪‭'
     
  8. |W|affles|G|amin|G|

    |W|affles|G|amin|G| New Member

    Hi, just wondering why I get spammed with this and how to fix it. This happens when I spawn into the server, but does stop when I change jobs.

    lue
    1. v - addons/darkrpmodification/lua/darkrp_modules/police_radio/cl_p_radio.lua:12
    2. unknown - lua/includes/modules/hook.lua:84


    [ERROR] addons/darkrpmodification/lua/darkrp_modules/police_radio/cl_p_radio.lua:12: attempt to index a nil value
    1. v - addons/darkrpmodification/lua/darkrp_modules/police_radio/cl_p_radio.lua:12
    2. unknown - lua/includes/modules/hook.lua:84


    [ERROR] addons/darkrpmodification/lua/darkrp_modules/police_radio/cl_p_radio.lua:12: attempt to index a nil value
    1. v - addons/darkrpmodification/lua/darkrp_modules/police_radio/cl_p_radio.lua:12
    2. unknown - lua/includes/modules/hook.lua:84


    [ERROR] addons/darkrpmodification/lua/darkrp_modules/police_radio/cl_p_radio.lua:12: attempt to index a nil value
    1. v - addons/darkrpmodification/lua/darkrp_modules/police_radio/cl_p_radio.lua:12
    2. unknown - lua/includes/modules/hook.lua:84


    [ERROR] addons/darkrpmodification/lua/darkrp_modules/police_radio/cl_p_radio.lua:12: attempt to index a nil value
    1. v - addons/darkrpmodification/lua/darkrp_modules/police_radio/cl_p_radio.lua:12
    2. unknown - lua/includes/modules/hook.lua:84


    [ERROR] addons/darkrpmodification/lua/darkrp_modules/police_radio/cl_p_radio.lua:12: attempt to index a nil value
    1. v - addons/darkrpmodification/lua/darkrp_modules/police_radio/cl_p_radio.lua:12
    2. unknown - lua/includes/modules/hook.lua:84


    [ERROR] addons/darkrpmodification/lua/darkrp_modules/police_radio/cl_p_radio.lua:12: attempt to index a nil value
    1. v - addons/darkrpmodification/lua/darkrp_modules/police_radio/cl_p_radio.lua:12
    2. unknown - lua/includes/modules/hook.lua:84


    [ERROR] addons/darkrpmodification/lua/darkrp_modules/police_radio/cl_p_radio.lua:12: attempt to index a nil value
    1. v - addons/darkrpmodification/lua/darkrp_modules/police_radio/cl_p_radio.lua:12
    2. unknown - lua/includes/modules/hook.lua:84


    [ERROR] addons/darkrpmodification/lua/darkrp_modules/police_radio/cl_p_radio.lua:12: attempt to index a nil value
    1. v - addons/darkrpmodification/lua/darkrp_modules/police_radio/cl_p_radio.lua:12
    2. unknown - lua/includes/modules/hook.lua:84


    [ERROR] addons/darkrpmodification/lua/darkrp_modules/police_radio/cl_p_radio.lua:12: attempt to index a nil value
    1. v - addons/darkrpmodification/lua/darkrp_modules/police_radio/cl_p_radio.lua:12
    2. unknown - lua/includes/modules/hook.lua:84


    [ERROR] addons/darkrpmodification/lua/darkrp_modules/police_radio/cl_p_radio.lua:12: attempt to index a nil value
    1. v - addons/darkrpmodification/lua/darkrp_modules/police_radio/cl_p_radio.lua:12
    2. unknown - lua/includes/modules/hook.lua:84


    [ERROR] addons/darkrpmodification/lua/darkrp_modules/police_radio/cl_p_radio.lua:12: attempt to index a nil value
    1. v - addons/darkrpmodification/lua/darkrp_modules/police_radio/cl_p_radio.lua:12
    2. unknown - lua/includes/modules/hook.lua:84
     
  9. Sir Klutch

    Sir Klutch Member


    Upload your cl_p_radio.lua and paste it here.
     
  10. |W|affles|G|amin|G|

    |W|affles|G|amin|G| New Member

    --- Double Post Merged, Oct 30, 2016 ---
    I haven't made any changes to that file, or at least yet but I basically had this issue after downloading this which was an updated version from my other one.
     

    Attached Files:

  11. Sir Klutch

    Sir Klutch Member

    On line 7
    Code (Text):
     local lply
    change to
    Code (Text):
    local lply = LocalPlayer()
     
  12. LordiAnders

    LordiAnders Active Member

    That won't help. It's because the job table isn't available to the player by the time they're loading. I need to add a check to see if the job table is valid in the Think hook, just as I have in the HUDPaint hook.
     
  13. Musclekid

    Musclekid New Member

    Hi, I was wondering if anybody knows a way that someone can edit the radio to make it so players can turn their radio off as in they won't hear people speaking for a short amount of time because being staff on a server and having to stay in the police job gets annoying when nobody wants to listen when radio silence is called. I would appreciate if I could get feedback because I would be willing to pay for the modification that allows a toggle of sound for the radio.
     
  14. LordiAnders

    LordiAnders Active Member

    Actually, you're in luck.

    • Possible fix for errors appearing when joining the game.
    • Added the ability for people to toggle received audio on or off, default key is H (Can be changed by players just like the normal toggle button)
    • Added "HUD_Text_On_Receive" and "HUD_Text_Off_Receive" as text shown above the normal text.
    • Removed the "Only_If_On" variable and replaced it with "CanHear_Default", which decides whether or not the receive state is set to on or off by default.

    I'm leaving the old version for download here in the event that someone prefers the old method of toggling hearing, I'm not updating it though.
     

    Attached Files:

  15. Musclekid

    Musclekid New Member

    If we paid extra could you add the feature to the new update so it's a private file for our server?
     
  16. Very nice addon! I have it on my server
     
  17. Sir Snifflebutt

    Sir Snifflebutt New Member

    where do you put the icon
     
  18. You dont need the icon. just put the other file in the addons folder and you can change the jobs in the files
     

Share This Page