I have wondered and looked everywhere but i dont know how some people have on there server when someone joins the game and it says it in the chat and also makes a sound so if anyone could put were to get that that would be really helpful.
Very basic, but you get the idea. Untested, not sure if it works. Change SoundPath to where the sound you want to play is located.
[code]
hook.Add("PlayerInitialSpawn", "PlayTheSounds", function(ply)
local SoundPath = "sounds/sofadsmk;l"
BroadcastLua('surface.PlaySound("'..SoundPath..'")')
for k,v in pairs(player.GetAll()) do
v:PrintMessage(HUD_PRINTTALK, "Player: "..ply:Nick().." has joined the server!")
end
end)
[/code]
Im a really big noob with this stuff were would i put this.
lua/autorun/server
Would i just put that code into its own lua file like serverplayersound.lua and put the code inside of that.
Yes, put the code in a file called whatever.lua and put whatever.lua into lua/autorun/server
That didnt work :(.
Anything in your console regarding a missing sound file, or any errors in the server's console?
No it just doesnt do anything its like i didnt even put it in there.
Gonna sound like tech support :v: did you restart the server/lua_openscript the script?
I just tried to type lua_openscript in the console but it didnt do anything either. Was i suppose to change something here sounds/sofadsmk.
...... yes
-snip-
[editline]19th August 2013[/editline]
[QUOTE=crazyscouter;41887553]Very basic, but you get the idea. Untested, not sure if it works. [U]Change SoundPath to where the sound you want to play is located.[/U]
[code]
hook.Add("PlayerInitialSpawn", "PlayTheSounds", function(ply)
local SoundPath = "sounds/sofadsmk;l"
BroadcastLua('surface.PlaySound("'..SoundPath..'")')
for k,v in pairs(player.GetAll()) do
v:PrintMessage(HUD_PRINTTALK, "Player: "..ply:Nick().." has joined the server!")
end
end)
[/code][/QUOTE]
Wow i need to start reading thanks it works now.
Alright, glad to hear. Feel free to mark the thread as solved in the top left.
Sorry, you need to Log In to post a reply to this thread.