Raised This Month: $ Target: $400
 0% 

Thunder clap effect


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
FakeNick
Senior Member
Join Date: Feb 2008
Location: Poland
Old 08-25-2008 , 07:52   Thunder clap effect
Reply With Quote #1

Can you tell me, how i can do in my plugin a thunderclap effect (like in zombie plague)?
__________________


[||||||||||] Snowball war v3.05

Pol
ish translations here ;) (PM me if you want one).


FakeNick is offline
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
Nightshroud
Junior Member
Join Date: Sep 2007
Old 09-17-2008 , 05:20   Re: Thunder clap effect
Reply With Quote #3

this doesnt work and I realy need it
Nightshroud is offline
Vet
Veteran Member
Join Date: Jul 2006
Location: I|O wa
Old 09-17-2008 , 10:05   Re: Thunder clap effect
Reply With Quote #4

Connorr didn't mean for you to use the plugin 'as is'. He provided you with examples of routines to show you how to code your own plugin. If you want someone to provide you with an entire plugin, you'd be better off posting in the plugin requests forum.
__________________
=====================================
- My Plugins -
=====================================
Vet is offline
Send a message via MSN to Vet
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 03:07.


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