Raised This Month: $ Target: $400
 0% 

Fix Colored Smoke?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
+ARUKARI-
AlliedModders Donor
Join Date: Jul 2004
Location: Japan
Old 05-29-2022 , 00:04   Re: Fix Colored Smoke?
Reply With Quote #1

It will not disappear until the duration set by TE_FIREFIELD ends.
If you want it to disappear at will, the only way is to modify it by creating an entity to represent it.
__________________
GitHub
SteamWishlist

六四天安門事件
+ARUKARI- is offline
Krystek.
Member
Join Date: May 2022
Old 05-29-2022 , 05:02   Re: Fix Colored Smoke?
Reply With Quote #2

Quote:
Originally Posted by +ARUKARI- View Post
It will not disappear until the duration set by TE_FIREFIELD ends.
If you want it to disappear at will, the only way is to modify it by creating an entity to represent it.
I also found such a code

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

#if !defined write_coord_f
    #define write_coord_f(%1)   engfunc( EngFunc_WriteCoord, %1 )
#endif

#define VERSION "1.07"
#define SMOKE_SPRITE "sprites/newsmoke.spr"

new const g_szClassname[] = "custom_smoke";
new 
g_fwid
new g_evCreateSmoke;
new 
g_szSmokeSprite;
new 
g_Cvar_Enabled;
new 
g_Cvar_Duration;
new 
g_Cvar_CountSprites;
new 
g_Clear;
new 
g_iCvar_Enebled;
new 
g_iCountSprites;

public 
plugin_init( )
{
    
register_plugin"Custom Smoke"VERSION"bionext" );

    
g_Clear 0;
    
g_iCvar_Enebled 0;
    
g_Cvar_Enabled register_cvar"sv_customsmoke""1" );
    
g_Cvar_Duration register_cvar"sv_smokeduration""10.0" );
    
g_Cvar_CountSprites register_cvar"sv_smokespritescount""100" );

    
unregister_forward(FM_PrecacheEventg_fwid1);

    
register_thinkg_szClassname"FwdThink_BlackSmoke" );
    
register_forward(FM_PlaybackEvent"FwdPlaybackEvent");
    
register_logevent("FwdClear"2"1=Round_End");
    
register_logevent("FwdStart"2"1=Round_Start");
    
register_event("TextMsg""FwdClear""a""2=#Game_will_restart_in","2=#Game_Commencing");
}

public 
FwdClear( )
{
    
g_Clear 1;
}

public 
FwdStart( )
{
    
g_iCvar_Enebled get_pcvar_numg_Cvar_Enabled );
    
g_Clear 0;
}

public 
plugin_precache( )
{
    
g_szSmokeSprite precache_modelSMOKE_SPRITE );
    
g_fwid register_forward(FM_PrecacheEvent"FwdPrecacheEvent"1);
    
force_unmodified(force_exactfile, {0,0,0},{0,0,0}, SMOKE_SPRITE);
}

public 
FwdPlaybackEventiFlags iEntity iEventindexFloat:fDelayFloat:vOrigin[3], Float:vAngles[3], Float:fParam1Float:fParam2iParam1iParam2iBparam1iBparam2 )
{
    if(
iEventindex != g_evCreateSmoke || iBparam2 || !g_iCvar_Enebled)
        return 
FMRES_IGNORED;

    new 
iEnt create_entity"info_target" );

    if( !
iEnt )
        return 
FMRES_IGNORED;
  
    
g_iCountSprites get_pcvar_numg_Cvar_CountSprites );
    new 
Float:fDuration get_pcvar_floatg_Cvar_Duration );
          
    
entity_set_stringiEntEV_SZ_classnameg_szClassname );
    
entity_set_floatiEntEV_FL_nextthinkget_gametime( ));
    
entity_set_vectoriEntEV_VEC_originvOrigin );
    
entity_set_floatiEntEV_FL_animtimefDuration );

    return 
FMRES_SUPERCEDE;
}

public 
FwdPrecacheEvent(type, const name[])
{
    if (
equal("events/createsmoke.sc"name))
    {
        
g_evCreateSmoke get_orig_retval();
        return 
FMRES_HANDLED;
    }

    return 
FMRES_IGNORED;
}

public 
FwdThink_BlackSmokeiEntity )
{
    if( !
is_valid_entiEntity ) )
        return 
PLUGIN_CONTINUE;

    if( 
g_Clear )
    {
        
entity_set_intiEntity,EV_INT_flagsFL_KILLME );
        return 
PLUGIN_CONTINUE;
    }

    new 
Float:vOrigin[3];
    
entity_get_vectoriEntityEV_VEC_originvOrigin );

    
message_beginMSG_BROADCASTSVC_TEMPENTITY );
    
write_byteTE_FIREFIELD );
    
write_coord_fvOrigin] );
    
write_coord_fvOrigin] );
    
write_coord_fvOrigin] + 50 );
    
write_short100 );
    
write_shortg_szSmokeSprite );
    
write_byteg_iCountSprites );
    
write_byteTEFIRE_FLAG_ALPHA );
    
write_byte11 );
    
message_end();

    
message_beginMSG_BROADCASTSVC_TEMPENTITY );
    
write_byteTE_FIREFIELD );
    
write_coord_fvOrigin] );
    
write_coord_fvOrigin] );
    
write_coord_fvOrigin] + 50 );
    
write_short150 );
    
write_shortg_szSmokeSprite );
    
write_byte);
    
write_byteTEFIRE_FLAG_ALPHA TEFIRE_FLAG_SOMEFLOAT );
    
write_byte11 );
    
message_end( );

    new 
Float:time entity_get_float(iEntity,EV_FL_animtime);
    
time time 0.25;

    if( 
time 0.0 )
    {
        
entity_set_floatiEntityEV_FL_nextthinkget_gametime( ) + 0.25 );
        
entity_set_floatiEntityEV_FL_animtimetime );
    }
    else
    {
        
entity_set_intiEntity,EV_INT_flagsFL_KILLME );
    }

    return 
PLUGIN_CONTINUE;

But I don't know at all how to add a few colors to it because when I try to add it it varies over time
Krystek. 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 21:21.


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