So I got this error
[CODE][ERROR] addons/arrestmusic/lua/autorun/arrestmusic.lua:14: '<name>' expected near '"sound/badboys.mp3"'
1. unknown - addons/arrestmusic/lua/autorun/arrestmusic.lua:0[/CODE]
This is line 14
[CODE] net.Receive("arrestedSound", function( len )[/CODE]
I've tried to fix it but I dont know how
You have made a syntax error in your code.
We will need to see more code to help you.
[CODE] if SERVER then
util.AddNetworkString( "arrestedSound" )
local badboysSound = "sound/badboys.mp3"
resource.AddFile( badboysSound )
hook.Add( "playerArrested", "PlaySoundForArrested", function( crim, time, arrs )
net.Start( "arrestedSound" )
net.WriteString( badboysSound )
net.Send( crim )
end )
elseif CLIENT then
net.Receive( "arrestedSound", function( len )
local badboysSound = net.ReadString()
if not badboysSound then return end
surface.PlaySound( badboysSound )
end )
end[/CODE]
Provided code does not cause provided error.
You really shouldn't have to network the sound string -- just ping the client with no net data to play that sound since it's a constant string.
Apperently the error was that i should only have it as "badboys.mp3" not sound\badboys.mp3
Also how can I make it so the music stops once the player is unarrested?
Sorry, you need to Log In to post a reply to this thread.