Raised This Month: $18 Target: $400
 4% 

Problem ColoredSmoke


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Al3xandru27
Member
Join Date: Oct 2019
Old 07-20-2020 , 11:54   Problem ColoredSmoke
Reply With Quote #1

I have a problem with this plugin
If I throw a smoke, the smoke stays the next round

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

#define VERSION "1.1"

new const g_szClassname[] = "colored_smokenade";

new 
g_szSmokeSprites];
new 
g_Cvar_Enabled;

public 
plugin_init( ) {
    
register_plugin"Colored Smoke"VERSION"xPaw" );
    
    
register_cvar"colored_smoke"VERSIONFCVAR_SERVER FCVAR_SPONLY );
    
set_cvar_string"colored_smoke"VERSION );
    
    
g_Cvar_Enabled register_cvar"sv_colored_smoke""1" );
    
    
register_forwardFM_EmitSound"FwdEmitSound" );
    
register_touchg_szClassname"worldspawn""FwdTouch_FakeSmoke" );
    
register_thinkg_szClassname"FwdThink_FakeSmoke" );
}

public 
plugin_precache( ) {
    
g_szSmokeSprites] = precache_model"sprites/gas_puff_01y.spr" );
    
g_szSmokeSprites] = precache_model"sprites/gas_puff_01r.spr" );
    
g_szSmokeSprites] = precache_model"sprites/gas_puff_01b.spr" );
    
g_szSmokeSprites] = precache_model"sprites/gas_puff_01g.spr" );
    
g_szSmokeSprites] = precache_model"sprites/gas_puff_01m.spr" );
    
g_szSmokeSprites] = precache_model"sprites/gas_puff_01o.spr" );
    
    
precache_sound"weapons/grenade_hit1.wav" );
}

public 
FwdEmitSoundiOrigEntiChannel, const szSample[], Float:fVolFloat:fAttniFlagsiPitch ) {
    new 
iCvar get_pcvar_numg_Cvar_Enabled );
    if( 
iCvar ) {
        static const 
szSmokeSound[] = "weapons/sg_explode.wav";
        
        if( 
equalszSampleszSmokeSound ) ) {
            
// cache origin, angles and model
            
new Float:vOrigin], Float:vAngles], szModel64 ], iOwner;
            
iOwner entity_get_edictiOrigEntEV_ENT_owner );
            
entity_get_vectoriOrigEntEV_VEC_originvOrigin );
            
entity_get_vectoriOrigEntEV_VEC_anglesvAngles );
            
entity_get_stringiOrigEntEV_SZ_modelszModelcharsmaxszModel ) );
            
            
// remove entity from world
            
entity_set_vectoriOrigEntEV_VEC_originFloat:{ 9999.99999.99999.9 } );
            
entity_set_intiOrigEntEV_INT_flagsFL_KILLME );
            
            
// create new entity
            
new iEntity create_entity"info_target" );
            if( 
iEntity ) {
                
entity_set_stringiEntityEV_SZ_classnameg_szClassname );
                
                
entity_set_originiEntityvOrigin );
                
entity_set_vectoriEntityEV_VEC_anglesvAngles );
                
                
entity_set_intiEntityEV_INT_movetypeMOVETYPE_TOSS );
                
entity_set_intiEntityEV_INT_solidSOLID_BBOX );
                
                
entity_set_floatiEntityEV_FL_nextthinkget_gametime( ) + 21.5 );
                
entity_set_floatiEntityEV_FL_gravity0.5 );
                
entity_set_floatiEntityEV_FL_friction0.8 );
                
                
entity_set_modeliEntityszModel );
                
                new 
Float:vVelocity];
                
vVelocity] = random_float( -220.0220.0 );
                
vVelocity] = random_float( -220.0220.0 );
                
vVelocity] = random_float(  200.0300.0 );
                
entity_set_vectoriEntityEV_VEC_velocityvVelocity );
                
                
emit_soundiEntityiChannelszSamplefVolfAttniFlagsiPitch );
                
                
// Create fake smoke
                
new iSmoke;
                
                if( 
iCvar == )
                    
iSmoke get_user_teamiOwner ); // i did indexes as team, 1 - red, 2 - blue, 3 - green( spec oO )
                
else
                    
iSmoke random_num0);
                
                
// Store the smoke number in entity, we will use it later
                
entity_set_intiEntityEV_INT_iuser4iSmoke );
                
                
message_beginMSG_BROADCASTSVC_TEMPENTITY );
                
write_byteTE_FIREFIELD );
                
engfuncEngFunc_WriteCoordvOrigin] );
                
engfuncEngFunc_WriteCoordvOrigin] );
                
engfuncEngFunc_WriteCoordvOrigin] + 50 );
                
write_short100 );
                
write_shortg_szSmokeSpritesiSmoke ] );
                
write_byte100 );
                
write_byteTEFIRE_FLAG_ALPHA );
                
write_byte1000 );
                
message_end();
                
                
message_beginMSG_BROADCASTSVC_TEMPENTITY );
                
write_byteTE_FIREFIELD );
                
engfuncEngFunc_WriteCoordvOrigin] );
                
engfuncEngFunc_WriteCoordvOrigin] );
                
engfuncEngFunc_WriteCoordvOrigin] + 50 );
                
