PDA

View Full Version : after burn


rebeccs
06-09-2010, 10:57 PM
#include <amxmodx>
#include <fakemeta>

#define PLUGIN "Headshot Grave"
#define VERSION "1.0"
#define AUTHOR "anakin_cstrike"

#define fm_find_ent_by_class(%1,%2) engfunc( EngFunc_FindEntityByString, %1, "classname", %2 )
#define fm_remove_entity(%1) engfunc( EngFunc_RemoveEntity, %1 )

// thanks samurai
#define dmin Float:{ -2.440000, -3.540000, -4.960000 }
#define dmax Float:{ 5.880000, 3.780000, 4.750000 }

#define hsdistance 1000.0
#define radius 400.0

#define sounds 2

new const gclass[] = "grave";
new const tmodel[] = "models/gravet.mdl";
new const ctmodel[] = "models/gravect.mdl";

new g_sounds[sounds][] =
{
"misc/grave_sound1.wav",
"misc/grave_sound2.wav"
};

new bool:g_Graved[33];
new g_explode,g_smoke,lightning;
new g_msgscreenfade,g_msgstatusicon;

new toggle_plugin,toggle_hs,toggle_touch,toggle_radius ,
toggle_dmg,toggle_int,toggle_thunder,toggle_light, toggle_lighdur;
new p_plugin,p_hs,p_radius,p_dmg,p_int;

public plugin_init( )
{
register_plugin( PLUGIN, VERSION, AUTHOR );

register_forward( FM_Touch, "fw_touch" );
register_forward( FM_PlayerPreThink, "fw_prethink" );

register_event( "HLTV", "hook_newround", "a", "1=0", "2=0" );
register_event( "DeathMsg", "hook_death", "a" );
register_event( "ResetHUD", "hook_reset", "b" );

toggle_plugin = register_cvar( "hsgrave_plugin", "1" );
toggle_hs = register_cvar( "hsgrave_explode", "1" );
toggle_thunder = register_cvar( "hsgave_thunder", "1" );
toggle_touch = register_cvar( "hsgrave_touchkill", "1" );
toggle_light = register_cvar( "hsgrave_light", "1" );
toggle_lighdur = register_cvar( "hsgrave_lightduration", "2" );
toggle_radius = register_cvar( "hsgrave_radius", "1" );
toggle_dmg = register_cvar( "hsgrave_damage", "5" );
toggle_int = register_cvar( "hsgrave_interval", "3" );

g_msgscreenfade = get_user_msgid( "ScreenFade" );
g_msgstatusicon = get_user_msgid( "StatusIcon" );
}

public plugin_precache( )
{
precache_model( tmodel );
precache_model( ctmodel );
precache_sound( "ambience/thunder_clap.wav" );

lightning = precache_model( "sprites/lgtning.spr" );
g_explode = precache_model( "sprites/shockwave.spr" );
g_smoke = precache_model( "sprites/steam1.spr" );

for( new i = 0; i < sounds; i++ )
precache_sound(g_sounds[i]);
}

public hook_death ()
{
if( p_plugin != 1 )
return PLUGIN_CONTINUE;

new k = read_data( 1 );
new v = read_data( 2 );
new vteam = get_user_team( v );

if( !k || !v )
return PLUGIN_CONTINUE;
if( get_user_team( k ) == vteam )
return PLUGIN_CONTINUE;
if( !read_data( 3 ) )
return PLUGIN_CONTINUE;

new Float:korigin[3], Float:vorigin[3], Float:fdistance;
pev( k, pev_origin, korigin );
pev( v, pev_origin, vorigin );
fdistance = get_distance_f( korigin, vorigin );

if( fdistance >= hsdistance )
{
if( p_hs == 1 )
{
Smoke( vorigin, random_num( 30, 40 ), 5 );
Cylinder( vorigin );
}
Fade( v,(6<<10), (5<<10), (1<<12), 0, 0, 0, 175 );

new ent = engfunc( EngFunc_CreateNamedEntity, engfunc( EngFunc_AllocString, "info_target" ) );
vorigin[ 2 ] -= 35;
engfunc( EngFunc_SetOrigin, ent, vorigin );

if( !pev_valid( ent ) )
return PLUGIN_CONTINUE;

engfunc( EngFunc_SetModel, ent, vteam==1 ? tmodel : ctmodel );
set_pev( ent,pev_classname, gclass );
dllfunc( DLLFunc_Spawn, ent );

set_pev( ent,pev_solid, SOLID_BBOX );
set_pev( ent,pev_movetype, MOVETYPE_FLY );

engfunc( EngFunc_SetSize, ent, dmin, dmax );
engfunc( EngFunc_DropToFloor, ent );
}

return PLUGIN_CONTINUE;
}

