Raised This Month: $32 Target: $400
 8% 

plugin to emit sound every X seconds


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
vegeta1241
AlliedModders Donor
Join Date: Apr 2017
Location: Switzerland
Old 10-08-2018 , 13:51   plugin to emit sound every X seconds
Reply With Quote #1

I seek in forum, but i dont find a plugin to emit random sound every x seconds,

do you have an idea how to script it ?
vegeta1241 is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 10-08-2018 , 14:01   Re: plugin to emit sound every X seconds
Reply With Quote #2

Use a timer?

Although it's probably a good idea to start/stop it when maps start/end.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
vegeta1241
AlliedModders Donor
Join Date: Apr 2017
Location: Switzerland
Old 10-08-2018 , 14:26   Re: plugin to emit sound every X seconds
Reply With Quote #3

I dont know how to create script
vegeta1241 is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 10-08-2018 , 15:55   Re: plugin to emit sound every X seconds
Reply With Quote #4

PHP Code:
#include <sourcemod>
#include <sdktools>

public void OnMapStart()
{
     
PrecacheSound("my/sound/file/here"true); // Precache sound file...
     
CreateTimer(1.0tTimerRandomSound_TIMER_FLAG_NO_MAPCHANGE|TIMER_REPEAT); // Start a timer on every map start that ends when map ends.
}

public 
Action tTimerRandomSound(Handle timer)
{
     
// void EmitSoundToAll(const char[] sample, int entity, int channel, int level, int flags, float volume, int pitch, int speakerentity, const float origin[3], const float dir[3], bool updatePos, float soundtime)
     
EmitSoundToAll("my/sound/file/here");

This should give you a head start.
__________________
Psyk0tik is offline
vegeta1241
AlliedModders Donor
Join Date: Apr 2017
Location: Switzerland
Old 10-08-2018 , 16:31   Re: plugin to emit sound every X seconds
Reply With Quote #5

Can i add more sounds ?

And its play randomly?

Last edited by vegeta1241; 10-08-2018 at 16:32.
vegeta1241 is offline
Facksy
Senior Member
Join Date: Apr 2017
Location: +2+2
Old 10-08-2018 , 17:08   Re: plugin to emit sound every X seconds
Reply With Quote #6

Quote:
Originally Posted by vegeta1241 View Post
Can i add more sounds ?

And its play randomly?
PHP Code:
#include <sourcemod> 
#include <sdktools> 

char g_sSounds[][] = 
{
    
"my/sound/file/here1",
    
"my/sound/file/here2",
    
"my/sound/file/here3",
    
"my/sound/file/here4"
}

public 
void OnMapStart() 

    for(
int i 0sizeof(g_sSounds); i++)
        
PrecacheSound(g_sSounds[i], true); // Precache sound file... 
    
CreateTimer(1.0tTimerRandomSound_TIMER_FLAG_NO_MAPCHANGE|TIMER_REPEAT); // Start a timer on every map start that ends when map ends. 


public 
Action tTimerRandomSound(Handle timer

    
// void EmitSoundToAll(const char[] sample, int entity, int channel, int level, int flags, float volume, int pitch, int speakerentity, const float origin[3], const float dir[3], bool updatePos, float soundtime) 
    
int random GetRandomInt(0sizeof(g_sSounds)-1);
    
EmitSoundToAll(g_sSounds[random]); 

I think it should work, not tested
__________________
My Steam I take private requests if related with TF2
My Plugins

Last edited by Facksy; 10-08-2018 at 17:08.
Facksy is offline
vegeta1241
AlliedModders Donor
Join Date: Apr 2017
Location: Switzerland
Old 10-08-2018 , 17:14   Re: plugin to emit sound every X seconds
Reply With Quote #7

thanks
vegeta1241 is offline
vegeta1241
AlliedModders Donor
Join Date: Apr 2017
Location: Switzerland
Old 10-08-2018 , 17:38   Re: plugin to emit sound every X seconds
Reply With Quote #8

files not downloading
vegeta1241 is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 10-08-2018 , 17:50   Re: plugin to emit sound every X seconds
Reply With Quote #9

Quote:
Originally Posted by vegeta1241 View Post
files not downloading
You're supposed to change all the "my/sound/file/here" stuff with your own sound files...
__________________
Psyk0tik is offline
DarkDeviL
SourceMod Moderator
Join Date: Apr 2012
Old 10-08-2018 , 17:54   Re: plugin to emit sound every X seconds
Reply With Quote #10

Quote:
Originally Posted by vegeta1241 View Post
I dont know how to create script
The Scripting section is for getting assistance with making your own things, not for getting others to make all the work for you.

For future posts, if you want someone else to do everything for you, as it sounds, you should post the requests in Plugin/Gameplay Ideas and Requests.

I have moved this thread thread over there.
__________________
Mostly known as "DarkDeviL".

Dropbox FastDL: Public folder will no longer work after March 15, 2017!
For more info, see the [SRCDS Thread], or the [HLDS Thread].
DarkDeviL is offline
Reply


Thread Tools
Display Modes

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 04:05.


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