Raised This Month: $ Target: $400
 0% 

How to change color of rain effects


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mAr7obg
Senior Member
Join Date: May 2007
Location: Bulgaria
Old 02-07-2010 , 05:24   How to change color of rain effects
Reply With Quote #1

See here what iam talking about.
http://amxmodxbg.org/upload/images/1265538178.jpg
like this
http://img513.**************/img513/6673/beztytuuumm.jpg


i use this code but not working properly. Please help me
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

#define PLUGIN "Weather Effects"
#define VERSION "1.0"
#define AUTHOR "Alka"

#define CLASS_WEATHER_EFFECTS "weather_effects"

#define ZOMBIE_THUNDER_1 "ambience/thunder_clap.wav"
#define ZOMBIE_THUNDER_2 "de_torn/torn_thndrstrike.wav"

#define MAX_LIGHT_POINTS 4

new lightStyleChar[3][] = { "b""c""n" };

new 
lightStyleNum;
new 
lightCounter;
new 
flashNum;
new 
bool:isFlashing;

new 
lightPoints[MAX_LIGHT_POINTS];
new 
lightBeam;

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    new 
iEnt engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"ambient_generic"));
    
    if(
iEnt)
    {
        
dllfunc(DLLFunc_ThinkiEnt);
        
set_pev(iEntpev_classnameCLASS_WEATHER_EFFECTS);
        
        
set_keyvalue(iEnt"message"ZOMBIE_THUNDER_1);
        
set_keyvalue(iEnt"targetname""wather");
        
set_keyvalue(iEnt"pitchstart""100");
        
set_keyvalue(iEnt"pitch""100");
        
set_keyvalue(iEnt"health""10");
        
set_keyvalue(iEnt"spawnflags""49");
        
        
dllfunc(DLLFunc_SpawniEnt);
        
set_pev(iEntpev_nextthinkget_gametime() + 2.0);
        
        
register_forward(FM_Think"Fwd_Think"1);
    }
}

public 
plugin_precache()
{
    
precache_sound(ZOMBIE_THUNDER_1);
    
precache_sound(ZOMBIE_THUNDER_2);
    
lightBeam precache_model("sprites/laserbeam.spr");
    
    
server_cmd("sv_skyname space");
    
    
engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"env_rain"));
    
    new 
Fog engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"env_fog"));
    
    
set_keyvalue(Fog"density""0.001");
    
set_keyvalue(Fog"rendercolor""0 0 0");
}

public 
client_connect(id)
    
client_cmd(id"cl_weather 1");

public 
Fwd_Think(iEnt)
{
    if(!
pev_valid(iEnt))
        return 
FMRES_IGNORED;
    
    static 
className[32];
    
pev(iEntpev_classnameclassName31);
    
    if(
equal(classNameCLASS_WEATHER_EFFECTS))
    {
        static 
thinkReturnrandNum;
        
        if(!
isFlashing)
        {
            
randNum random_num(01);
            if(
randNum)
                
set_pev(iEntpev_messageZOMBIE_THUNDER_1);
            else
                
set_pev(iEntpev_messageZOMBIE_THUNDER_2);
            
            
isFlashing true;
            
flashNum random_num(13);
            
dllfunc(DLLFunc_UseiEnt0);
            
            static 
Victim;
            
Victim get_random_player();
            
            if(
Victim)
                
CreateLightningPoints(Victim);
        }
        
thinkReturn LightsEffect();
        
        if(
thinkReturn)
            
set_pev(iEntpev_nextthinkget_gametime() + random_float(2.512.5));
        else
            
set_pev(iEntpev_nextthinkget_gametime() + 0.1);
    }
    
    return 
FMRES_HANDLED;
}

