Raised This Month: $ Target: $400
 0% 

Thunder clap effect


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-25-2008 , 12:32   Re: Thunder clap effect
Reply With Quote #2

PHP Code:
#include <amxmodx>
#include <fakemeta>

#define TASKID1    1324687358

new const g_szThunderSound[] = "ambience/thunder_clap.wav"

public plugin_precache()
{
    
precache_sound(g_szThunderSound)
}

public 
client_putinserver(id)
{
    if(
is_user_bot(id))
        return

    if(!
task_exists(TASKID1))
    {
        
Restore_LightStyle()
    }
}

public 
Make_Thunder()
{
    
//Those are de_aztec values
    
engfunc(EngFunc_EmitAmbientSound94Float:{-680.000000,-912.000000,-304.000000}, g_szThunderSound0.0000000.000000320)
    
engfunc(EngFunc_EmitAmbientSound94Float:{-680.000000,-912.000000,-304.000000}, g_szThunderSound1.0000000.0000000100)

    
engfunc(EngFunc_LightStyle0"z")
    if(
task_exists(TASKID1))
    {
        
remove_task(TASKID1)
    }
    
set_task(0.2"Restore_LightStyle"TASKID1)

    return 
FMRES_HANDLED
}

public 
Restore_LightStyle()
{
    
engfunc(EngFunc_LightStyle0"m")


I made this little plugin to make a thunder light on de_aztec :
PHP Code:
/* AMX Mod X Plugin

* (c) Copyright 2008, ConnorMcLeod 
* This file is provided as is (no warranties). 

*/ 

#include <amxmodx>
#include <fakemeta>

#define TASKID1    1324687358

new g_szCurrentLight[2]

public 
plugin_precache()
{
    static 
szMapName[13]
    
global_get(glb_mapnameszMapName12)
    if(!
equal(szMapName"de_aztec_cz") && !equal(szMapName"de_aztec"))
    {
        
pause("ad")
        return
    }

    new 
szHour[3]
    
get_time("%H"szHour2)

    switch(
str_to_num(szHour))
    {
        case 
7,21 :
        {
            
g_szCurrentLight "k"
            
set_cvar_string("sv_skyname""dusk")
        }
        case 
6,22 :
        {
            
g_szCurrentLight "h"
            
set_cvar_string("sv_skyname""drkg")
        }
        case 
5,23 :
        {
            
g_szCurrentLight "e"
            
set_cvar_string("sv_skyname""backalley")
        }
        case 
0..4 :
        {
            
g_szCurrentLight "b"
            
set_cvar_string("sv_skyname""night")
        }
        default : 
g_szCurrentLight "m"
    
}
}

public 
plugin_init()
{
    
register_plugin("de_aztec wheater""1.0.0""ConnorMcLeod")
    
register_forward(FM_EmitAmbientSound"fwdEmitAmbientSound")
}

public 
client_putinserver(id)
{
    if(
is_user_bot(id))
        return

    if(!
task_exists(TASKID1))
    {
        
Restore_LightStyle()
    }
}

public 
client_connect(id)
{
    
client_cmd(id"cl_weather 1")
}

public 
fwdEmitAmbientSound(entityFloat:pos, const sample[], Float:volFloat:attfFlagspitch)
{
    
//static const thunder_clap[] = "ambience/thunder_clap.wav"
    
if( strlen(sample) != 25 )
    {
        return 
FMRES_IGNORED
    
}
    if(
sample[0] != 'a' || sample[9] != 't' || sample[17] != 'c')
    {
        return 
FMRES_IGNORED
    
}
//    EngFunc_EmitAmbientSound,        
    // void )            
    //(edict_t *entity, float *pos, const char *samp, float vol, float attenuation, int fFlags, int pitch);

    
log_to_file("aztc.log""%s %f %f %i %i"samplevolattfFlagspitch)

    
engfunc(EngFunc_LightStyle0"z")
    if(
task_exists(TASKID1))
    {
        
remove_task(TASKID1)
    }
    
set_task(0.2"Restore_LightStyle"TASKID1)

    return 
FMRES_HANDLED
}

public 
Restore_LightStyle()
{
    
engfunc(EngFunc_LightStyle0g_szCurrentLight)

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
 



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:07.


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