write_short150 );
                
write_shortg_szSmokeSpritesiSmoke ] );
                
write_byte10 );
                
write_byteTEFIRE_FLAG_ALPHA TEFIRE_FLAG_SOMEFLOAT );
                
write_byte1000 );
                
message_end( );
            }
        }
    }
}

public 
FwdTouch_FakeSmokeiEntityiWorld ) {
    if( !
is_valid_entiEntity ) )
        return 
PLUGIN_CONTINUE;
    
    
// Bounce sound
    
emit_soundiEntityCHAN_VOICE"weapons/grenade_hit1.wav"0.25ATTN_NORM0PITCH_NORM );
    
    new 
Float:vVelocity];
    
entity_get_vectoriEntityEV_VEC_velocityvVelocity );
    
    if( 
vVelocity] <= 0.0 && vVelocity] <= 0.0 ) {
        new 
Float:vOrigin];
        new 
iSmoke entity_get_intiEntityEV_INT_iuser4 );
        
entity_get_vectoriEntityEV_VEC_originvOrigin );
        
        
// Make small smoke near grenade on ground
        
message_beginMSG_BROADCASTSVC_TEMPENTITY );
        
write_byteTE_FIREFIELD );
        
engfuncEngFunc_WriteCoordvOrigin] );
        
engfuncEngFunc_WriteCoordvOrigin] );
        
engfuncEngFunc_WriteCoordvOrigin] + 10 );
        
write_short);
        
write_shortg_szSmokeSpritesiSmoke ] );
        
write_byte);
        
write_byteTEFIRE_FLAG_ALLFLOAT TEFIRE_FLAG_ALPHA );
        
write_byte30 );
        
message_end();
    }
    
    return 
PLUGIN_CONTINUE;
}

public 
FwdThink_FakeSmokeiEntity ) {
    if( !
is_valid_entiEntity ) )
        return 
PLUGIN_CONTINUE;
    
    
remove_entityiEntity );
    
    return 
PLUGIN_CONTINUE;

Al3xandru27 is offline
MagNNusS
Member
Join Date: May 2018
Location: World of Bushi
Old 07-20-2020 , 12:47   Re: Problem ColoredSmoke
Reply With Quote #2

Why don't you remove smoke's entity when the round starts?
__________________
Just an impractical signature
nothing to see here.
MagNNusS is offline
Al3xandru27
Member
Join Date: Oct 2019
Old 07-20-2020 , 13:01   Re: Problem ColoredSmoke
Reply With Quote #3

How do I do that?
Al3xandru27 is offline
MagNNusS
Member
Join Date: May 2018
Location: World of Bushi
Old 07-21-2020 , 06:13   Re: Problem ColoredSmoke
Reply With Quote #4

PHP Code:
new entity
while((entity find_ent_by_class(entity"my_entity_classname")) != 0)
{
    
// your code

Like this perhaps ?
__________________
Just an impractical signature
nothing to see here.
MagNNusS is offline
Al3xandru27
Member
Join Date: Oct 2019
Old 07-21-2020 , 12:11   Re: Problem ColoredSmoke
Reply With Quote #5

It doesn't work .. I don't know how to do it ..
Al3xandru27 is offline
Celena Luna
Senior Member
Join Date: Aug 2013
Location: Okinawa, Japan
Old 07-21-2020 , 12:19   Re: Problem ColoredSmoke
Reply With Quote #6

Quote:
Originally Posted by Al3xandru27 View Post
It doesn't work .. I don't know how to do it ..
Don't say it doesn't work without posting your code.
We don't know what wrong to help if we can't see what you write.
__________________
My plugin:

Last edited by Celena Luna; 07-21-2020 at 12:19.
Celena Luna is offline
Al3xandru27
Member
Join Date: Oct 2019
Old 07-21-2020 , 13:18   Re: Problem ColoredSmoke
Reply With Quote #7

I don't know where to put that code
Al3xandru27 is offline
Celena Luna
Senior Member
Join Date: Aug 2013
Location: Okinawa, Japan
Old 07-23-2020 , 06:21   Re: Problem ColoredSmoke
Reply With Quote #8

then go to Request section if you don't know how to write the plugin.
This Scripting section only show you the way, not do it for you.
__________________
My plugin:
Celena Luna is offline
wasabi90
New Member
Join Date: Jun 2020
Old 07-25-2020 , 16:37   Re: Problem ColoredSmoke
Reply With Quote #9

Quote:
Originally Posted by MagNNusS View Post
Why don't you remove smoke's entity when the round starts?
hola, yo tengoen mi server el humo de color y anda de 10, es un pluginq ya tra mi host
wasabi90 is offline
MagNNusS
Member
Join Date: May 2018
Location: World of Bushi
Old 07-26-2020 , 07:06   Re: Problem ColoredSmoke
Reply With Quote #10

Quote:
Originally Posted by wasabi90 View Post
hola, yo tengoen mi server el humo de color y anda de 10, es un pluginq ya tra mi host
You could at least write it in English...
__________________
Just an impractical signature
nothing to see here.

Last edited by MagNNusS; 07-26-2020 at 07:07.
MagNNusS is offline
Reply


Thread Tools
Display Modes

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 14:25.


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