[code=php]#include < amxmodx >
#include < message_const >
new const PLUGIN_NAME[ ] = "New effects from damage",
PLUGIN_VERSION[ ] = "2.0",
PLUGIN_AUTHOR[ ] = "YONTU";
/* Aici stergi "//" din fata liniei daca vrei sa ti se coloreze imaginea cand faci un anumit dmg victimei */
#define FADE_SCREEN
// Don't change; These are messages
#define TE_BEAMTORUS 19 // Screen aligned beam ring, expands to max radius over lifetime
#define TE_BEAMDISK 20 // Disk that expands to max radius over lifetime
#define TE_BEAMCYLINDER 21 // Cylinder that expands to max radius over lifetime
// Cvars
new g_cvarShakeScreenEffectsOn, g_cvarTypeEffects;
// Var
new ShockWave;
// Random Color( Red, Green, Blue )
new const RandomColorRed[ ] = {
0,
255,
29,
127,
216,
157,
147,
195,
88,
50,
103,
118,
93,
52,
183
}
new const RandomColorGreen[ ] = {
0,
255,
242,
127,
88,
242,
147,
195,
216,
178,
103,
76,
237,
85,
160
}
new const RandomColorBlue[ ] = {
255,
0,
114,
239,
29,
189,
195,
216,
50,
188,
33,
238,
128,
27,
196
}
public plugin_init( ) {
register_plugin( PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR );
register_event( "Damage", "event_Damage", "b", "2!0", "3=0", "4!0" );
g_cvarShakeScreenEffectsOn = register_cvar( "nde_shakescreen_on", "1" );
g_cvarTypeEffects = register_cvar( "nde_type_effects", "2" );
}
public plugin_precache( )
ShockWave = precache_model( "sprites/shockwave.spr" );
public event_Damage( id ) {
static iAttacker;
static fDamage;
iAttacker = get_user_attacker( id );
fDamage = read_data( 2 );
if( get_user_team( iAttacker ) == get_user_team( id ) || !is_user_alive( iAttacker ) )
return 1;
if( fDamage > 0 ) {
switch( get_pcvar_num( g_cvarTypeEffects ) ) {
case 0: { // TE_BEAMTORUS
if( get_pcvar_num( g_cvarShakeScreenEffectsOn ) )
ShakeScreen( id, 3.0 );
new g_iColor[ 3 ];
g_iColor[ 0 ] = RandomColorRed[ random_num( 0, charsmax( RandomColorRed ) ) ];
g_iColor[ 1 ] = RandomColorGreen[ random_num( 0, charsmax( RandomColorGreen ) ) ];
g_iColor[ 2 ] = RandomColorBlue[ random_num( 0, charsmax( RandomColorBlue ) ) ];
new iOrigin[ 3 ];
get_user_origin( id, iOrigin, 0 );
UTIL_CreateBeamCylinder( iOrigin, 19, 60, ShockWave, 0, 0, 4, 70, 0, g_iColor[ 0 ], g_iColor[ 1 ], g_iColor[ 2 ], 255, 0 );
#if defined FADE_SCREEN
FadeScreen( iAttacker, 1.5, g_iColor[ 1 ], g_iColor[ 0 ], g_iColor[ 2 ], 153 );
#endif
}
case 1: { // TE_BEAMDISK
if( get_pcvar_num( g_cvarShakeScreenEffectsOn ) )
ShakeScreen( id, 3.0 );
new g_iColor[ 3 ];
g_iColor[ 0 ] = RandomColorRed[ random_num( 0, charsmax( RandomColorRed ) ) ];
g_iColor[ 1 ] = RandomColorGreen[ random_num( 0, charsmax( RandomColorGreen ) ) ];
g_iColor[ 2 ] = RandomColorBlue[ random_num( 0, charsmax( RandomColorBlue ) ) ];
new iOrigin[ 3 ];
get_user_origin( id, iOrigin, 0 );
UTIL_CreateBeamCylinder( iOrigin, 20, 135, ShockWave, 0, 0, 4, 70, 0, g_iColor[ 0 ], g_iColor[ 1 ], g_iColor[ 2 ], 255, 0 );
#if defined FADE_SCREEN
FadeScreen( iAttacker, 1.5, g_iColor[ 1 ], g_iColor[ 0 ], g_iColor[ 2 ], 153 );
#endif
}
case 2: { // TE_BEAMCYLINDER
if( get_pcvar_num( g_cvarShakeScreenEffectsOn ) )
ShakeScreen( id, 3.0 );
new g_iColor[ 3 ];
g_iColor[ 0 ] = RandomColorRed[ random_num( 0, charsmax( RandomColorRed ) ) ];
g_iColor[ 1 ] = RandomColorGreen[ random_num( 0, charsmax( RandomColorGreen ) ) ];
g_iColor[ 2 ] = RandomColorBlue[ random_num( 0, charsmax( RandomColorBlue ) ) ];
new iOrigin[ 3 ];
get_user_origin( id, iOrigin, 0 );
UTIL_CreateBeamCylinder( iOrigin, 21, 60, ShockWave, 0, 0, 4, 70, 0, g_iColor[ 0 ], g_iColor[ 1 ], g_iColor[ 2 ], 255, 0 );
#if defined FADE_SCREEN
FadeScreen( iAttacker, 1.5, g_iColor[ 1 ], g_iColor[ 0 ], g_iColor[ 2 ], 153 );
#endif
}
}
}
return 0;
}
public ShakeScreen( id, const Float:iSeconds ) {
message_begin( MSG_ONE, get_user_msgid( "ScreenShake" ), { 0, 0, 0 }, id );
write_short( floatround( 4096.0 * iSeconds, floatround_round ) );
write_short( floatround( 4096.0 * iSeconds, floatround_round ) );
write_short( 1<<13 );
message_end( );
}
#if defined FADE_SCREEN
stock FadeScreen( id, const Float:iSeconds, const iRed, const iGreen, const iBlue, const iAlpha ) {
message_begin( MSG_ONE, get_user_msgid( "ScreenFade" ), _, id );
write_short( floatround( 4096.0 * iSeconds, floatround_round ) );
write_short( floatround( 4096.0 * iSeconds, floatround_round ) );
write_short( 0x0000 );
write_byte( iRed );
write_byte( iGreen );
write_byte( iBlue );
write_byte( iAlpha );
message_end( );
}
#endif
stock UTIL_CreateBeamCylinder( iOrigin[ 3 ], iTE, iRadius, iSprite, iStartFrate, iFrameRate, iLife, iWidth, iAmplitude, Red, Green, Blue, iBrightness, iSpeed ) {
message_begin( MSG_ALL, SVC_TEMPENTITY, iOrigin );
write_byte( iTE );
write_coord( iOrigin[ 0 ] );
write_coord( iOrigin[ 1 ] );
write_coord( iOrigin[ 2 ] );
write_coord( iOrigin[ 0 ] );
write_coord( iOrigin[ 1 ] );
write_coord( iOrigin[ 2 ] + iRadius );
write_short( iSprite );
write_byte( iStartFrate );
write_byte( iFrameRate );
write_byte( iLife );
write_byte( iWidth );
write_byte( iAmplitude );
write_byte( Red );
write_byte( Green );
write_byte( Blue );
write_byte( iBrightness );
write_byte( iSpeed );
message_end( );
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1048\\ f0\\ fs16 \n\\ par }
*/ [/code]