stock LightsEffect()
{
    switch(
flashNum)
    {
        case 
1:
        {
            
lightCounter += 1;
            switch(
lightCounter)
            {
                case 
1: { lightStyleNum 1; }
                case 
2: { lightStyleNum 2; }
                case 
3: { lightStyleNum 1; }
                case 
4: { lightStyleNum 0; }
            }
            
engfunc(EngFunc_LightStyle0lightStyleChar[lightStyleNum]);
            
            if(
lightCounter == 4)
            {
                
lightCounter 0;
                
isFlashing false;
                
                return 
1;
            }
            else
                return 
0;
        }
        case 
2:
        {
            
lightCounter += 1;
            switch(
lightCounter)
            {
                case 
1: { lightStyleNum 1; }
                case 
2: { lightStyleNum 2; }
                case 
3: { lightStyleNum 1; }
                case 
4: { lightStyleNum 2; }
                case 
5: { lightStyleNum 1; }
                case 
6: { lightStyleNum 0; }
            }
            
engfunc(EngFunc_LightStyle0lightStyleChar[lightStyleNum]);
            
            if(
lightCounter == 6)
            {
                
lightCounter 0;
                
isFlashing false;
                
                return 
1;
            }
            else
                return 
0;
        }
        case 
3:
        {
            
lightCounter += 1;
            switch(
lightCounter)
            {
                case 
1: { lightStyleNum 1; }
                case 
2: { lightStyleNum 2; }
                case 
3: { lightStyleNum 1; }
                case 
4: { lightStyleNum 2; }
                case 
5: { lightStyleNum 1; }
                case 
6: { lightStyleNum 2; }
                case 
7: { lightStyleNum 1; }
                case 
8: { lightStyleNum 0; }
            }
            
engfunc(EngFunc_LightStyle0lightStyleChar[lightStyleNum]);
            
            if(
lightCounter == 8)
            {
                
lightCounter 0;
                
isFlashing false;
                
                return 
1;
            }
            else
                return 
0;
        }
    }
    return 
1;
}

public 
CreateLightningPoints(id
{
    static 
EntxFloat:Vel[3], Float:Origin[3];
    static 
Float:Mins[3] = { -1.0, -1.0, -1.0 };
    static 
Float:Maxs[3] = { 1.01.01.0 };
    
    new 
Float:Dist is_user_outside(id) - 5.0;
    
    
pev(idpev_originOrigin);
    
    if(
Dist 700.0)
        
Dist 700.0;
    
    
Origin[2] += Dist;
    
    for(
MAX_LIGHT_POINTS x++) 
    {
        
Ent engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"env_sprite"));
        
set_pev(Entpev_movetypeMOVETYPE_FLY);
        
set_pev(Entpev_solidSOLID_TRIGGER);
        
set_pev(Entpev_renderamt0.0);
        
set_pev(Entpev_rendermodekRenderTransAlpha);
        
engfunc(EngFunc_SetModelEnt"models/w_usp.mdl");
        
        
set_pev(Entpev_minsMins);
        
set_pev(Entpev_maxsMaxs);
        
        
Vel[0] = random_float(-500.0500.0);
        
Vel[1] = random_float(-500.0500.0);
        
Vel[2] = random_float((Dist <= 700.0 0.0 : -100.0), (Dist <= 700.0 0.0 50.0));
        
        
set_pev(Entpev_originOrigin);
        
set_pev(Entpev_velocityVel);
        
        
lightPoints[x] = Ent;
    }
    
    
set_task(0.3"Lightning"id);
    return 
1;
}

public 
Lightning(id)
{
    new 
xabRand;
    static 
Endpoint MAX_LIGHT_POINTS 1;
    
    while(
Endpoint)
    {
        
lightPoints[x];
        
lightPoints[1];
        
x++;
        
        if(
== Endpoint)
        {
            
Rand random(100);
            
            if(
Rand == 1)
                
id;
        }
        
CreateBeam(ab);
    }
    
    for(
MAX_LIGHT_POINTS x++)
    {
        if(
pev_valid(lightPoints[x]))
            
engfunc(EngFunc_RemoveEntitylightPoints[x]);
    }
}

stock set_keyvalue(entkey[], value[])
{
    new 
classname[32];
    
    
pev(entpev_classnameclassname31);
    
set_kvd(0KV_ClassNameclassname);
    
set_kvd(0KV_KeyNamekey);
    
set_kvd(0KV_Valuevalue);
    
set_kvd(0KV_fHandled0);
    
    
dllfunc(DLLFunc_KeyValueent0);
}

