Thread: Plugin for snow
View Single Post
preetham
Member
Join Date: Sep 2012
Location: India
Old 12-23-2013 , 04:51   Re: Plugin for snow
Reply With Quote #3

Here u go!

Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>

#define PLUGIN "Realistic Snow Fall" 
#define VERSION "0.1" 
#define AUTHOR "KillaH"

new const sprite[] = "sprites/fsnow/snow1.spr"
new cvar
new r, g, b
public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_touch("fsnow","*","remove")
    set_task(0.1, "prepare", _, _, _, "b")
    set_task(10.0, "remove", _, _, _, "b")
    cvar = register_cvar("number_flakes", "64")
    r = register_cvar("R", "255")
    g = register_cvar("G", "255")
    b = register_cvar("B", "255")
    
}
public plugin_precache()
{
    precache_model(sprite)
}
public prepare(id)
{
    new Float:origin[3]
    new map[64]
    get_mapname(map,63)
    if(equal(map,"cs_assault"))
        origin[2] = 999.0
    else if(equal(map,"de_dust2"))
        origin[2] = 250.0
    else if(equal(map, "de_nuke"))
        origin[2] = 120.0
    else if(equal(map, "de_inferno"))
        origin[2] = 430.0
    else if(equal(map, "de_dust")) 
        origin[2] = 210.0
    else
        return
    
    for(new i;i<get_pcvar_num(cvar);i++)
    {
        origin[0] = random_float(-2999.9,2999.9)
        origin[1] = random_float(-2999.9,2999.9)
        new ent = create_entity("env_sprite")
        static Float:color[3]
        color[0] = get_pcvar_float(r)
        color[1] = get_pcvar_float(g)
        color[2] = get_pcvar_float(b)
        entity_set_string(ent, EV_SZ_classname, "fsnow")
        entity_set_model(ent,sprite)
        entity_set_int(ent, EV_INT_spawnflags, SF_SPRITE_STARTON)
        entity_set_float(ent, EV_FL_framerate, 30.0)
        entity_set_float(ent, EV_FL_scale, 1.0)
        entity_set_int(ent, EV_INT_rendermode, kRenderTransAdd)
        entity_set_float(ent, EV_FL_renderamt, 255.0)
    
        
        set_pev(ent, pev_rendercolor, color)
        entity_set_origin(ent, origin)
        entity_set_int(ent, EV_INT_solid, SOLID_BBOX)
        entity_set_int(ent, EV_INT_movetype, MOVETYPE_TOSS)
        entity_set_size(ent,Float:{1.0,1.0,1.0},Float:{1.0,1.0,1.0})        
        entity_set_float(ent, EV_FL_gravity,0.4)
        new Float:v[3]
        entity_get_vector(ent,EV_VEC_velocity,v)
        v[0]=random_float(-250.0,250.0)
        v[1]=random_float(-250.0,250.0)
        entity_set_vector(ent,EV_VEC_velocity,v)
        
    }
}

public remove(ent) {
    remove_entity(ent)
}
an u need a snow sprite.. paste in sprited>fsnow>**paste .spr file here**
Attached Files
File Type: zip snow1.zip (6.2 KB, 289 views)
preetham is offline