Voice Channels - An easy, modular way to create private and public voice channels.

[release]
About
Voice Channels is something I whipped up earlier, after thinking of it. It is a library and set of console commands that you can use to create Voice Channels, private and public. When I Say Voice Channel, I mean a channels where users can Join, leave and tune into to hear specific players voices. For those who can’t handle just having Global chat and Team chat, this is an easy alternative to make more.
[/release]

[release]
It has no UI( Menu’s )

Sorry, I really don’t like making menus. There really isn’t a need for them, if you feel the need for one, go ahead and make one, It would be very easy.
[/release]

[release]

Library Functions

[lua]

–[[
Callback filter is a function that needs to return true or false, if you don’t supply it, it will automatically be true. It has one argument passed to it, and that’s the player that is trying to join the Channel.
–]]

VoiceChannels.Create( boolprivate, stringname, stringpassword, callbackfilter );

–[[
See if a channel is active.
–]]

VoiceChannels.IsChannelActive( stringChannel )

–[[
Manually add a player to a channel.
–]]

VoiceChannels.AddPlayer( stringChannel, player )

–[[
See if a player is in a channel
–]]

VoiceChannels.PlayerIsInChannel( stringChannel, player )

–[[
See if two players are in the same channel
–]]

VoiceChannels.PlayerSharesChannelWithPlayer( stringChannel, playerA, playerB )

–[[
Exit a player from a channel properly.
–]]

VoiceChannels.ExitPlayer(player, stringChannel )

–[[
Get the indexes of all active Voice Channels
–]]

VoiceChannels.GetActiveList()

–[[
Make a player select a voice channel. Player needs to be a member of this voice channel.
–]]

VoiceChannels.PlayerSelectVoiceChannel( player, stringChannel );

–[[
Check a channels password with an input.
–]]

VoiceChannels.CheckPassword( stringChannel, stringPasswordInput );

–[[
Get whether a channel is locked/private or public.
–]]

VoiceChannels.GetLocked( stringChannel )

[/lua]

** ‘Hook’ functions you can override **

[lua]
–[[
Called after the player has joined a channel.
–]]

VoiceChannels.PostPlayerJoinChannel( player, stringChannel )

–[[
Called after the player has left a channel.
–]]

VoiceChannels.PostPlayerLeaveChannel( player, stringChannel )

[/lua]

[/release]

[release]
Console Commands



VoiceChannels_Create <name> <boolPrivate> <password>

VoiceChannels_Join <name> <password>

VoiceChannels_Leave <name>

VoiceChannels_Select <name>

VoiceChannels_Delete <name> ( Admin & Super Admin Only )


[/release]

[release]
Script

Instructions
The entire script is serverside, paste the content from that pastebin into a Lua file named ‘VoiceChannels.lua’ or something, and then put it in garrysmod/garrysmod/lua/autorun/server/
[/release]

Very nice, I can’t wait to test it on my server if I ever get it working. I’ll tell ya how your addon works if I ever test it!

Nice, I tried to make this once but failed … horribly. It’s nice to see someone picking this idea up again :wink:

Thanks :slight_smile:

We have something similar to this on our servers.
Very nice feature to have, great script.

Updated the OP’s pastebin link, there was a silly typo.

And thanks

http://puu.sh/fZuF

You inspired me! Just need to add a scroll bar.

That’s pretty hot.

Very cool.

What next chat channels. This is honestly a great idea. And that screenshot BlackAwps just starts reminding me of a VOIP.

Do you want chat channels?

[Lua]
– Server

hook.Add( “PlayerSay”, “VoiceChannelsCHVC”, function( Player)
for k,v in pairs( player.GetAll() )
if VoiceChannels.PlayerSharesChannelWithPlayer( v.TunedVoiceChannel or “” , v, Player ) then

		-- Networking here
		-- Cba to do it, because I don't have Gmod13 and I don't know how to use the Net Lib.

	end

end

return false

end)

– Client

– Networking here, then some magic with chat.Add or whatever

[/Lua]

That’s the theory, just replace comments with networking and chat.Add functions.

And there you have it.

-snip-

I really like this idea.

It’s funny because you have a -snip- and the post has never been edited?

After you’ve created your post, you have a free-edit time (about 1 minute).