Raised This Month: $51 Target: $400
 12% 

Bomb Blast


Post New Thread Reply   
 
Thread Tools Display Modes
ToriQQ
Member
Join Date: Mar 2010
Old 06-14-2010 , 22:04   Re: C4 Blast
Reply With Quote #21

can you make randoms colour for each wave? that would be awesome
__________________

ToriQQ is offline
K.K.Lv
Veteran Member
Join Date: Aug 2008
Location: GameFolder
Old 06-15-2010 , 06:53   Re: C4 Blast
Reply With Quote #22

Code:
stock create_blast_circle( ent ) {
    pev( ent, pev_origin, fOrigin );
    FVecIVec( fOrigin, iOrigin );
 
    static r, g, b;
    if ( gC4Timer > 13 ) {r = 255; g = 255; b = 255;}
    else if ( gC4Timer > 7 )  {r = 125; g = 125; b = 0;}
    else {r = 250; g = 10; b = 0;}
 
    message_begin( MSG_BROADCAST, SVC_TEMPENTITY, iOrigin ); 
    write_byte( TE_BEAMCYLINDER );
    write_coord( iOrigin[ 0 ] );
    write_coord( iOrigin[ 1 ] );
    write_coord( iOrigin[ 2 ] );
    write_coord( iOrigin[ 0 ] );
    write_coord( iOrigin[ 1 ] );
    write_coord( iOrigin[ 2 ] + 125 ) ;
    write_short( gSpriteCircle );
    write_byte( 0 );
    write_byte( 1 );
    write_byte( 6 );
    write_byte( 8 );
    write_byte( 1 );
    write_byte( r );
    write_byte( g );
    write_byte( b );
    write_byte( 128 );
    write_byte( 5 );
    message_end();
 
    if ( gC4Timer > 7 ) {
        message_begin( MSG_BROADCAST, SVC_TEMPENTITY, iOrigin ); 
        write_byte( TE_BEAMCYLINDER );
        write_coord( iOrigin[ 0 ] );
        write_coord( iOrigin[ 1 ] );
        write_coord( iOrigin[ 2 ] );
        write_coord( iOrigin[ 0 ] );
        write_coord( iOrigin[ 1 ] );
        write_coord( iOrigin[ 2 ] + 270 ) ;
        write_short( gSpriteCircle );
        write_byte( 0 );
        write_byte( 1 );
        write_byte( 6 );
        write_byte( 8 );
        write_byte( 1 );
        write_byte( r );
        write_byte( g );
        write_byte( b );
        write_byte( 128 );
        write_byte( 5 );
        message_end();
    }
}
I don't want to use random color, you can change it by yourself, just edit above code
__________________
QQ:116268742
K.K.Lv is offline
Send a message via MSN to K.K.Lv
KadiR
Unnecessary Member
Join Date: Aug 2008
Location: Zürich / Switzerland
Old 06-15-2010 , 09:52   Re: C4 Blast
Reply With Quote #23

You can also add a define for that.

Something like that:

PHP Code:
#define ONE_COLOR
#define RANDOM_COLOR 
KadiR is offline
ToriQQ
Member
Join Date: Mar 2010
Old 06-15-2010 , 23:06   Re: C4 Blast
Reply With Quote #24