public fw_touch( touched, toucher )
{
if( p_plugin != 1 )
return FMRES_IGNORED;
if( get_pcvar_num ( toggle_touch ) != 1 )
return FMRES_IGNORED;

static dclass[32], rclass[32], Float:origin[3];
pev( touched, pev_classname, dclass, sizeof dclass - 1 );
pev( toucher, pev_classname, rclass, sizeof rclass - 1 );
pev( toucher, pev_origin, origin );

if( equali ( dclass, gclass ) && equali ( rclass, "player" ) )
{
user_kill( toucher );

if( get_pcvar_num ( toggle_thunder ) == 1 )
{
new Float:vorigin[3];
new Float:pos[3];
pev(toucher, pev_origin, vorigin );

vorigin[ 2 ] -= 26;
pos[ 0 ] = vorigin[ 0 ] + 150;
pos[ 1 ] = vorigin[ 1 ] + 150;
pos[ 2 ] = vorigin[ 2 ] + 800;

Thunder( pos, vorigin );
Smoke( origin, 10, 10 );

new x = random_num( 0, sounds - 1 );
emit_sound( 0, CHAN_ITEM, g_sounds[x], 1.0, ATTN_NORM, 0, PITCH_NORM);
}

if( get_pcvar_num( toggle_light ) == 1 )
{
lights( "d" );
set_task( float( get_pcvar_num( toggle_lighdur) ), "relights");
}
}


return FMRES_IGNORED;
}

public hook_newround( )
{
new ent = -1;
while( ( ent = fm_find_ent_by_class ( ent, gclass ) ) )
fm_remove_entity( ent );

p_plugin = get_pcvar_num( toggle_plugin );
p_hs = get_pcvar_num( toggle_hs );
p_dmg = get_pcvar_num( toggle_dmg );
p_int = get_pcvar_num( toggle_int );
p_radius = get_pcvar_num( toggle_radius );
}

public fw_prethink( id )
{
if( p_plugin != 1 )
return FMRES_IGNORED;
if( p_radius != 1 )
return FMRES_IGNORED;

if( !is_user_alive( id ))
return FMRES_IGNORED;

new Float:origin[3], Float:gorigin[3], Float:distance;
new ent = -1;
pev( id, pev_origin, origin );

while(( ent = fm_find_ent_by_class( ent, gclass )))
{
pev(ent,pev_origin,gorigin);
distance = get_distance_f( origin, gorigin );

if( distance <= radius )
{
if(g_Graved[ id ])
return FMRES_IGNORED;

g_Graved[ id ] = true;

Icon( id, 2,"dmg_gas",0,0,0);
Fade( id, (1<<10), (1<<10), (1<<12), 0, 0, 0, 175 );

set_task( float ( p_int ), "poison", id+123, _, _, "b" );

} else {
g_Graved[id] = false;

if( task_exists( id+123 ))
remove_task( id+123 );

Icon( id, 0, "dmg_gas", 0, 0, 0 );
}
}

return FMRES_IGNORED;
}

public poison( task )
{
new index = task-123;
new hp = get_user_health( index );
new total = hp - p_dmg;
new name[32];
get_user_name( index, name, 31 );

if( total <= 0 )
{
user_kill( index );
Fade( index, (6<<10), (5<<10), (1<<12), 0, 0, 0, 175 );
} else
is_user_alive( index ) ? set_pev( index, pev_health, float( total ) ) : remove_task( index );

Fade( index, (1<<10), (1<<10), (1<<12), 0, 0, 0, 35 );
}

public hook_reset( id )
{
g_Graved[ id ] = false;
Icon( id, 0, "dmg_gas", 0, 0, 0 );

if( task_exists( id+123 ) )
remove_task( id+123 );
}

