Author Topic: Play Sound when an admin write a message.  (Read 1469 times)

0 Members and 1 Guest are viewing this topic.

Offline Telmoquares

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
Play Sound when an admin write a message.
« on: October 01, 2016, 03:38:28 PM »
Hey,

I want to play a sound when an admin write a message in the chat.
I have made a special command from this (copied from ulx tsay) xD

This is locaeted in the ulx/modules/sh/chat.lua
Code: [Select]
function ulx.lsay( calling_ply, message)
ULib.tsay( _, message )

end
local lsay = ulx.command( CATEGORY_NAME, "ulx lsay", ulx.lsay, "!l", true )
lsay:addParam{ type=ULib.cmds.StringArg, hint="message", ULib.cmds.takeRestOfLine }
lsay:defaultAccess( ULib.ACCESS_ADMIN )
lsay:help( "Sendet eine Nachricht mit Sound." )

My question is: How can i play a sound, when someone type a message in here?
I tried to put
Code: [Select]
sound.Play( "ambient/explosions/exp1.wav", Vector( 0, 0, 0 ) )found on a gmod wikia site, but its not working.

Thanks for the help!

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Re: Play Sound when an admin write a message.
« Reply #1 on: October 01, 2016, 04:00:43 PM »
The surface.PlaySound function may help you out.
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.