Guest User

Untitled

a guest
Nov 12th, 2012
694
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.31 KB | None | 0 0
  1. public CBaseWeapon_TraceAttack_Post( pEntity, iAttacker, Float:flDamage, Float:fDir[3], ptr, iDamageType)
  2. {
  3. new iDecal = GUNSHOT_DECALS[ random_num( 0 , sizeof( GUNSHOT_DECALS ) - 1 ) ];
  4.  
  5.  
  6. new Float:vecEnd[3], Float:vecPlane[3]
  7.  
  8. get_tr2(ptr, TR_vecEndPos, vecEnd);
  9. get_tr2(ptr, TR_vecPlaneNormal, vecPlane);
  10.  
  11. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  12. write_byte(TE_GUNSHOTDECAL)
  13. write_coord_f(vecEnd[0])
  14. write_coord_f(vecEnd[1])
  15. write_coord_f(vecEnd[2])
  16. write_short(pEntity)
  17. write_byte(iDecal)
  18. message_end()
  19.  
  20.  
  21. pEntity = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "env_sprite"))
  22.  
  23.  
  24. xs_vec_mul_scalar(vecPlane, 60.0, vecPlane);
  25. xs_vec_add(vecEnd, vecPlane, vecEnd);
  26.  
  27.  
  28. entity_set_origin(pEntity, vecEnd)
  29.  
  30. entity_set_model(pEntity, WEAPON_TRACE_EFFECT)
  31.  
  32. entity_set_int(pEntity, EV_INT_solid, SOLID_NOT)
  33. entity_set_int(pEntity, EV_INT_movetype, MOVETYPE_NOCLIP)
  34.  
  35. entity_set_float(pEntity, EV_FL_animtime, get_gametime())
  36. entity_set_float(pEntity, EV_FL_framerate, 40.0)
  37. set_pev(pEntity, pev_scale, 0.5)
  38.  
  39.  
  40. set_pev(pEntity, pev_spawnflags, SF_SPRITE_ONCE)
  41.  
  42.  
  43. // Set velocity
  44. new Float:vecVelocity[3], Float:vecRight[3], Float:vecUp[3];
  45.  
  46. engfunc(EngFunc_VecToAngles, vecPlane, vecPlane );
  47.  
  48. vector_to_angle(vecPlane, vecPlane);
  49.  
  50. angle_vector(vecPlane,ANGLEVECTOR_RIGHT,vecRight)
  51. angle_vector(vecPlane,ANGLEVECTOR_UP,vecUp)
  52.  
  53. vecVelocity[0] *= 32.0;
  54. vecVelocity[1] *= 32.0;
  55. vecVelocity[2] *= 32.0;
  56.  
  57. new Float:flRandomVec = random_float(0.0, 64.0) * random_float(-1.0, 1.0);
  58.  
  59. vecRight[0] *= flRandomVec;
  60. vecRight[1] *= flRandomVec;
  61. vecRight[2] *= flRandomVec;
  62.  
  63. flRandomVec = random_float(0.0, 64.0) * random_float(-1.0, 1.0);
  64.  
  65. vecUp[0] *= flRandomVec;
  66. vecUp[1] *= flRandomVec;
  67. vecUp[2] *= flRandomVec;
  68.  
  69. vecVelocity[0] += vecRight[0] + vecUp[0];
  70. vecVelocity[1] += vecRight[1] + vecUp[1];
  71. vecVelocity[2] += vecRight[2] + vecUp[2];
  72.  
  73. set_pev(pEntity, pev_velocity, vecVelocity);
  74.  
  75. DispatchSpawn(pEntity);
  76.  
  77. entity_set_int(pEntity, EV_INT_movetype, MOVETYPE_NOCLIP)
  78.  
  79. set_pev(pEntity, pev_rendermode, kRenderTransAdd)
  80.  
  81. set_pev(pEntity, pev_renderamt, 27.0)
  82.  
  83. entity_set_float(pEntity, EV_FL_animtime, get_gametime())
  84.  
  85. entity_set_float(pEntity, EV_FL_nextthink, get_gametime() + 0.025);
  86.  
  87. return HAM_IGNORED;
  88. }
Advertisement
Add Comment
Please, Sign In to add comment