Ulysses
Ulysses Stuff => Releases => Ulysses Release Archives => Topic started by: JamminR on November 28, 2008, 03:37:11 PM
-
Description:
Plays a sound to people who join your server
Current Version: v1
Features:
- Doesn't require ULib or ULX
- If more than one sound is in the table, picks a random one to play.
- Only plays the sound once they've obtained Steam authorization
- Won't follow them to every server, only servers that have this installed will play
Installation:
- Create file/Copy the following code into <your_server_path>gmod/lua/autorun/Ujoin_sounder.lua
--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.
-
Sweet. Good work.
-
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)
-
Wow! Thanks JamminR, going to try this out tonight, thanks again
Stockley5
-
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.
-
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?
-
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.
-
Yeah, I figured it out, and thanks for the clarification, it works beautifully.
-
Remember, your players will have to have the custom sound also to hear it. This script will not automatically send it to them.
-
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.
-
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.
-
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..
-
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.
-
Yeah i have not edited it, and the name is correct.
i haven't seen any errors.
-
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 ?
-
If exosounds is part of the gmod/sound directory, you'd want "/exosounds/sound.mp3",
-
I got it, thanks for the help ; )