• Custom Talking Sounds
    6 replies, posted
Hello Everyone! Is there a possible way to players on darkrp to say something like [B]Shutup[/B] and it will play a sound saying shutup or get noscoped just something like that, they have to say the exact words tho like shutup or Shutup. I'm pretty sure this has to be done with a certain table of some sort if its possible. Since this is for darkrp I want to be be enabled only for a certain TEAM_ or Playermodel - People also need to be able to hear not everyone from point A to point B which is 800M away but just in its normal raidius
this has been discussed with CP sounds some pages back, please use the search function.
How would I use these lua strings/code to create a working script, Only allowing certain TEAM_ to be able to use the sounds assigned. I am guessing after the code I would but it in garrysmod/lua/autorun/server
[QUOTE=skatehawk11;49274639]First, if you are using custom sounds you need to make sure they are added to your server resources and downloaded to the client. Then you can create a script with [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/PlayerSay]GM/PlayerSay[/url] hook and then network it using the net library and find the appropiate players within the distance of the player then play a sound using [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/surface/PlaySound]surface.PlaySound[/url][/QUOTE] It would be better to use [URL="https://wiki.garrysmod.com/page/Entity/EmitSound"]Entity:EmitSound()[/URL] since it can be ran on the server and makes the sound come from the player so only people around that player would hear the words shutup. To check for a certain team you would simply need to use [URL="http://wiki.garrysmod.com/page/Player/Team"]Player:Team()[/URL] to get the team of the player and then check it against the teams you want to be able to play the sound. Similarly if you want it to be based on models just use [URL="https://wiki.garrysmod.com/page/Entity/GetModel"]Entity:GetModel()[/URL] to retrieve the model of the player and check it against the models that should produce the sound.
The script talked about a few pages back is serverside, please read about the basics of gLua or hire someone to fulfill your needs.
Is someone able to talk me through on how to do this? I am not a very good lua coder and I need to learn thats why I want help So I can understand it.
Sorry, you need to Log In to post a reply to this thread.