Hey guys I want to create an addon so when a player gets arrested it plays a .mp3 file and only them can hear it. But when I check the hooks there are no hooks for arrest on darkrp2.5. Does anyone know how to make it so when a player gets arrested it plays a .mp3?
[QUOTE=FluffedWolf;43752547]there are no hooks for arrest on darkrp2.5[/QUOTE]
??
[url]http://wiki.darkrp.com/index.php/Hooks/server/playerarrested[/url]
K I have it done but when player is arrested it doesnt play the music
[CODE] local sound = 'badboys.mp3';
resource.AddFile("sound/"..sound);
hook.Add("playerArrested", "PlaySoundForArrested", function(crim, time, arrs)
ply:SendLua("surface.PlaySound( "..sound.." )");
)
end
[/CODE]
you put end after the )
put end before the closing bracket.
Needs to be surface.PlaySound("badboys.mp3") rather than surface.PlaySound(badboys.mp3).
You could either add in quotes and escape them or use different quotes:
[lua]
ply:SendLua("surface.PlaySound( \""..sound.."\" )")
-- or --
ply:SendLua('surface.PlaySound( "'..sound..'" )')
[/lua]
Sorry, you need to Log In to post a reply to this thread.