Quote:
Originally Posted by K.K.Lv View Post
Code:
stock create_blast_circle( ent ) {
    pev( ent, pev_origin, fOrigin );
    FVecIVec( fOrigin, iOrigin );
 
    static r, g, b;
    if ( gC4Timer > 13 ) {r = 255; g = 255; b = 255;}
    else if ( gC4Timer > 7 )  {r = 125; g = 125; b = 0;}
    else {r = 250; g = 10; b = 0;}
 
    message_begin( MSG_BROADCAST, SVC_TEMPENTITY, iOrigin ); 
    write_byte( TE_BEAMCYLINDER );
    write_coord( iOrigin[ 0 ] );
    write_coord( iOrigin[ 1 ] );
    write_coord( iOrigin[ 2 ] );
    write_coord( iOrigin[ 0 ] );
    write_coord( iOrigin[ 1 ] );
    write_coord( iOrigin[ 2 ] + 125 ) ;
    write_short( gSpriteCircle );
    write_byte( 0 );
    write_byte( 1 );
    write_byte( 6 );
    write_byte( 8 );
    write_byte( 1 );
    write_byte( r );
    write_byte( g );
    write_byte( b );
    write_byte( 128 );
    write_byte( 5 );
    message_end();
 
    if ( gC4Timer > 7 ) {
        message_begin( MSG_BROADCAST, SVC_TEMPENTITY, iOrigin ); 
        write_byte( TE_BEAMCYLINDER );
        write_coord( iOrigin[ 0 ] );
        write_coord( iOrigin[ 1 ] );
        write_coord( iOrigin[ 2 ] );
        write_coord( iOrigin[ 0 ] );
        write_coord( iOrigin[ 1 ] );
        write_coord( iOrigin[ 2 ] + 270 ) ;
        write_short( gSpriteCircle );
        write_byte( 0 );
        write_byte( 1 );
        write_byte( 6 );
        write_byte( 8 );
        write_byte( 1 );
        write_byte( r );
        write_byte( g );
        write_byte( b );
        write_byte( 128 );
        write_byte( 5 );
        message_end();
    }
}
I don't want to use random color, you can change it by yourself, just edit above code
I am a complete noob at coding, would you mind giving me the whole sma file with random colour for the c4 blast? hehe. Thanks
__________________

ToriQQ is offline
K.K.Lv
Veteran Member
Join Date: Aug 2008
Location: GameFolder
Old 06-16-2010 , 03:16   Re: C4 Blast
Reply With Quote #25

Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <fakemeta>
#include <csx>
 
#define PLUGIN "c4 Blast"
#define VERSION "0.2"
#define AUTHOR "K.K.Lv"
 
#define RANDOM_COLOR
 
new gSpriteCircle;
 
new gC4Timer;
 
new Float:fOrigin[ 3 ];
 
new iOrigin[ 3 ];
 
