[Help] how to disable radio for everyone

Hi there ive been searching on how to disable the radio for the whole server and havent find anything related .
Im making a custom survivalist server and having the radio enable is a no no . Anyone have any idea of how to disable it ? I know little of coding*

2 Likes

Look into the fivem natives. There are a few options. You can even go about hiding the radio hud

Hey Thanks, but i know little or nothing about coding i can only copypaste or modify little things im still learning. So what would i do with that? Like do I have to create a script to add that? Or is somewhere i need to change to hide instead of show the hud of the radio stations ?

First you would need to set the radio station to off when a player is getting into the car then hide the frame in a loop so they can’t turn it on. I’ll provide an example later if I get around to it.

thanks i appreciate it to set the radio station off where should i find that?

I have found the solution. I might release the script since its nowhere to be found

for those who wanna disable radio with C#

            if (IsPedInAnyVehicle(PlayerPedId(), true))
            {
                HideHudComponentThisFrame(16);
                SetUserRadioControlEnabled(false);
                SetVehRadioStation(GetVehiclePedIsIn(PlayerPedId(),true), "OFF");
            }
3 Likes

where can i put this code what folder?..

how do u mean ?

the code that you posted where do i put it?.. what folder

You can simply place it in any client.lua that you have! :slight_smile:

uhm i guess u replied to wrong guy… as that code i shared is not for lua but c# so…
This what u suggest

is not gonna work for c#… :wink:

Huh? The post you posted, this:

if (IsPedInAnyVehicle(PlayerPedId(), true))
            {
                HideHudComponentThisFrame(16);
                SetUserRadioControlEnabled(false);
                SetVehRadioStation(GetVehiclePedIsIn(PlayerPedId(),true), "OFF");
            }

That 100% can be used in an client.lua, as I literally have it built into my client.lua. Lol. This is my snippet from lua.

while hidePlayers do
				DisableAllControlActions(0)
				for i=1, #keys do
					EnableControlAction(0, keys[i], true)
				end
				SetEntityVisible(PlayerPedId(), 0, 0)
				SetLocalPlayerVisibleLocally(1)
				SetPlayerInvincible(PlayerId(), 1)
				ThefeedHideThisFrame()
				HideHudComponentThisFrame(16)
                SetUserRadioControlEnabled(false);
                SetVehRadioStation(GetVehiclePedIsIn(PlayerPedId(),true), "OFF");
				HideHudComponentThisFrame(12)
				HideHudComponentThisFrame(21)
				HideHudAndRadarThisFrame()
				DisplayRadar(false)
				SetRadarBigmapEnabled(false, false)
				Citizen.Wait(3)
				local vehicles = GetGamePool('CVehicle')
				for i=1, #vehicles do
					SetEntityLocallyInvisible(vehicles[i])
				end
			end

if IsPedInAnyVehicle(PlayerPedId(), true) then
HideHudComponentThisFrame(16);
SetUserRadioControlEnabled(false);
SetVehRadioStation(GetVehiclePedIsIn(PlayerPedId(),true), “OFF”);
end

I changed it to this
我改成了这样

CreateThread(function()
while true do
Wait(0)

    local ped = PlayerPedId()

    if IsPedInAnyVehicle(ped, false) then
        local vehicle = GetVehiclePedIsIn(ped, false)

        -- Hard disable radio
        SetVehicleRadioEnabled(vehicle, false)
        SetVehRadioStation(vehicle, "OFF")
        SetRadioToStationName("OFF")

        -- Block all radio controls
        DisableControlAction(0, 81, true) -- Next Radio Station
        DisableControlAction(0, 82, true) -- Previous Radio Station
        DisableControlAction(0, 83, true) -- Radio Wheel
    end
end

end)

– Extra safety on spawn
AddEventHandler(‘playerSpawned’, function()
SetRadioToStationName(“OFF”)
end)

RegisterNetEvent('QBCore:Client:EnteredVehicle', function(data)
    SetVehRadioStation(data.vehicle, 'OFF')
end)