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

Death Effects


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sn3amtz
Senior Member
Join Date: Jan 2015
Location: France
Old 12-20-2015 , 01:37   Death Effects
Reply With Quote #1

I want to add more sprites

"sprites/flares/flare8.spr",
"sprites/flares/flare9.spr",
"sprites/flares/flare10.spr"

not working

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

#define PLUGIN "New Plugin"
#define VERSION "1.0"

#define	MAX_FLARES	7


new const g_szFlares[ MAX_FLARES ][ ] =
{
    "sprites/flares/flare1.spr",
    "sprites/flares/flare2.spr",
    "sprites/flares/flare3.spr",
    "sprites/flares/flare4.spr",
    "sprites/flares/flare5.spr",
    "sprites/flares/flare6.spr",
    "sprites/flares/flare7.spr"
}

new g_iFlares[ MAX_FLARES ];

public plugin_precache( )
{
	for( new i = 0; i < MAX_FLARES; i++ )
		g_iFlares[ i ] = precache_model( g_szFlares[ i ] );
}

public plugin_init( )
{
	register_plugin(PLUGIN, VERSION, "Askhanar" );
	register_event(  "DeathMsg",  "EventDeathMsg",  "a"  );
	
	// Add your code here...
	
}

public EventDeathMsg(  )
{	
	
	new iKiller  = read_data(  1  );
	new iVictim  = read_data(  2  );
	
	if( iVictim  !=  iKiller )
	{
		new Float:fOrigin[ 3 ], iOrigin[ 3 ];
		pev( iVictim, pev_origin, fOrigin );
		FVecIVec( fOrigin, iOrigin );
		
		UTIL_CreateFlares( iOrigin, g_iFlares[ random( MAX_FLARES ) ], random_num( 30, 50 ), random_num( 10, 15 ), random_num( 5, 8 ) );
	}
}

stock UTIL_CreateFlares( const iOrigin[ 3 ], const iSpriteID, const iCount, const iLife, const iScale )
{
	message_begin( MSG_BROADCAST,SVC_TEMPENTITY );
	write_byte( TE_SPRITETRAIL );
	write_coord( iOrigin[ 0 ] );				// start position (X)
	write_coord( iOrigin[ 1 ] );				// start position (Y)
	write_coord( iOrigin[ 2 ] );				// start position (Z)
	write_coord( iOrigin[ 0 ] );				// end position (X)
	write_coord( iOrigin[ 1 ] );				// end position (Y)
	write_coord( iOrigin[ 2 ] + random_num( 40, 50 ) );	// end position (Z)
	write_short( iSpriteID );				// sprite index
	write_byte( iCount );					// numarul de bule
	write_byte( iLife );					// life in 0.1's
	write_byte( iScale );					// scale in 0.1's
	write_byte( random_num( 200, 200 ) );				// velocity along vector in 10's
	write_byte( random_num( 10, 15 ) );				// randomness of velocity in 10's
	message_end( );
}
Sn3amtz is offline
addons_zz
Veteran Member
Join Date: Aug 2015
Location: Dreams, zz
Old 12-20-2015 , 02:30   Re: Death Effects
Reply With Quote #2

Please, attach a .sma file when posting a code.

This should work:

Code:
#include <amxmodx> #include <fakemeta> #define PLUGIN "New Plugin" #define VERSION "1.0" #define MAX_FLARES   10 new const g_szFlares[ MAX_FLARES ][ ] = {     "sprites/flares/flare1.spr",     "sprites/flares/flare2.spr",     "sprites/flares/flare3.spr",     "sprites/flares/flare4.spr",     "sprites/flares/flare5.spr",     "sprites/flares/flare6.spr",     "sprites/flares/flare7.spr",     "sprites/flares/flare8.spr",     "sprites/flares/flare9.spr",     "sprites/flares/flare10.spr" } new g_iFlares[ MAX_FLARES ]; public plugin_precache( ) {     for( new i = 0; i < MAX_FLARES; i++ )         g_iFlares[ i ] = precache_model( g_szFlares[ i ] ); } public plugin_init( ) {     register_plugin(PLUGIN, VERSION, "Askhanar" );     register_event(  "DeathMsg""EventDeathMsg""a"  ); } public EventDeathMsg(  ) {            new iKiller  = read_data(  1  );     new iVictim  = read_data(  2  );         if( iVictim  !=  iKiller )     {         new Float:fOrigin[ 3 ], iOrigin[ 3 ];         pev( iVictim, pev_origin, fOrigin );         FVecIVec( fOrigin, iOrigin );                 UTIL_CreateFlares( iOrigin, g_iFlares[ random( MAX_FLARES ) ], random_num( 30, 50 ), random_num( 10, 15 ), random_num( 5, 8 ) );     } } stock UTIL_CreateFlares( const iOrigin[ 3 ], const iSpriteID, const iCount, const iLife, const iScale ) {     message_begin( MSG_BROADCAST,SVC_TEMPENTITY );     write_byte( TE_SPRITETRAIL );     write_coord( iOrigin[ 0 ] );                // start position (X)     write_coord( iOrigin[ 1 ] );                // start position (Y)     write_coord( iOrigin[ 2 ] );                // start position (Z)     write_coord( iOrigin[ 0 ] );                // end position (X)     write_coord( iOrigin[ 1 ] );                // end position (Y)     write_coord( iOrigin[ 2 ] + random_num( 40, 50 ) )// end position (Z)     write_short( iSpriteID );            // sprite index     write_byte( iCount );               // numarul de bule     write_byte( iLife );                    // life in 0.1's     write_byte( iScale );               // scale in 0.1's     write_byte( random_num( 200, 200 ) );            // velocity along vector in 10's     write_byte( random_num( 10, 15 ) );    // randomness of velocity in 10's     message_end( ); }
Attached Files
File Type: sma Get Plugin or Get Source (death_effects.sma - 533 views - 2.1 KB)

Last edited by addons_zz; 12-20-2015 at 02:33. Reason: spelling fixes
addons_zz is offline
Sn3amtz
Senior Member
Join Date: Jan 2015
Location: France
Old 12-20-2015 , 02:33   Re: Death Effects
Reply With Quote #3

And For more? This is changeable?
define MAX_FLARES 10
Great Thank you

Last edited by Sn3amtz; 12-20-2015 at 02:38.
Sn3amtz is offline
addons_zz
Veteran Member
Join Date: Aug 2015
Location: Dreams, zz
Old 12-20-2015 , 02:39   Re: Death Effects
Reply With Quote #4

Quote:
Originally Posted by Sn3amtz View Post
And For more? This is changeable?
define MAX_FLARES 10
Sure, for as many as you want. Read here (Macro definition and expansion) about it.

Last edited by addons_zz; 12-20-2015 at 02:40. Reason: spelling fixes
addons_zz 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 19:41.


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