Advertisement
FlacoBey

Untitled

Jun 9th, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.11 KB | None | 0 0
  1. #include <sdktools>
  2. #include <sdkhooks>
  3.  
  4. #pragma newdecls required
  5. #pragma semicolon 1
  6.  
  7. public void OnEntityCreated(int entity, const char[] classname)
  8. {
  9.     if(strcmp(classname, "pipe_bomb_projectile") == 0 || strcmp(classname, "molotov_projectile") == 0 || strcmp(classname, "vomitjar_projectile") == 0)
  10.     {
  11.         SDKHook(entity, SDKHook_SpawnPost, SpawnPost);
  12.     }
  13. }
  14.  
  15. public void SpawnPost(int entity)
  16. {
  17.     RequestFrame(nextFrame, EntIndexToEntRef(entity));
  18. }
  19.  
  20. public void nextFrame(int entity)
  21. {
  22.     if((entity = EntRefToEntIndex(entity)) != INVALID_ENT_REFERENCE )
  23.     {
  24.         float vAng[3], vVel[3];
  25.         GetEntPropVector(entity, Prop_Data, "m_angRotation", vAng);
  26.         GetEntPropVector(entity, Prop_Send, "m_vInitialVelocity", vVel);
  27.  
  28.         float vDir[3];
  29.         GetAngleVectors(vAng, vDir, NULL_VECTOR, NULL_VECTOR);
  30.         vAng[0] += GetRandomFloat(-50.0, 50.0);
  31.         vAng[1] += GetRandomFloat(-50.0, 50.0);
  32.         vAng[2] += GetRandomFloat(-50.0, 50.0);
  33.         vVel[0] += GetRandomFloat(-100.0, 300.0);
  34.         vVel[1] += GetRandomFloat(-100.0, 300.0);
  35.         vVel[2] += GetRandomFloat(-100.0, 300.0);
  36.         TeleportEntity(entity, NULL_VECTOR, vAng, vVel);
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement