• Playing sounds of .wav & mp3 to the client.
    2 replies, posted
I created a Derma Menu, which sends a string to the server to ply.EmitSound(net.ReadString()). How the menu looks(Client Side!): [code]if ( CLIENT ) then //This is just one button out of the entire menu. //Menu function phm_1() local p1_base = vgui.Create( "DFrame") //Menu Frame p1_base:SetSize(176, 571) p1_base:SetPos(1728, 208) p1_base:SetTitle("Taunts") p1_base:SetVisible( true ) p1_base:SetDeleteOnClose(false) p1_base:ShowCloseButton(false) p1_base:SetDraggable(false) p1_base:SetKeyBoardInputEnabled(false) p1_base:SetMouseInputEnabled(true) p1_base:MakePopup(false) local b1 = vgui.Create("DButton", p1_base) //Button1 b1:SetSize(150, 33) b1:SetPos(12,35) b1:SetText("I am Cornholio!") b1.DoClick = function () // print("Sending taunt_b1 to Server") net.Start("send_p1_B1") net.WriteString("taunts/props/13.mp3")//I am Cornholio net.SendToServer() end end concommand.Add("taunt",phm_1)//Working on a normal way to bind this function to a key. end[/code] This is the Server side [code]if ( SERVER ) then//This is a tiny bit of the entire code. //Button1 util.AddNetworkString("send_p1_B1") net.Receive( "send_p1_B1", function( ply ) for _,ply in pairs(player.GetAll()) do ply:EmitSound(net.ReadString()) end end ) end[/code] Now the problem I am having is that .wav files play normally, when I use .mp3 file it sounds at high pitch and with distortion. Any tips on how to fix that .mp3 playing incorrectly? Also any tips on how to limit that a player can't play more than 1 sound until the initial one he played is done.
[URL="http://wiki.garrysmod.com/page/Global/SoundDuration"]SoundDuration[/URL], [URL="http://wiki.garrysmod.com/page/Global/CurTime"]Curtime[/URL] and a variable like ply.NextTaunt. Combine these three things in the right order, spice it up with some if and voíla, we got Palestine.
[QUOTE=Tomelyr;46205540][URL="http://wiki.garrysmod.com/page/Global/SoundDuration"]SoundDuration[/URL], [URL="http://wiki.garrysmod.com/page/Global/CurTime"]Curtime[/URL] and a variable like ply.NextTaunt. Combine these three things in the right order, spice it up with some if and voíla, we got Palestine.[/QUOTE] thanks for the idea, and please no racism towards Palestine or Israel!
Sorry, you need to Log In to post a reply to this thread.