Advertisement
errur

Decoy thing

Apr 20th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.16 KB | None | 0 0
  1. decoy_model <- @"models/weapons/w_eq_decoy_thrown.mdl";
  2. decoy_duration <- 10
  3.  
  4. function Precache()
  5. {
  6.     self.PrecacheModel(decoy_model);
  7. }
  8.  
  9. function Think()
  10. {
  11.     local decoy = null;
  12.     while((decoy = Entities.FindByClassname(decoy, "decoy_projectile")) != null)
  13.     {
  14.         if(decoy.GetVelocity().Length() == Vector(0,0,0).Length())
  15.         {          
  16.             gunfire <- Entities.CreateByClassname("env_gunfire");
  17.             //gunfire.__KeyValueFromInt("iMinBurstSize", 50);
  18.             //gunfire.__KeyValueFromInt("iMaxBurstSize", 50);
  19.             //gunfire.__KeyValueFromInt("iMinDelayBetweenBursts", 50);
  20.             //gunfire.__KeyValueFromInt("iMaxDelayBetweenBursts", 50);
  21.             //gunfire.__KeyValueFromString("Weapon", Nova);                                            
  22.            
  23.             local origin = decoy.GetOrigin();
  24.             local angles = decoy.GetAngles();
  25.            
  26.             local model = CreateProp("prop_dynamic_override", origin, decoy_model, 0);         
  27.             model.SetAngles(angles.x, angles.y, angles.z);
  28.            
  29.             gunfire.SetOrigin(origin);
  30.             decoy.Destroy();
  31.             EntFireByHandle(gunfire, "Enable","",0.1, null, null);
  32.            
  33.             EntFireByHandle(gunfire, "Kill", "", decoy_duration, null, null);
  34.             EntFireByHandle(model, "Kill", "", decoy_duration, null, null);
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement