Raised This Month: $ Target: $400
 0% 

[REQ][TF2] Attach Sound to Player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Helvetica
Senior Member
Join Date: Nov 2011
Location: U.S.
Old 05-28-2012 , 04:49   [REQ][TF2] Attach Sound to Player
Reply With Quote #1

I was wondering if anyone could write a plugin for me that will attach and play sound files to a player so they can be played in game, but be emitting from the player it is attached to instead of being played globally at 100% volume for everyone.
Like how the TF2 class vo lines or the Scout's boom box only play in the immediate area.
I searched for quite a while around the forums for something like this, but didn't find anything.

If it's not too much trouble, I'd also like to be able to select from multiple sound files to play, before targeting the player to attach it to. File paths possibly stored inside a config file would be nice, although hardcoded paths would suffice.

I'm not a programmer, so I would really appreciate it if someone would take the time to help me out with this.

Last edited by Helvetica; 05-28-2012 at 04:50.
Helvetica is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 05-29-2012 , 01:38   Re: [REQ][TF2] Attach Sound to Player
Reply With Quote #2

Emiting sound from a player isn't that hard... you can specify the position or entity that a sound emits from using EmitSoundToAll or EmitAmbientSound (although my understanding is that EmitAmbientSound is for background sounds). Keep in mind that player indexes are also entity indexes.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
Helvetica
Senior Member
Join Date: Nov 2011
Location: U.S.
Old 05-29-2012 , 03:57   Re: [REQ][TF2] Attach Sound to Player
Reply With Quote #3

Quote:
Originally Posted by Powerlord View Post
Emiting sound from a player isn't that hard... you can specify the position or entity that a sound emits from using EmitSoundToAll or EmitAmbientSound (although my understanding is that EmitAmbientSound is for background sounds). Keep in mind that player indexes are also entity indexes.
Yes I am aware that it is not complicated, but I have zero programming knowledge and I do not have the spare time to even learn the basics of SourcePawn. My free time is fully spent in other areas of work. Someone who already understands the language could probably do this in a fraction of the time it would take me to finally figure it out, which is why this is purely a request.
Helvetica is offline
Doodil
Senior Member
Join Date: Mar 2012
Old 05-29-2012 , 10:55   Re: [REQ][TF2] Attach Sound to Player
Reply With Quote #4

didn't test a lot but this should do the trick... you have to create a sounds.cfg in your config folder looking something like:

Code:
"Sounds"
{
    "Achievment earned"
    {
        "path" "misc/achievement_earned.wav"
    }
    "Bell"
    {
        "path" "misc/jingle_bells/jingle_bells_nm_01.wav"
    }
}
Attached Files
File Type: sp Get Plugin or Get Source (soundsmod.sp - 531 views - 2.7 KB)
Doodil is offline
Helvetica
Senior Member
Join Date: Nov 2011
Location: U.S.
Old 05-29-2012 , 11:49   Re: [REQ][TF2] Attach Sound to Player
Reply With Quote #5

Quote:
Originally Posted by Doodil View Post
didn't test a lot but this should do the trick... you have to create a sounds.cfg in your config folder looking something like:

Code:
"Sounds"
{
    "Achievment earned"
    {
        "path" "misc/achievement_earned.wav"
    }
    "Bell"
    {
        "path" "misc/jingle_bells/jingle_bells_nm_01.wav"
    }
}
This worked perfectly mate, thank you very much.

If it's not too much trouble, do you think you could add a command to stop a currently playing sound? I apologize for not mentioning it before, I forgot. If it's too much of a hassle, don't worry about it though, I appreciate greatly what you've already given me.
Helvetica is offline
Umbrozium
Junior Member
Join Date: Dec 2017
Location: ǝʌɐɹ
Old 01-06-2018 , 04:27   Re: [REQ][TF2] Attach Sound to Player
Reply With Quote #6

Is there a way to make the sound loop? For example: a giant robot scout engine sound doesn't loop when I play it.
Umbrozium is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:43.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode