Veteran Member
Join Date: Jan 2010
Location: mom's basement
04-01-2016
, 17:50
Re: [CSS] Hook grenade explosion
#4
I forget to say more, compare coordinates between event and projectiles.
Spoiler
PHP Code:
/* "hegrenade_detonate" { "userid" "short" "x" "float" "y" "float" "z" "float" } "flashbang_detonate" { "userid" "short" "x" "float" "y" "float" "z" "float" } "smokegrenade_detonate" { "userid" "short" "x" "float" "y" "float" "z" "float" } */ #include <sdktools> public OnPluginStart () { HookEventEx ( "hegrenade_detonate" , grenade ); HookEventEx ( "flashbang_detonate" , grenade ); HookEventEx ( "smokegrenade_detonate" , grenade ); } public grenade ( Handle : event , const String : eventname [], bool : dontBroadcast ) { //new userid = GetEventInt(event, "userid"); //new client = GetClientOfUserId(userid); new m_hThrower ; new Float : xyz [ 3 ], Float : pos [ 3 ]; xyz [ 0 ] = GetEventFloat ( event , "x" ); xyz [ 1 ] = GetEventFloat ( event , "y" ); xyz [ 2 ] = GetEventFloat ( event , "z" ); new ent = MaxClients + 1 ; new String : clsname [ 30 ]; strcopy ( clsname , sizeof ( clsname ), eventname ); ReplaceString ( clsname , sizeof ( clsname ), "_detonate" , "_projectile" ); while( ( ent = FindEntityByClassname ( ent , clsname )) != - 1 ) { GetEntPropVector ( ent , Prop_Data , "m_vecOrigin" , pos ); m_hThrower = GetEntPropEnt ( ent , Prop_Send , "m_hThrower" ); if(! FloatCompare ( xyz [ 0 ], pos [ 0 ]) && ! FloatCompare ( xyz [ 1 ], pos [ 1 ]) && ! FloatCompare ( xyz [ 2 ], pos [ 2 ])) { if( 0 < m_hThrower <= MaxClients ) { PrintToChatAll ( "%N - %s %f %f %f" , m_hThrower , clsname , pos [ 0 ], pos [ 1 ], pos [ 2 ]); } else { PrintToChatAll ( "NULL - %s %f %f %f" , clsname , pos [ 0 ], pos [ 1 ], pos [ 2 ]); } break; } } }
__________________
Do not Private Message @me
Last edited by Bacardi; 04-01-2016 at 18:01 .