Advertisement
FlacoBey

Чтобы от грена машины отлетали

Jun 20th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.23 KB | None | 0 0
  1. #pragma semicolon 1
  2. #pragma newdecls required
  3.  
  4. #include sdktools
  5.  
  6. public void OnEntityDestroyed(int entity)
  7. {
  8.     if(IsValidEntity(entity) && IsValidEdict(entity))
  9.     {
  10.         char sWeaponEx[56];
  11.         GetEntityClassname(entity, sWeaponEx, sizeof(sWeaponEx));
  12.        
  13.         if(strcmp(sWeaponEx, "grenade_launcher_projectile") == 0)
  14.         {
  15.             float vPos[3];
  16.             GetEntPropVector(entity, Prop_Send, "m_vecOrigin", vPos);
  17.             PointPush(vPos, 850.0, 900.0);
  18.         }
  19.         else if(strcmp(sWeaponEx, "pipe_bomb_projectile") == 0)
  20.         {
  21.             float vPos[3];
  22.             GetEntPropVector(entity, Prop_Send, "m_vecOrigin", vPos);
  23.             PointPush(vPos, 850.0, 900.0);
  24.         }
  25.     }
  26. }
  27.  
  28. public void PointPush(float center[3], float force, float radius)
  29. {
  30.     int push = CreateEntityByName("point_push");
  31.     DispatchKeyValueFloat(push, "magnitude", force);
  32.     DispatchKeyValueFloat(push, "radius", radius);
  33.     DispatchKeyValueFloat(push, "inner_radius", force*2);
  34.     DispatchKeyValue(push, "spawnflags", "24");
  35.     DispatchSpawn(push);
  36.     TeleportEntity(push, center, NULL_VECTOR, NULL_VECTOR);
  37.     AcceptEntityInput(push, "Enable", -1, -1);
  38.     CreateTimer(0.1, DeletePushForce, push);
  39. }
  40.  
  41. public Action DeletePushForce(Handle timer, int push)
  42. {
  43.     if(IsValidEntity(push))
  44.         AcceptEntityInput(push, "kill");
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement