Search the Community
Showing results for tags 'radio'.
-
Version 1.0.1
613 downloads
Internet radio over colshapes using CEF. Scope of application: custom clubs, interiors. Default location is the Galileo Observatory (behind the monument). Default radio station - Wacken Radio (DE). Installation: I. Put server files to: server-files\packages\yourGameMode II. Add require('./rStreamColshapes'); to your server's index.js III. Put client files to: client_packages then edit your client's index.js and add require('./rStream'); To change radio stream url, edit index.html here: client_packages\cef\rStream\index.html GitHub -
I've been looking for a way to disable the radio as smoothly as possible (so no sound cut-off or infinite loops anywhere), this is what Daniel Hartung (from Discord) and I came up with: Client-side (trigger this in your server-side playerEnterVehicle event, has to be triggered server-side cause the client-side variant triggers too early before the player is in the vehicle) const localPlayer = mp.players.local; let radioKillTimer = null; mp.game.audio.setUserRadioControlEnabled(false); mp.events.add("disableVehicleRadio", () => { if(radioKillTimer == null){ radioKillTimer = setInterval(() => { if(localPlayer.isSittingInAnyVehicle()){ mp.game.audio.setRadioToStationName("OFF"); clearInterval(radioKillTimer); radioKillTimer = null; return; } }, 100); } }); The custom client event checks whether a timer to kill the radio already exists, if not it creates one (interval 100ms) that runs until the local player entity reports the fact that they're sitting in a vehicle. That's when the radio is set to off and the timer is killed and it's ensured that the radio station is only set once (preventing jittery sound).
