With orpheu, something like. Test plugin.
Code:
#include <amxmodx>
#include <orpheu>
#include <fakemeta>
#include <engine>
public plugin_init()
{
register_clcmd( "say /test", "ClientCommand_Test" );
}
public ClientCommand_Test( const client )
{
// set_pev( client, pev_takedamage, DAMAGE_NO );
new origin[ 3 ];
new Float:origin_f[ 3 ];
get_user_origin( client, origin, 3 );
IVecFVec( origin, origin_f );
new grenade = create_entity( "grenade" );
set_pev( grenade, pev_origin, origin_f );
ExplodeC4( grenade );
}
ExplodeC4( const grenade )
{
static OrpheuFunction:handleFuncDetonate2;
if( handleFuncDetonate2 || ( handleFuncDetonate2 = OrpheuGetFunction( "Detonate2", "CGrenade" ) ) )
{
OrpheuCall( handleFuncDetonate2, grenade );
}
}
Code:
{
"name" : "Detonate2",
"class" : "CGrenade",
"library" : "mod",
"identifiers":
[
{
"os" : "windows",
"mod" : "cstrike",
"value" : "?Detonate2@CGrenade@@QAEXXZ"
},
{
"os" : "linux",
"mod" : "cstrike",
"value" : "Detonate2__8CGrenade"
}
]
}
I don't remember exactly why I've started a manual version instead of calling directly Detonate2. Maybe to be able to customize ? Or because it triggers the round ends on de_ maps ? :p
Anyway, I don't think I will work on it unless someone begs me :p, so here basically how works the C4 explosion :
Code:
// spriteIndexFExplo -> "sprites/fexplo.spr"
// spriteIndexEExplo -> "sprites/eexplo.spr"
// spriteIndexZerogxplode -> "sprites/zerogxplode.spr"
FX_ScreenShake
(
.center = origin,
.amplitude = 25.0,
.frequency = 150.0,
.duration = 1.0,
.radius = 3000.0
);
emit_sound( entity, CHAN_WEAPON, "weapons/c4_explode1.wav", VOL_NORM, 0.25, 0, PITCH_NORM );
for ( new i = 0, spriteIndex, scale, brightness; i < 4; i++ )
{
switch ( i )
{
case 0 :
{
origin[ z ] -= 10.0;
spriteIndex = spriteIndexFExplo;
scale = -105; // ( 100 - 275.0 ) * 0.6
brightness = 150;
}
case 1 :
{
spriteIndex = spriteIndexEExplo;
scale = -105;
brightness = 150;
}
case 2 :
{
spriteIndex = spriteIndexFExplo;
scale = -105;
brightness = 150;
}
case 3 :
{
spriteIndex = spriteIndexZerogxplode;
scale = -105;
brightness = 17;
}
}
if ( i )
{
origin[ x ] += random_float( -512.0, 512.0 );
origin[ y ] += random_float( -512.0, 512.0 );
origin[ z ] += random_float( -10.0 , 10.0 );
}
FX_Sprite( origin[ x ], origin[ y ], origin[ z ], spriteIndex, scale, brightness );
}
FX_DecalTrace( pTrace, DECAL_SCORCH1 );
switch ( random_num( 0, 2 ) )
{
case 0 : emit_sound( entity, CHAN_VOICE, "weapons/debris1.wav", 0.55, ATTN_NORM, 0, PITCH_NORM );
case 1 : emit_sound( entity, CHAN_VOICE, "weapons/debris2.wav", 0.55, ATTN_NORM, 0, PITCH_NORM );
case 2 : emit_sound( entity, CHAN_VOICE, "weapons/debris3.wav", 0.55, ATTN_NORM, 0, PITCH_NORM );
}
pev( entity, pev_origin, origin );
RadiusDamage( origin, entity, entity, 500.0, 0, DMG_BLAST );
set_pev( entity, pev_nextthink, get_gametime() + 0.85 );
if ( engfunc( EngFunc_PointContents, origin ) != CONTENTS_WATER )
{
new rand = random_num( 0, 3 );
for ( new i = 0, spark; i < rand; i++ )
{
spark = create_entity( "spark_shower" );
set_pev( spark, pev_origin, origin );
DispatchSpawn( spark );
}
}
// The smoke is missing but it's basically the same as a CGrenade::Smoke(), the 2 last paralms : 150, 8
// FX_ScreenShake = UTIL_ScreenShake -> See HLSDK
// FX_DecalTrace = UTIL_DecalTrace -> See HLSDK
//