| 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_EmitAmbientSound, 94, Float:{-680.000000,-912.000000,-304.000000}, g_szThunderSound, 0.000000, 0.000000, 32, 0)
engfunc(EngFunc_EmitAmbientSound, 94, Float:{-680.000000,-912.000000,-304.000000}, g_szThunderSound, 1.000000, 0.000000, 0, 100)
engfunc(EngFunc_LightStyle, 0, "z")
if(task_exists(TASKID1))
{
remove_task(TASKID1)
}
set_task(0.2, "Restore_LightStyle", TASKID1)
return FMRES_HANDLED
}
public Restore_LightStyle()
{
engfunc(EngFunc_LightStyle, 0, "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_mapname, szMapName, 12)
if(!equal(szMapName, "de_aztec_cz") && !equal(szMapName, "de_aztec"))
{
pause("ad")
return
}
new szHour[3]
get_time("%H", szHour, 2)
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(entity, Float:pos, const sample[], Float:vol, Float:att, fFlags, pitch)
{
//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", sample, vol, att, fFlags, pitch)
engfunc(EngFunc_LightStyle, 0, "z")
if(task_exists(TASKID1))
{
remove_task(TASKID1)
}
set_task(0.2, "Restore_LightStyle", TASKID1)
return FMRES_HANDLED
}
public Restore_LightStyle()
{
engfunc(EngFunc_LightStyle, 0, g_szCurrentLight)
}
|