Raised This Month: $ Target: $400
 0% 

[*SLOVED*] weather help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
WhyThis
Senior Member
Join Date: May 2013
Old 06-02-2013 , 10:58   [*SLOVED*] weather help
Reply With Quote #1

hello
i have this:
Code:
#include <amxmodx> #include <engine> public plugin_init() {     register_plugin("Weather Map", "1.0", "MMYTH") } public plugin_precache() {     /* Rain */     create_entity("env_rain")     /* Snow */     create_entity("env_snow") }
i would like to add a cvar:
amx_weather #
if 0 = normal weather
if 1 = rain
if 2 = snow

Last edited by WhyThis; 06-03-2013 at 02:00.
WhyThis is offline
oxygen935
Veteran Member
Join Date: Jun 2012
Location: Athens, Greece
Old 06-02-2013 , 11:01   Re: weather help
Reply With Quote #2

Stop slowhacking.... Respect players config
__________________
Quote:
Originally Posted by quark View Post
You're a genius
Stopped any pawn work cause of university for computer science
oxygen935 is offline
Send a message via Skype™ to oxygen935
Pastout
Senior Member
Join Date: Dec 2010
Location: 1337 Street LeetTown
Old 06-02-2013 , 12:32   Re: weather help
Reply With Quote #3

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
  • 0
  • sunny
  • normal
  • off
For rainny weather (set_weather) to either
  • 1
  • rain
For snowy weather (set_weather) to either
  • 2
  • snow
For snowy/rainny weather (set_weather) to either
  • 3
  • snowrain
  • rainsnow
PHP Code:
#include < amxmodx >
#include < fakemeta >
#include < engine >
 
new g_szPluginInfo][ 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_szInfoTarget12 ] = "info_target"
new g_szHudEntity11 ] = "hud_entity"
new g_szFwdHudEntThink17 ] = "Fwd_HudEnt_Think"
 
enum WeatherOptions {
    
Weather_Off,
    
Weather_Rain,
    
Weather_Snow,
    
Weather_SnowAndRain
}
 
enum {
    
Sunny,
    
Rain,
    
Snow
}
 
public 
plugin_init( ) {
    
register_pluging_szPluginInfo], g_szPluginInfo], g_szPluginInfo] )
 
    
register_cvarg_szPluginInfo], g_szPluginInfo], FCVAR_SERVER FCVAR_SPONLY )
 
    
g_pCvarWeather register_cvar"set_weather""normal" )
 
    
g_iWeatherOptions TrieCreate( )
    
TrieSetCellg_iWeatherOptions"0"Weather_Off )
    
TrieSetCellg_iWeatherOptions"sunny"Weather_Off )
    
TrieSetCellg_iWeatherOptions"normal"Weather_Off )
    
TrieSetCellg_iWeatherOptions"off"Weather_Off )
    
TrieSetCellg_iWeatherOptions"1"Weather_Rain )
    
TrieSetCellg_iWeatherOptions"rain"Weather_Rain )
    
TrieSetCellg_iWeatherOptions"2"Weather_Snow )
    
TrieSetCellg_iWeatherOptions"snow"Weather_Snow )
    
TrieSetCellg_iWeatherOptions"3"Weather_SnowAndRain )
    
TrieSetCellg_iWeatherOptions"snowrain"Weather_SnowAndRain )
    
TrieSetCellg_iWeatherOptions"rainsnow"Weather_SnowAndRain )
 
    
g_iMsgRecieve get_user_msgid("ReceiveW")
    
register_messageg_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( ) {
    
engfuncEngFunc_CreateNamedEntityengfuncEngFunc_AllocString"env_snow" ) )
    
engfuncEngFunc_CreateNamedEntityengfuncEngFunc_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_entityg_szInfoTarget )
                
entity_set_stringg_iHudEntEV_SZ_classnameg_szHudEntity )
                
register_thinkg_szHudEntityg_szFwdHudEntThink )
                
entity_set_floatg_iHudEntEV_FL_nextthinkget_gametime() + 0.1 )
                
g_bHudEntRemoved false
            
}
        }
        default:
        {
            
g_iWeather Sunny
        
}
    }
}
 
public 
Check_Conditions( ) {
    if( 
is_valid_entg_iHudEnt ) )
    {
        
remove_entity_nameg_szHudEntity )
        
g_bHudEntRemoved true
    
}
}
 
public 
Fwd_HudEnt_ThinkiEntity ) {
    if ( 
iEntity != g_iHudEnt )
        return
 
    switch( 
g_iWeather )
    {
        case 
Sunnyg_iWeather Rain
        
case Raing_iWeather Snow
        
case Snowg_iWeather Rain
        
default: g_iWeather Rain
    
}
 
    static 
iPlayers32 ], iNumiiPlayer
    get_players
iPlayersiNum )
 
    for( 
i=0i<iNumi++ ) 
    {
        
iPlayer iPlayers]
        
message_beginMSG_ONE_UNRELIABLEg_iMsgRecieve, { 0,0,}, iPlayer )
        
write_byteg_iWeather )
        
message_end( )
    }
    
entity_set_floatg_iHudEntEV_FL_nextthinkget_gametime() + 0.1 )
}
 
public 
MsgReceivedmsg_idmsg_destmsg_entity )
    if( 
GetWeatherOption( ) != Weather_SnowAndRain )
        
set_msg_arg_int1ARG_BYTEg_iWeather )
 
WeatherOptions:GetWeatherOption( ) {
    new 
optionString32 ], WeatherOptions:option;
    
get_pcvar_stringg_pCvarWeatheroptionStringcharsmaxoptionString ) )
 
    if( 
is_str_numoptionString ) ) 
    {
        
option WeatherOptions:str_to_numoptionString )
 
        if( !( 
Weather_Off <= option WeatherOptions ) ) 
            
option GetDefaultWeatherOption( )
 
    } else {
        
strtoloweroptionString )
 
        if( !
TrieGetCellg_iWeatherOptionsoptionStringoption ) ) 
            
option GetDefaultWeatherOption( )
    }
 
    return 
option
}
 
WeatherOptions:GetDefaultWeatherOption( ) {
    
set_pcvar_stringg_pCvarWeather"off" )
 
    return 
Weather_Off;

Attached Files
File Type: sma Get Plugin or Get Source (weather.sma - 578 views - 4.2 KB)

Last edited by Pastout; 06-02-2013 at 12:33.
Pastout is offline
WhyThis
Senior Member
Join Date: May 2013
Old 06-02-2013 , 14:47   Re: weather help
Reply With Quote #4

Thanks a lot
i will test it

Edit:
It work perfectly
thanks a lot

but the problem is that i can use: "set_weather" only with server console ! why admin can't use it !
please fix it

Last edited by WhyThis; 06-02-2013 at 15:44.
WhyThis is offline
oxygen935
Veteran Member
Join Date: Jun 2012
Location: Athens, Greece
Old 06-02-2013 , 18:35   Re: weather help
Reply With Quote #5

Of course you can't type
it man... It is a cvar not a command...
Use this:
amx_cvar "set_weather" "number"
__________________
Quote:
Originally Posted by quark View Post
You're a genius
Stopped any pawn work cause of university for computer science
oxygen935 is offline
Send a message via Skype™ to oxygen935
WhyThis
Senior Member
Join Date: May 2013
Old 06-03-2013 , 01:59   Re: weather help
Reply With Quote #6

ok thanks
*SLOVED*
WhyThis is offline
Reply



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 18:38.


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