public Smoke( Float:forigin[3], scale, framerate )
{
message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
write_byte( TE_SMOKE );
write_coord( floatround( forigin[0] ) );
write_coord( floatround( forigin[1] ) );
write_coord( floatround( forigin[2] ) );
write_short( g_smoke );
write_byte( scale );
write_byte( framerate );
message_end();
}

public Cylinder( Float:forigin[3] )
{
new origin[3];
FVecIVec( forigin, origin );

CreateCylinder( origin, 550, g_explode, 0, 0, 6, 60, 0, 0, 210, 0, 175, 0 );
CreateCylinder( origin, 700, g_explode, 0, 0, 6, 60, 0, 0, 235, 0, 150, 0 );
CreateCylinder( origin, 850, g_explode, 0, 0, 6, 60, 0, 15, 255, 15, 100, 0 );
}

public relights() lights( "n" );

CreateCylinder( origin[3], addrad, sprite, startfrate, framerate, life, width, amplitude, red, green, blue, brightness, speed )
{
message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
write_byte( TE_BEAMCYLINDER );
write_coord( origin[0] );
write_coord( origin[1] );
write_coord( origin[2] );
write_coord( origin[0] );
write_coord( origin[1] );
write_coord( origin[2] + addrad );
write_short( sprite );
write_byte( startfrate );
write_byte( framerate );
write_byte( life );
write_byte( width );
write_byte( amplitude );
write_byte( red );
write_byte( green );
write_byte( blue );
write_byte( brightness );
write_byte( speed );
message_end();
}

Thunder( Float:vec1[3], Float:vec2[3] )
{
new ivec1[3], ivec2[3];
FVecIVec( vec1, ivec1 ); FVecIVec( vec2, ivec2 );

message_begin( MSG_PVS, SVC_TEMPENTITY );
write_byte( TE_BEAMPOINTS );
write_coord( ivec1[0] );
write_coord( ivec1[1] );
write_coord( ivec1[2] );
write_coord( ivec2[0] );
write_coord( ivec2[1] );
write_coord( ivec2[2] );
write_short( lightning );
write_byte( 1 );
write_byte( 5 );
write_byte( 2 );
write_byte( 20 );
write_byte( 30 );
write_byte( 200 );
write_byte( 200 );
write_byte( 200 );
write_byte( 200 );
write_byte( 200 );
message_end();

message_begin( MSG_PVS, SVC_TEMPENTITY, ivec2 );
write_byte( TE_SPARKS );
write_coord( ivec2[0] );
write_coord( ivec2[1] );
write_coord( ivec2[2] );
message_end();

emit_sound( 0, CHAN_ITEM, "ambience/thunder_clap.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
}

/*EmitSound( channel, sample[], Float:vol, Float:att,flags, pitch )
{
new players[32], index, num, i;
get_players( players, num, "c" );

for( i = 0; i < num; i++ )
{
index = players[ i ];
if( !is_user_connected( index ) )
continue;

emit_sound( index, channel, sample, vol, att, flags, pitch );
}
} */

Fade( index, duration, holdtime, flags, red, green, blue, alpha )
{
message_begin( MSG_ONE_UNRELIABLE, g_msgscreenfade, { 0, 0, 0 }, index );
write_short( duration );
write_short( holdtime );
write_short( flags );
write_byte( red );
write_byte( green );
write_byte( blue );
write_byte( alpha );
message_end();
}

Icon( index, mode=2, const sprite[], red=0, green=255, blue=0 )
{
message_begin( MSG_ONE, g_msgstatusicon, { 0, 0, 0 }, index );
write_byte( mode );
write_string( sprite );
write_byte( red );
write_byte( green );
write_byte( blue );
message_end();
}

lights( const light[] ) return engfunc( EngFunc_LightStyle, 0, light );

rebeccs
06-09-2010, 11:04 PM
This is the cs for the use of gvfs fuse daemon Day of Defeat use

Dr.G
06-10-2010, 09:39 AM
.rar removed. I wasnt able to open it. Dont use China letters, and attach it like all other plugins. Some description would help too!

Try again.. This thread is here by trashed and closed.


- Cheers