Raised This Month: $ Target: $400
 0% 

[ZP] Addon Round Fog


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
bibu
Veteran Member
Join Date: Sep 2010
Old 06-06-2011 , 13:18   Re: [ZP] Addon Round Fog
Reply With Quote #8

Quote:
Originally Posted by yokomo View Post
so i will past to you to update it
Done.

Untested, please test all cvars out, hope it works flawlessly.
The colors should be by default ok.

PHP Code:
#include <amxmodx>
#include <zombieplague>

#define PLUGIN    "ZP Round Fog"
#define VERSION    "1.0.0"
#define AUTHOR    "yokomo"

new zp_fog_infzp_fog_inf_colorzp_fog_inf_density
new zp_fog_multizp_fog_multi_colorzp_fog_multi_density
new zp_fog_plaguezp_fog_plague_colorzp_fog_plague_density
new zp_fog_survzp_fog_surv_colorzp_fog_surv_density
new zp_fog_nemzp_fog_nem_colorzp_fog_nem_density
new zp_fog_swarmzp_fog_swarm_colorzp_fog_swarm_density

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
zp_fog_inf register_cvar("zp_fog_inf""1")
    
zp_fog_inf_color register_cvar("zp_fog_inf_color""0 200 0")
    
zp_fog_inf_density register_cvar("zp_fog_inf_density""0.0002")
    
    
zp_fog_multi register_cvar("zp_fog_multi""1")
    
zp_fog_multi_color register_cvar("zp_fog_multi_color""200 0 0")
    
zp_fog_multi_density register_cvar("zp_fog_multi_density""0.0002")
    
    
zp_fog_plague register_cvar("zp_fog_plague""1")
    
zp_fog_plague_color register_cvar("zp_fog_inf_plague""153 50 204")
    
zp_fog_plague_density register_cvar("zp_fog_inf_plague""0.0010")
    
    
zp_fog_surv register_cvar("zp_fog_surv""1")
    
zp_fog_surv_color register_cvar("zp_fog_surv_color""58 95 208")
    
zp_fog_surv_density register_cvar("zp_fog_surv_density""0.0008")
    
    
zp_fog_nem register_cvar("zp_fog_nem""1")
    
zp_fog_nem_color register_cvar("zp_fog_nem_color""255 0 0")
    
zp_fog_nem_density register_cvar("zp_fog_nem_density""0.0008")
    
    
zp_fog_swarm register_cvar("zp_fog_swarm""1")
    
zp_fog_swarm_color register_cvar("zp_fog_swarm_color""200 200 0")
    
zp_fog_swarm_density register_cvar("zp_fog_swarm_density""0.0005")
    
    
register_event("HLTV""event_round_start""a""1=0""2=0")
}

public 
plugin_cfg()
{
    
set_task(1.0"event_round_start")
}

public 
event_round_start()
{
    
CreateFog(0, .clear true)
}

public 
client_putinserver(id)
{
    
CreateFog(id, .clear true)
}

public 
zp_round_started(gamemode)
{
    new 
rgb
    
    
switch(gamemode)
    {
        case 
MODE_INFECTION:
        {
            if(
get_pcvar_num(zp_fog_inf))
            {
                
PrePareFogColor(zp_fog_inf_colorrgb)
            
                
CreateFog(0rgbget_pcvar_float(zp_fog_inf_density))
            }
        }
        case 
MODE_MULTI:
        {
            if(
get_pcvar_num(zp_fog_multi))
            {
                
PrePareFogColor(zp_fog_multi_colorrgb)
            
                
CreateFog(0rgbget_pcvar_float(zp_fog_multi_density))
            }
        }
        case 
MODE_PLAGUE:
        {
            if(
get_pcvar_num(zp_fog_plague))
            {
                
PrePareFogColor(zp_fog_plague_colorrgb)
            
                
CreateFog(0rgbget_pcvar_float(zp_fog_plague_density))
            }
        }
        case 
MODE_SURVIVOR:
        {
            if(
get_pcvar_num(zp_fog_surv))
            {
                
PrePareFogColor(zp_fog_surv_colorrgb)
            
                
CreateFog(0rgbget_pcvar_float(zp_fog_surv_density))
            }
        }
        case 
MODE_NEMESIS:
        {
            if(
get_pcvar_num(zp_fog_nem))
            {
                
PrePareFogColor(zp_fog_nem_colorrgb)
            
                
CreateFog(0rgbget_pcvar_float(zp_fog_nem_density))
            }
        }
        case 
MODE_SWARM:
        {
            if(
get_pcvar_num(zp_fog_swarm))
            {
                
PrePareFogColor(zp_fog_swarm_colorrgb)
            
                
CreateFog(0rgbget_pcvar_float(zp_fog_swarm_density))
            }
        }
    }
}

public 
PrePareFogColor(cvar, &r, &g, &b)
{
    static 
color[16], piece[5]
    
get_pcvar_string(cvarcolor15)
    
    
strbreak(colorpiece4color15)
    
str_to_num(piece)
    
    
strbreak(colorpiece4color15)
    
str_to_num(piece)
    
str_to_num(color)
}

// Stock create fog by Arkshine
stock CreateFog (const index 0, const red 127, const green 127, const blue 127, const Float:density_f 0.001bool:clear false
{    
    static 
msgFog
    
    
if(msgFog || (msgFog get_user_msgid("Fog")))     
    {         
        new 
density _:floatclamp(density_f0.00010.25) * _:!clear      
        message_begin
(index MSG_ONE_UNRELIABLE MSG_BROADCASTmsgFog, .player index)      
        
write_byte(clamp(red0255))   
        
write_byte(clamp(green0255))         
        
write_byte(clamp(blue 0255))        
        
write_byte((density 0xFF))       
        
write_byte((density >>  8) & 0xFF)     
        
write_byte((density >> 16) & 0xFF)    
        
write_byte((density >> 24) & 0xFF)    
        
message_end()
    } 

__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
 



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 15:02.


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