AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Solved Make rain sound to loop on RainySnowy (Enables CS weather) v2.0y by OneEyed & teame06 (https://forums.alliedmods.net/showthread.php?t=310688)

chuttenjr 09-15-2018 12:23

Make rain sound to loop on RainySnowy (Enables CS weather) v2.0y by OneEyed & teame06
 
2 Attachment(s)
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

chuttenjr 09-19-2018 22:41

Re: Make rain sound to loop on RainySnowy (Enables CS weather) v2.0y by OneEyed & tea
 
Or in any case make a loop sound event that i can add to this plugin??

generalmemer 09-21-2018 06:16

Re: Make rain sound to loop on RainySnowy (Enables CS weather) v2.0y by OneEyed & tea
 
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);
    }



chuttenjr 09-22-2018 14:37

Re: Make rain sound to loop on RainySnowy (Enables CS weather) v2.0y by OneEyed & tea
 
Thanks a lot "generalmemer" will try to implement this into the already made plugin.

Cheers

Eduardo

DJEarthQuake 09-22-2018 15:30

Re: Make rain sound to loop on RainySnowy (Enables CS weather) v2.0y by OneEyed & tea
 
#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 09-22-2018 15:32

Re: Make rain sound to loop on RainySnowy (Enables CS weather) v2.0y by OneEyed & tea
 
I hope this thread doesn't get discarded to the trash forums. That would be cold. This guy is as he says, new.

chuttenjr 09-22-2018 16:55

Re: Make rain sound to loop on RainySnowy (Enables CS weather) v2.0y by OneEyed & tea
 
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 09-22-2018 18:54

Re: Make rain sound to loop on RainySnowy (Enables CS weather) v2.0y by OneEyed & tea
 
ok,i see what you were trying to say,to use smaller size and duration audio files to loop
hehehe

DJEarthQuake 09-23-2018 00:02

Re: Make rain sound to loop on RainySnowy (Enables CS weather) v2.0y by OneEyed & tea
 
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.

chuttenjr 09-23-2018 07:44

Re: Make rain sound to loop on RainySnowy (Enables CS weather) v2.0y by OneEyed & tea
 
Roger That!!


All times are GMT -4. The time now is 12:55.

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