public plugin_init() {
    register_plugin( PLUGIN, VERSION, AUTHOR );
 
    register_logevent( "RoundEnd", 2, "1=Round_End" );
}
public plugin_precache() {
    gSpriteCircle = precache_model( "sprites/shockwave.spr" );
}
public bomb_planted( planter ) {
    gC4Timer = get_cvar_num( "mp_c4timer" );
 
    set_task( 1.0, "bomb_blast", 1987);
    set_task( 1.0, "dist_time", 1990, "", 0, "b" );
}
public bomb_blast() {
    new c4 = -1;
    while ( ( c4 = engfunc( EngFunc_FindEntityByString, c4, "classname", "grenade" ) ) ) {
        if ( get_pdata_int( c4, 96 ) & ( 1<<8 ) ) {
            create_blast_circle( c4 );
        }
    }
    static Float:task_time
    if ( gC4Timer > 13 ) task_time = 1.0;
    else if ( gC4Timer > 7 )  task_time = 0.5;
    else task_time = 0.3;
    set_task( task_time, "bomb_blast", 1987 );
}
public dist_time() {
    --gC4Timer;
}
public RoundEnd() {
    remove_task( 1987 );
    remove_task( 1990 );
 
    /*new c4 = -1;
    while ( ( c4 = find_ent_by_model( c4, "grenade", "models/w_c4.mdl" ) ) ) {
     remove_entity( c4 );
    }*/
}
stock create_blast_circle( ent ) {
    pev( ent, pev_origin, fOrigin );
    FVecIVec( fOrigin, iOrigin );
 
    static r, g, b;
    #if defined RANDOM_COLOR
    r = random_num( 0, 255 );
    g = random_num( 0, 255 );
    b = random_num( 0, 255 );
    #else
    if ( gC4Timer > 13 ) {r = 255; g = 255; b = 255;}
    else if ( gC4Timer > 7 )  {r = 125; g = 125; b = 0;}
    else {r = 250; g = 10; b = 0;}
   #endif
 
    message_begin( MSG_BROADCAST, SVC_TEMPENTITY, iOrigin ); 
    write_byte( TE_BEAMCYLINDER );
    write_coord( iOrigin[ 0 ] );
    write_coord( iOrigin[ 1 ] );
    write_coord( iOrigin[ 2 ] );
    write_coord( iOrigin[ 0 ] );
    write_coord( iOrigin[ 1 ] );
    write_coord( iOrigin[ 2 ] + 125 ) ;
    write_short( gSpriteCircle );
    write_byte( 0 );
    write_byte( 1 );
    write_byte( 6 );
    write_byte( 8 );
    write_byte( 1 );
    write_byte( r );
    write_byte( g );
    write_byte( b );
    write_byte( 128 );
    write_byte( 5 );
    message_end();
 
    if ( gC4Timer > 7 ) {
        message_begin( MSG_BROADCAST, SVC_TEMPENTITY, iOrigin ); 
        write_byte( TE_BEAMCYLINDER );
        write_coord( iOrigin[ 0 ] );
        write_coord( iOrigin[ 1 ] );
        write_coord( iOrigin[ 2 ] );
       write_coord( iOrigin[ 0 ] );
        write_coord( iOrigin[ 1 ] );
        write_coord( iOrigin[ 2 ] + 270 ) ;
        write_short( gSpriteCircle );
        write_byte( 0 );
        write_byte( 1 );
        write_byte( 6 );
        write_byte( 8 );
        write_byte( 1 );
        write_byte( r );
        write_byte( g );
        write_byte( b );
        write_byte( 128 );
        write_byte( 5 );
        message_end();
    }
}
without the amxx studio and un-test !
that I can upload the .sma file to you !
__________________
QQ:116268742
K.K.Lv is offline
Send a message via MSN to K.K.Lv
ServO
Senior Member
Join Date: Nov 2009
Location: Are you asking me out?
Old 06-16-2010 , 07:19   Re: C4 Blast
Reply With Quote #26

Gj
__________________
Zombie Dominance

To Do:
- Learn AMXx Script...
ServO is offline
nemore
Junior Member
Join Date: Dec 2008
Location: csnemore.pl
Old 06-22-2010 , 13:30   Re: C4 Blast
Reply With Quote #27

Nice!
__________________

Serwery CS - Polish best server, awsome
nemore is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-30-2010 , 19:01   Re: C4 Blast
Reply With Quote #28

Let you 1 week to put the .sma back in first post so it can be reviewed.
Also, don't you think it's useless to show the code in first post ?
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-01-2010 , 10:21   Re: C4 Blast
Reply With Quote #29

Approval requirements
  • Cache C4 index into a global variable so you don't need to retrieve it
  • Check mp_c4time at new round event, or check c4 pdatas (either with fakemeta either with cstrike c4 natives) to determine time before explosion, if mp_c4timer is changed during round, your plugin will use a wrong value.

Suggestions
  • You could use EngFunc_WriteCoord instead of rounding origins, anyway code is fine as it is.
  • You could make colors and frequence customizable by cvars or whatever.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
K.K.Lv
Veteran Member
Join Date: Aug 2008
Location: GameFolder
Old 11-01-2010 , 11:32   Re: C4 Blast
Reply With Quote #30

Quote:
  • Cache C4 index into a global variable so you don't need to retrieve it
  • Check mp_c4time at new round event, or check c4 pdatas (either with fakemeta either with cstrike c4 natives) to determine time before explosion, if mp_c4timer is changed during round, your plugin will use a wrong value.
will be fix!

Quote:
You could use EngFunc_WriteCoord instead of rounding origins, anyway code is fine as it is.
You could make colors and frequence customizable by cvars or whatever.
1.fixed
2.will try, hope you tell me more about the frequence customizable, i don't know what is it .
__________________
QQ:116268742
K.K.Lv is offline
Send a message via MSN to K.K.Lv
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 19:15.


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