Here's a plugin I made a long time ago. It doesn't have sound to it but it coded for what you are asking for. If you want the sound just ask I will consider adding it. By sound I mean the rain sound.
Anyways, here are the commands
Cvar set_weather normal(default)
For sunny weather (set_weather) to either
For rainny weather (set_weather) to either
For snowy weather (set_weather) to either
For snowy/rainny weather (set_weather) to either
PHP Code:
#include < amxmodx >
#include < fakemeta >
#include < engine >
new g_szPluginInfo[ 3 ][ 13 ] = { "Weather", "1.0", "Pastout" }
new g_iWeather = 0
new g_iMsgRecieve
new g_pCvarWeather
new Trie:g_iWeatherOptions
new g_iHudEnt
new g_bHudEntRemoved = true
new g_szInfoTarget[ 12 ] = "info_target"
new g_szHudEntity[ 11 ] = "hud_entity"
new g_szFwdHudEntThink[ 17 ] = "Fwd_HudEnt_Think"
enum WeatherOptions {
Weather_Off,
Weather_Rain,
Weather_Snow,
Weather_SnowAndRain
}
enum {
Sunny,
Rain,
Snow
}
public plugin_init( ) {
register_plugin( g_szPluginInfo[ 0 ], g_szPluginInfo[ 1 ], g_szPluginInfo[ 2 ] )
register_cvar( g_szPluginInfo[ 0 ], g_szPluginInfo[ 1 ], FCVAR_SERVER | FCVAR_SPONLY )
g_pCvarWeather = register_cvar( "set_weather", "normal" )
g_iWeatherOptions = TrieCreate( )
TrieSetCell( g_iWeatherOptions, "0", Weather_Off )
TrieSetCell( g_iWeatherOptions, "sunny", Weather_Off )
TrieSetCell( g_iWeatherOptions, "normal", Weather_Off )
TrieSetCell( g_iWeatherOptions, "off", Weather_Off )
TrieSetCell( g_iWeatherOptions, "1", Weather_Rain )
TrieSetCell( g_iWeatherOptions, "rain", Weather_Rain )
TrieSetCell( g_iWeatherOptions, "2", Weather_Snow )
TrieSetCell( g_iWeatherOptions, "snow", Weather_Snow )
TrieSetCell( g_iWeatherOptions, "3", Weather_SnowAndRain )
TrieSetCell( g_iWeatherOptions, "snowrain", Weather_SnowAndRain )
TrieSetCell( g_iWeatherOptions, "rainsnow", Weather_SnowAndRain )
g_iMsgRecieve = get_user_msgid("ReceiveW")
register_message( g_iMsgRecieve, "MsgReceived" )
register_logevent( "Event_RoundEnd", 2, "1&Restart_Round" )
register_logevent( "Event_RoundEnd", 2, "1=Game_Commencing" )
register_logevent( "Event_RoundEnd", 2, "1=Round_End" )
}
public plugin_precache( ) {
engfunc( EngFunc_CreateNamedEntity, engfunc( EngFunc_AllocString, "env_snow" ) )
engfunc( EngFunc_CreateNamedEntity, engfunc( EngFunc_AllocString, "env_rain" ) )
}
public Event_RoundEnd( ) {
static WeatherOptions:g_WeatherOption
g_WeatherOption = GetWeatherOption( )
switch( g_WeatherOption )
{
case Weather_Off:
{
Check_Conditions( )
g_iWeather = Sunny
}
case Weather_Rain:
{
Check_Conditions( )
g_iWeather = Rain
}
case Weather_Snow:
{
Check_Conditions( )
g_iWeather = Snow
}
case Weather_SnowAndRain:
{
g_iWeather = Snow
if( g_bHudEntRemoved )
{
g_iHudEnt = create_entity( g_szInfoTarget )
entity_set_string( g_iHudEnt, EV_SZ_classname, g_szHudEntity )
register_think( g_szHudEntity, g_szFwdHudEntThink )
entity_set_float( g_iHudEnt, EV_FL_nextthink, get_gametime() + 0.1 )
g_bHudEntRemoved = false
}
}
default:
{
g_iWeather = Sunny
}
}
}
public Check_Conditions( ) {
if( is_valid_ent( g_iHudEnt ) )
{
remove_entity_name( g_szHudEntity )
g_bHudEntRemoved = true
}
}
public Fwd_HudEnt_Think( iEntity ) {
if ( iEntity != g_iHudEnt )
return
switch( g_iWeather )
{
case Sunny: g_iWeather = Rain
case Rain: g_iWeather = Snow
case Snow: g_iWeather = Rain
default: g_iWeather = Rain
}
static iPlayers[ 32 ], iNum, i, iPlayer
get_players( iPlayers, iNum )
for( i=0; i<iNum; i++ )
{
iPlayer = iPlayers[ i ]
message_begin( MSG_ONE_UNRELIABLE, g_iMsgRecieve, { 0,0,0 }, iPlayer )
write_byte( g_iWeather )
message_end( )
}
entity_set_float( g_iHudEnt, EV_FL_nextthink, get_gametime() + 0.1 )
}
public MsgReceived( msg_id, msg_dest, msg_entity )
if( GetWeatherOption( ) != Weather_SnowAndRain )
set_msg_arg_int( 1, ARG_BYTE, g_iWeather )
WeatherOptions:GetWeatherOption( ) {
new optionString[ 32 ], WeatherOptions:option;
get_pcvar_string( g_pCvarWeather, optionString, charsmax( optionString ) )
if( is_str_num( optionString ) )
{
option = WeatherOptions:str_to_num( optionString )
if( !( Weather_Off <= option < WeatherOptions ) )
option = GetDefaultWeatherOption( )
} else {
strtolower( optionString )
if( !TrieGetCell( g_iWeatherOptions, optionString, option ) )
option = GetDefaultWeatherOption( )
}
return option
}
WeatherOptions:GetDefaultWeatherOption( ) {
set_pcvar_string( g_pCvarWeather, "off" )
return Weather_Off;
}