Ulysses

Ulysses Stuff => Releases => Ulysses Release Archives => Topic started by: JamminR on November 28, 2008, 03:37:11 PM

Title: UJoin Sounder
Post by: JamminR on November 28, 2008, 03:37:11 PM
Description:
Plays a sound to people who join your server

Current Version: v1

Features:

Installation:

Code: [Select]
--Quick dirty script for playing sounds to players who join your server.
--Edit to your hearts content. Rewrite it better. I'm not going major release with it.
--See below where to edit/add sounds. If you use CUSTOM ones, make sure your player has them (Forcedownload, etc)
--I used GCFScape for looking at what sounds are available. You may use Google.

local UJoin_Sound_Ver = "[UJoin Sound] - v1 loaded"

if SERVER then
   local UJoin_sounds = { }
--=========EDIT HERE===========================================================
-- *Note* There is a ~255 character limit to one full sound path. Place trailing comma.
   UJoin_sounds = {
        "/vo/canals/shanty_gotword.wav",
        "/vo/canals/boxcar_becareful_c.wav",
        "/vo/canals/gunboat_getin.wav",
        "/vo/canals/matt_goodluck.wav",
        "/vo/canals/matt_tearringuprr_b.wav",
        "/vo/coast/male01/youmadeit.wav",
                  }
--==========Don't edit below here (unless you know how) ========================

   MsgN( UJoin_Sound_Ver )
   AddCSLuaFile( "autorun/UJoin_Sounder.lua" )
   function Send_Some_Sound( ply, steamid )
            umsg.Start( "UJoin_sound", ply )
            umsg.String( UJoin_sounds[ math.random( 1, table.getn( UJoin_sounds ) ) ] )
            umsg.End()
   end
   hook.Add("PlayerAuthed", "SendASound", Send_Some_Sound)

else
    MsgN( UJoin_Sound_Ver )

    function UJoin_Play_sound( um )
             UJoin_snd = um:ReadString()
             util.PrecacheSound( UJoin_snd )
             surface.PlaySound( UJoin_snd )
    end
    usermessage.Hook("UJoin_sound", UJoin_Play_sound )
end


Very simple script at the request of a few I've seen in the threads here at Ulyssesmod.net
I've included a few fun sample sounds that I thought would work as greetings.
Other than GCFScape, I've found no comprehensive list of sound paths on the web. If you know/find one, please post the LINK here.

*NOTE* - This will not work in singleplayer or offline servers.
Title: Re: UJoin Sounder
Post by: Megiddo on November 30, 2008, 04:44:54 AM
Sweet. Good work.
Title: Re: UJoin Sounder
Post by: benbrooks on November 30, 2008, 05:27:27 AM
Very nice :)

I use custom sound entrances for certain people in my server, I use a modified version of Gjoin (http://www.garrysmod.org/downloads/?a=view&id=32427)
Title: Re: UJoin Sounder
Post by: stockley5 on December 07, 2008, 06:17:40 AM
Wow! Thanks JamminR, going to try this out tonight, thanks again

Stockley5
Title: Re: UJoin Sounder
Post by: tku92 on March 23, 2009, 07:11:02 PM
Do you know anyway to make this so it could possibly play the sound while the game is loading instead of after the player is in the server, i probably sound crazy but ive seen it before and i really wish i knew how to do it.
Title: Re: UJoin Sounder
Post by: Bulaba0 on April 16, 2009, 08:28:10 PM
What's the directory the files read from?

The file's directory is sound/example.wav


Would it read it...
As in "sound/example.wav"
or "/example.wav"
Which would work?
Title: Re: UJoin Sounder
Post by: JamminR on April 17, 2009, 08:16:04 PM
Source engine by default looks for all sound files, whether from the gcf package or actually in the directory, from /sound
So, /example.wav should work. Might not need the slash /

Do you know anyway to make this so it could possibly play the sound while the game is loading instead of after the player is in the server, i probably sound crazy but ive seen it before and i really wish i knew how to do it.
Not using Lua. Lua doesn't start until player joins server, or starts singleplayer.
There is a way to do it as part of a menu, but I don't know it. Try the Valve developer wiki.
Title: Re: UJoin Sounder
Post by: Bulaba0 on April 18, 2009, 07:39:20 AM
Yeah, I figured it out, and thanks for the clarification, it works beautifully.
Title: Re: UJoin Sounder
Post by: JamminR on April 18, 2009, 08:27:50 AM
Remember, your players will have to have the custom sound also to hear it. This script will not automatically send it to them.
Title: Re: UJoin Sounder
Post by: spike_wess on November 16, 2009, 01:20:07 PM
Could someone help me understand how I could make it so when certain players connect, it plays the sound for them only, say for example, I connect to the server. It would say spike has connected.


Title: Re: UJoin Sounder
Post by: JamminR on November 16, 2009, 01:52:02 PM
Know Lua or GLua?
Your request complicates the simplicty of the script.
As it stands now, it plays only to the player, not everyone else.
Title: Re: UJoin Sounder
Post by: spike_wess on November 16, 2009, 04:07:22 PM
yeah sorry i haven't slept for 2 days now.

I re read it and i know what it dose now, im having a problem with it though, its not playing a sound to people that connect, its in the lua/autorun folder..
Title: Re: UJoin Sounder
Post by: JamminR on November 16, 2009, 07:12:15 PM
Have you edited any of the sounds?
Do people connecting get any kind of message saying it's loaded?
Do they get any kind of usermessage error regarding UJoin?
Did you name it UJoin_Sounder.lua? That filename is required.
Title: Re: UJoin Sounder
Post by: spike_wess on November 16, 2009, 10:51:39 PM
Yeah i have not edited it, and the name is correct.

i haven't seen any errors.
Title: Re: UJoin Sounder
Post by: spike_wess on November 17, 2009, 09:34:19 AM
Sorry for the double post, but i figured it out, just was wondering now.

What would i put as the sound, since im using exosounds for players to download the sounds.

exosounds/sound.mp3 ?
Title: Re: UJoin Sounder
Post by: JamminR on November 17, 2009, 03:42:37 PM
If exosounds is part of the gmod/sound directory, you'd want "/exosounds/sound.mp3",
Title: Re: UJoin Sounder
Post by: spike_wess on November 18, 2009, 09:23:49 AM
I got it, thanks for the help ; )