Raised This Month: $12 Target: $400
 3% 

Solved Make rain sound to loop on RainySnowy (Enables CS weather) v2.0y by OneEyed & teame06


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
chuttenjr
Member
Join Date: Sep 2018
Location: Saipan
Old 09-15-2018 , 12:23   Make rain sound to loop on RainySnowy (Enables CS weather) v2.0y by OneEyed & teame06
Reply With Quote #1

im really green into this community,could someone point me on how to make the rain sound to loop on this plugin : https://forums.alliedmods.net/showthread.php?t=42151 ??
The idea is to have the sound playing and looping while player is either alive or spectating,problem is that the code as it is will only play the rain.wav( by speak commands)which lasts 50 sec or so,then it suddenly stops and leave you with a silent rain ambient which completely kills inmersion.
I managed to code a little so when you are outside it plays rain.wav and when inside building a nice rain over metallic roof (rainroof) sound while inside which made the map a joy to play.
A partial fix for the sound stop i got to was to edit the sounds to last like 10 min by looping them on audacity,but then i ended up with two files of 30+ mb which randomly crashed server because of heap size hunk allocation.

Thanks everyone for your time

Eduardo,noob as ever hehe
Attached Files
File Type: amxx rainysnowy.amxx (4.0 KB, 86 views)
File Type: sma Get Plugin or Get Source (rainysnowy.sma - 369 views - 5.1 KB)

Last edited by chuttenjr; 09-29-2018 at 17:21. Reason: Missing Attachments
chuttenjr is offline
chuttenjr
Member
Join Date: Sep 2018
Location: Saipan
Old 09-19-2018 , 22:41   Re: Make rain sound to loop on RainySnowy (Enables CS weather) v2.0y by OneEyed & tea
Reply With Quote #2

Or in any case make a loop sound event that i can add to this plugin??
chuttenjr is offline
generalmemer
Member
Join Date: Sep 2017
Old 09-21-2018 , 06:16   Re: Make rain sound to loop on RainySnowy (Enables CS weather) v2.0y by OneEyed & tea
Reply With Quote #3

This should loop any audio which is compatible with 1.6 when a client connects, its client specific so any client can also disable the sound if they want for themselves. Just modify the sound path and tweak the length to get a perfect loop.

PHP Code:
#include amxmodx
#include amxmisc

new bool:g_bEnabled[33];

new 
Float:g_fSoundLength 30.0             //Sound length in seconds
new const g_sSoundDir[] = "ambience/guit1.wav";     //Sound path ( supposed to be cstrike/sound/ )


public plugin_init() {
    
register_clcmd("say /sound""fwToggleSound");
}


public 
plugin_precache()
    
precache_sound(g_sSoundDir);


public 
client_putinserver(id)
{
    
g_bEnabled[id] = false;
    
    if( 
is_user_connected(id) )
        
set_task(4.5"fwToggleSound"id);
}


public 
client_disconnect(id)
    
remove_task(id)


public 
fwToggleSound(id)
{
    if( !
is_user_connected(id) )
        return 
PLUGIN_HANDLED;
        
    if( 
g_bEnabled[id] )
    {
        
g_bEnabled[id] = false;
        
        
remove_task(id)    
            
        
client_cmd(id"stopsound");
        
client_print(idprint_chat"[AMXX] Sound disabled.")
    } 
    else 
    {
        
g_bEnabled[id] = true
        
        client_cmd
(id"spk %s"g_sSoundDir);
        
set_task(g_fSoundLength"fwSoundLoop"id__"b");
    }
    return 
PLUGIN_CONTINUE;
}


public 
fwSoundLoop(id)
{
    if( 
is_user_connected(id) )
    {
        
client_cmd(id"stopsound");
        
client_cmd(id"spk %s"g_sSoundDir);
    }

generalmemer is offline
chuttenjr
Member
Join Date: Sep 2018
Location: Saipan
Old 09-22-2018 , 14:37   Re: Make rain sound to loop on RainySnowy (Enables CS weather) v2.0y by OneEyed & tea
Reply With Quote #4

Thanks a lot "generalmemer" will try to implement this into the already made plugin.

Cheers

Eduardo
chuttenjr is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 09-22-2018 , 15:30   Re: Make rain sound to loop on RainySnowy (Enables CS weather) v2.0y by OneEyed & tea
Reply With Quote #5

#chuttenjr - received your PM.

There are tiny wav files from hl1 that loop themselves when called into the game. DJ friends are nice for situations like these. You are an audiophile!

Example(s) to analyze.
Code:
/home/chuttenjr/.chuttenjr/steam/steamapps/common/Half-Life/valve/sound/nihilanth
Quote:
A partial fix for the sound stop i got to was to edit the sounds to last like 10 min by looping them on audacity,but then i ended up with two files of 30+ mb which randomly crashed server because of heap size hunk allocation.
__________________
DJEarthQuake is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 09-22-2018 , 15:32   Re: Make rain sound to loop on RainySnowy (Enables CS weather) v2.0y by OneEyed & tea
Reply With Quote #6

I hope this thread doesn't get discarded to the trash forums. That would be cold. This guy is as he says, new.
__________________

Last edited by DJEarthQuake; 09-22-2018 at 15:33. Reason: ,
DJEarthQuake is offline
chuttenjr
Member
Join Date: Sep 2018
Location: Saipan
Old 09-22-2018 , 16:55   Re: Make rain sound to loop on RainySnowy (Enables CS weather) v2.0y by OneEyed & tea
Reply With Quote #7

so,youre implying that if i use a short loop version of my soundfiles and rename them to two of the nihilanth files the speak code from the plugin will make them auto loop?
chuttenjr is offline
chuttenjr
Member
Join Date: Sep 2018
Location: Saipan
Old 09-22-2018 , 18:54   Re: Make rain sound to loop on RainySnowy (Enables CS weather) v2.0y by OneEyed & tea
Reply With Quote #8

ok,i see what you were trying to say,to use smaller size and duration audio files to loop
hehehe
chuttenjr is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 09-23-2018 , 00:02   Re: Make rain sound to loop on RainySnowy (Enables CS weather) v2.0y by OneEyed & tea
Reply With Quote #9

Correct. Analyze and mimic the sound properties and find small rain sounds already looped that are not copyrighted of course. We want our lady to be a skinny lady not a fat lady.
__________________
DJEarthQuake is offline
chuttenjr
Member
Join Date: Sep 2018
Location: Saipan
Old 09-23-2018 , 07:44   Re: Make rain sound to loop on RainySnowy (Enables CS weather) v2.0y by OneEyed & tea
Reply With Quote #10

Roger That!!
chuttenjr 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 20:06.


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