Fallout New Vegas radio 3.0 - I need your help !

Hello to all!

I call on to you today because I need help lua there. I have at present more than 22 000 subscribers on one of my addons to prefer, which is this one: http://steamcommunity.com/sharedfiles/filedetails/?id=132829658&tscn=1456603701

However, I meet a major problem for me and my community … In the version 2.0 of my radio, the musics were played when the used player affects action by looking at this one, then at sounds to play it naturally in a precise order but without being able to see the title even not changing exactly a music or still settling the volume.

I then decided in my new version on 3.0, to create an interface for the users with different categories, possibility of settling the volume as well as of changing exactly the titles. I added to this secondary sound effects.

You will tell me then: “yeah it is great then! It is what the problem?”

The major problem is that in the version 2.0 sounds go out directly of the entity itself and the players too much far from the radio heard then no sound, which is realistic. When a player throw a music people around the radio hear the musics which was to play, yet since 3.0 there are no more the features …

I show you then an example of my cl_init.lua what could can be you give an idea to help me, thank you again to you for the answers which shall bring to you to me, good or bad.

Here is the button which activates a precise music:


local DermaButton2 = vgui.Create( "DButton", panel1 )
	DermaButton2:SetText( "I don't want to set the world on fire" )
	DermaButton2:SetFont( "Next2" )
	DermaButton2:SetColor( Color ( 0, 161, 255, 255 ))
	DermaButton2:SetSize( 10 )
	DermaButton2:SetPos( 5, 25 )
	DermaButton2:SetSize( 565, 20 )
	DermaButton2.DoClick = function ()
		RunConsoleCommand( "stopsound" )
		timer.Simple( 0.1, function () EmitSound( Sound( "sound/fallout_3/02.i_don't_want_to_set_the_world_on_fire.mp3" ), Entity( 1 ):GetPos(), 1, CHAN_AUTO, 1, 75, 0, 100 ) end )
		timer.Simple( 0.1, function () EmitSound( Sound( "sound/Radio_select.wav" ), Entity ( 1 ):GetPos(), 1, CHAN_AUTO, 1, 75, 0, 100 ) end )
		Entity( 1 ):PrintMessage ( HUD_PRINTTALK, "Music started" )

Thanks to you and do not hesitate to ask me for additional information to understand my problems!:slight_smile:

https://wiki.garrysmod.com/page/Entity/EmitSound I found this for you.

Wait, so what’s the problem? Your description is really confusing

Do you mean other people can’t hear the radio at all or something?

[editline]28th February 2016[/editline]

Also, why are you using Entity( 1 ) as the position of your radio? If there’s more than 1 radio or another entity is Entity( 1 ) then this script wouldn’t work at all

Thank you #AustinH but I already know it and he did not was very helpful after try… :confused:

Hi #MPan1 Indeed, once a title run no one hears it except that the player concerned to selected music. Radio is an entity that players can bring up, the problem is that there may be several radio on the same server. The big problem settle are:

  • The radio has no radius, which mean that the player hears music anywhere on the map.
  • When a player throws a music only he can hear except I’d like other people around the radio within a some radius can also hear it.

I am sorry for my English, I have trouble expressing myself, it’s just made me to be French.


You’re calling EmitSound function on clientside and not on serverside that’s why only the player concerned is able to hear the radio, so what you have to do is call the function on serverside. Use net library to do that and I recommand to use Entity:EmitSound function instead of EmitSound()

Good luck with your project.

Hi and thank you #TheMafieuur

I’ll replace the EmitSound () function by Entity: EmitSound. Could you tell me more about the “net library” function, I go on Garry’s mod wiki but I’m confused …

Thank you very much in any case, this certainly will solve already the client side of the problem. In terms of the radius, you have an idea to help me ?

It sends data from the client to server.
Check it out here:

Also take a look at this: http://wiki.garrysmod.com/page/Net_Library_Usage

Edit: Oh, it’s already on that page, my bad!

Thanks you #AustinH and thanks you to #smithy285

Okay I will fend me with it then. For the problem of the radius you have an idea ? To ensure that its actually kind of entity and that people who are too far from the entity no longer hear the music ?

Thank you all for his answers ! :slight_smile:

For the radius use Entity:EmitSound function where you can set the soundlevel and the volume. Use it serverside to make people able to hear it.

Oh thank you #TheMafieuur

You are incredible ! Thank you all for your solutions and your speed. I’ll try it soon and I will keep you informed of the results !

Again thank you to all of you, I’ll let you know ! <3 :smiley: