Well, I currently have:
[code]
local sounds = {
"colzdragon/confetti.wav",
}
if CLIENT then
ErrorNoHalt("Adding Confetti Hooks...")
hook.Add( "Confetti", "confetti", function() RunConsoleCommand("confetti") end )
ErrorNoHalt(" Done!\n")
end
if not SERVER then return end
AddCSLuaFile( "autorun/confetti.lua" )
resource.AddFile( "sound/colzdragon/confetti.wav" )
concommand.Add( "confetti", function()
if not ply:IsAdmin() then return end
ply:EmitSound( sounds[1], 100, 100 )
end )
[/code]
I put this in my lua/autorun/
named as
confetti.lua
More Info:
It will download the sound and the file
But when I type confetti in console, nothing is outputted
Please help me out.
The concommand name was "confetti", not "testsound".
[QUOTE=Entoros;16993294]The concommand name was "confetti", not "testsound".[/QUOTE]
I typed in confetti....
My stupid word assuming brain...
(accidentally put soundtest.lua in the post)
just refresh the page.(I fixed the post)
Well first you should be getting the error
autorun/confetti.lua:16: attempt to index global 'ply' (a nil value)
because you have not defined ply. The following works but I think you can't emit sounds from yourself in singleplayer since time is frozen when you are in the console, so I had to bind it to a key to actually hear the sound. (I left out the rest because it's not related to playing the sound.)
[lua]
local sounds = {
"buttons/blip1.wav",
}
concommand.Add( "confetti", function(ply)
if not ply:IsAdmin() then return end
ply:EmitSound( sounds[1], 100, 100 )
end )[/lua]
Also when you want to make sure your code is running try adding a few test print() in it.
I hope this helped you. :)
[QUOTE=Crazy Quebec;16993473]Well first you should be getting the error
autorun/confetti.lua:16: attempt to index global 'ply' (a nil value)
because you have not defined ply. The following works but I think you can't emit sounds from yourself in singleplayer since time is frozen when you are in the console, so I had to bind it to a key to actually hear the sound. (I left out the rest because it's not related to playing the sound.)
[lua]
local sounds = {
"buttons/blip1.wav",
}
concommand.Add( "confetti", function(ply)
if not ply:IsAdmin() then return end
ply:EmitSound( sounds[1], 100, 100 )
end )[/lua]
Also when you want to make sure your code is running try adding a few test print() in it.
I hope this helped you. :)[/QUOTE]
Thank you so much! It worked! :)
Sorry, you need to Log In to post a reply to this thread.