I'm trying to make it so when someone gets banned on the server it plays a .wav. But i'm having an error I used "siege/jihad.wav" as a test .wav and I got an error. Here's the error-
[ERROR] LuaCmd:1: unfinished string near '<eof>'
1. unknown - LuaCmd:0
And here's the code;
local meta = FindMetaTable "Player"
local song = "siege/jihad.wav"
meta._ban = meta._ban or meta.Ban
meta._kick = meta._kick or meta.Kick
local function playSound ( )
BroadcastLua ( [[sound.PlayURL ( "]] .. song .. [[, "", function () end )]] )
end
function meta:Ban ( minutes, kick )
playSound ( )
self._ban ( minutes, kick )
end
function meta:Kick ( reason )
playSound ( )
self._kick ( reason )
end
", function () end )]] ) This part is useless. Also, why are you running this through lua_run?
[QUOTE=code_gs;47465714]", function () end )]] ) This part is useless. Also, why are you running this through lua_run?[/QUOTE]
This better?
local meta = FindMetaTable "Player"
local song = "siege/jihad.wav"
meta._ban = meta._ban or meta.Ban
meta._kick = meta._kick or meta.Kick
local function playSound ( )
BroadcastLua ( [[sound.PlayURL ( "]] .. song .. [[, ")
end
function meta:Ban ( minutes, kick )
playSound ( )
self._ban ( minutes, kick )
end
function meta:Kick ( reason )
playSound ( )
self._kick ( reason )
end
[QUOTE=Senip;47465723]This better?
local meta = FindMetaTable "Player"
local song = "siege/jihad.wav"
meta._ban = meta._ban or meta.Ban
meta._kick = meta._kick or meta.Kick
local function playSound ( )
BroadcastLua ( [[sound.PlayURL ( "]] .. song .. [[, ")
end
function meta:Ban ( minutes, kick )
playSound ( )
self._ban ( minutes, kick )
end
function meta:Kick ( reason )
playSound ( )
self._kick ( reason )
end[/QUOTE]
Try this; also, use code tags.
[code]local meta = FindMetaTable( "Player" )
local song = "siege/jihad.wav"
meta._ban = meta._ban or meta.Ban
meta._kick = meta._kick or meta.Kick
local function playSound( )
BroadcastLua ( "sound.PlayURL ( '" .. song .. , "', '', function() end" )
end
function meta:Ban( minutes, kick )
playSound()
self._ban( minutes, kick )
end
function meta:Kick( reason )
playSound()
self._kick( reason )
end[/code]
Put it in lua/autorun/
[QUOTE=code_gs;47465779]Try this; also, use code tags.
[code]local meta = FindMetaTable( "Player" )
local song = "siege/jihad.wav"
meta._ban = meta._ban or meta.Ban
meta._kick = meta._kick or meta.Kick
local function playSound( )
BroadcastLua ( "sound.PlayURL ( '" .. song .. , "', '', function() end" )
end
function meta:Ban( minutes, kick )
playSound()
self._ban( minutes, kick )
end
function meta:Kick( reason )
playSound()
self._kick( reason )
end[/code]
Put it in lua/autorun/[/QUOTE]
I'll try it out, Thanks.
[editline]5th April 2015[/editline]
[QUOTE=Senip;47465808]I'll try it out, Thanks.[/QUOTE]
It never worked code. It doesn't give me any errors. It just doesn't do any thing. It's like it's not even there. Did I do it right?
Sorry, you need to Log In to post a reply to this thread.