Raised This Month: $ Target: $400
 0% 

[ Solved ] Ambience Sound what heard everywhere


Post New Thread Reply   
 
Thread Tools Display Modes
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 01-03-2009 , 13:22   Re: Ambience Sound what heard everywhere
Reply With Quote #11

yes but i dont want to precache all sounds in one time, only that what is randromly selected and will be play
__________________
xPaw is offline
mando127
Veteran Member
Join Date: Dec 2006
Location: virginia
Old 01-05-2009 , 09:19   Re: [ Solved ] Ambience Sound what heard everywhere
Reply With Quote #12

Quote:
yes but i dont want to precache all sounds in one time, only that what is randromly selected and will be play
i would like that to, im looking for a mod like this for my servers
__________________
mando127 is offline
Send a message via Skype™ to mando127
wlacobain
Junior Member
Join Date: Mar 2008
Old 02-01-2009 , 21:16   Re: Ambience Sound what heard everywhere
Reply With Quote #13

Quote:
Originally Posted by FakeNick View Post
Maybe something like this ? ;)

PHP Code:

#include <amxmodx>
#include <fakemeta>

const OFFSET_AMBIENCE = (1<<0)

new const 
VERSION[] = "1.0"

new g_ambience[][] = { "amb/amb.wav","amb/amb2.wav" }

public 
plugin_init()
{
    
register_plugin("Ambience"VERSION"FakeNick")
}
public 
plugin_precache()
{
    for(new 
0sizeof g_ambiencei++)
        
engfunc(EngFunc_PrecacheSound,g_ambience[i])
    
    new 
entity engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"ambient_generic"))
    
set_pev(entitypev_health10.0)
    
set_pev(entitypev_messageg_ambience[random_num(0,sizeof g_ambience 1)])
    
set_pev(entitypev_spawnflagsOFFSET_AMBIENCE)
    
dllfunc(DLLFunc_Spawnentity)

plz, how to make a loop?
wlacobain is offline
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 02-01-2009 , 21:38   Re: [ Solved ] Ambience Sound what heard everywhere
Reply With Quote #14

PHP Code:
#include <amxmodx>

#define MAX_SOUNDS    3

new const g_Ambience[][] = 
{
    
"DayOfDefeat/dodambience1.wav",
    
"DayOfDefeat/dodambience2.wav",
    
"DayOfDefeat/dodambience3.wav",
    
"DayOfDefeat/dodambience4.wav",
    
"DayOfDefeat/dodambience5.wav",
    
"DayOfDefeat/dodambience6.wav"
}; 

public 
plugin_precache()
{
    new 
using[MAX_SOUNDS][35], rand[35];
    new 
icountbool:used;
    
    do
    {            
        
copy(rand34g_Ambience[random(charsmax(g_Ambience))]);
        
        for(
MAX_SOUNDS i++)
        {
            if(
equali(using[i], rand))
            {
                
used true;
                break; 
// Inner loop.
            
}
        }
        
        if(
used)
        {
            
used false;
            continue; 
// Outer loop.
        
}
        
        
precache_sound(rand);
        
        
copy(using[count++], 34rand);
    }
    while(
count MAX_SOUNDS);

__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ
Dores is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-02-2009 , 01:18   Re: [ Solved ] Ambience Sound what heard everywhere
Reply With Quote #15

If you use ExecuteHam(Ham_Spawn,...) with the sound ent, and during precache, sound will be auto-precached.
If you spawn it after precache, you can even try ExecuteHam(Ham_Precache, i_Sound_Entity)
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 02-02-2009 , 09:37   Re: [ Solved ] Ambience Sound what heard everywhere
Reply With Quote #16

Quote:
Originally Posted by ConnorMcLeod View Post
If you use ExecuteHam(Ham_Spawn,...) with the sound ent, and during precache, sound will be auto-precached.
If you spawn it after precache, you can even try ExecuteHam(Ham_Precache, i_Sound_Entity)
Then he should just spawn it(at plugin_precache or just use Ham_Precache) and choose a random sound, right?

But was my method of randomly precaching ok?
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ
Dores is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-02-2009 , 14:52   Re: [ Solved ] Ambience Sound what heard everywhere
Reply With Quote #17

1. Create the entity during plugin_precache
2. set pev_message (with a random sound)
3. ExecuteHam(Ham_Spawn, entity)
-> Ham_Precache will be called and will precache the sound previously set
__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 09:24.


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