AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Thunder clap effect (https://forums.alliedmods.net/showthread.php?t=76475)

FakeNick 08-25-2008 07:52

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

ConnorMcLeod 08-25-2008 12:32

Re: Thunder clap effect
 
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)



Nightshroud 09-17-2008 05:20

Re: Thunder clap effect
 
this doesnt work and I realy need it :|

Vet 09-17-2008 10:05

Re: Thunder clap effect
 
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.


All times are GMT -4. The time now is 03:07.

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