stock get_random_player()
{
    new 
CntTotal[33];
    new 
Players[32], Numid;
    
get_players(PlayersNum);
    
    for(new 
Num i++)
    {
        
id Players[i];
        
        if(!
is_user_alive(id))
            continue;
        
        if(
is_user_outside(id))
            
Total[Cnt++] = id;
    }
    
    if(
Cnt)
        return 
Total[random(Cnt)];
    
    return 
0;
}

stock Float:is_user_outside(id)
{
    new 
Float:origin[3], Float:dist;
    
    
pev(idpev_originorigin);
    
    
dist origin[2];
    
    while(
engfunc(EngFunc_PointContentsorigin) == -1)
        
origin[2] += 5.0;
    
    if(
engfunc(EngFunc_PointContentsorigin) == -6)
        return (
origin[2] - dist);
    
    return 
0.0;
}

stock CreateBeam(idEnt)
{
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
    
write_byte(8);
    
write_short(id);
    
write_short(Ent);
    
write_short(lightBeam);
    
write_byte(0);
    
write_byte(10);
    
write_byte(5);
    
write_byte(8);
    
write_byte(100);
    
write_byte(200); //R
    
write_byte(200); //G
    
write_byte(255); //B
    
write_byte(255);
    
write_byte(10);
    
message_end();


Last edited by mAr7obg; 02-07-2010 at 06:14.
mAr7obg is offline
Send a message via Skype™ to mAr7obg
Seta00
The Seta00 user has crashed.
Join Date: Jan 2010
Location: Berlin
Old 02-07-2010 , 07:31   Re: How to change color of rain effects
Reply With Quote #2

I have no experience with visual stuff, but maybe this typo is the reason:
Code:
set_keyvalue(iEnt, "targetname", "wather");  ->  "water"
Seta00 is offline
mAr7obg
Senior Member
Join Date: May 2007
Location: Bulgaria
Old 02-07-2010 , 07:34   Re: How to change color of rain effects
Reply With Quote #3

Why not working?
PHP Code:
#include <amxmodx> 
#include <amxmisc> 
#include <fakemeta> 

public plugin_init() { 
    
register_plugin("x","x","x"); 

public 
plugin_precache() { 
    new 
Rain engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"env_rain")); 
    new 
Fog engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"env_fog")); 
    
set_keyvalue(Fog"density""0.001"); 
    
set_keyvalue(Fog"rendercolor""0 0 0");
    
set_keyvalue(Rain"density""0.001"); 
    
set_keyvalue(Rain"rendercolor""255 0 0");

public 
client_connect(id
    
client_cmd(id"cl_weather 1"); 
    
stock set_keyvalue(entkey[], value[]) { 
    new 
classname[32]; 
    
pev(entpev_classnameclassname31); 
    
set_kvd(0KV_ClassNameclassname); 
    
set_kvd(0KV_KeyNamekey); 
    
set_kvd(0KV_Valuevalue); 
    
set_kvd(0KV_fHandled0); 
    
dllfunc(DLLFunc_KeyValueent0); 


Last edited by mAr7obg; 02-07-2010 at 07:43.
mAr7obg is offline
Send a message via Skype™ to mAr7obg
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-07-2010 , 07:45   Re: How to change color of rain effects
Reply With Quote #4

I don't think that create a fog ent right after a rain entity has any effect, i think you can only create 1 type of weather (rain/fog/snow) entities.
Also, i don't think you can change that color.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
mAr7obg
Senior Member
Join Date: May 2007
Location: Bulgaria
Old 02-07-2010 , 07:48   Re: How to change color of rain effects
Reply With Quote #5

where to find green smoke sprite for rain and how to include in my plugin?
like this picture
[img]http://img513.**************/img513/6673/beztytuuumm.jpg[/img]

Last edited by mAr7obg; 02-07-2010 at 07:51.
mAr7obg is offline
Send a message via Skype™ to mAr7obg
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 01:10.


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