Advertisement
Guest User

Vantri goal entity...

a guest
Sep 2nd, 2015
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. SpawnGoalEntity(number)
  2. {
  3. new Float:fMins[3], Float:fMaxs[3];
  4. decl Float:goalOrigin[3]
  5. switch(number)
  6. {
  7. case 1: Zone_GetZonePosition("goal_red", false, goalOrigin, fMins, fMaxs);
  8. case 2: Zone_GetZonePosition("goal_blue", false, goalOrigin, fMins, fMaxs);
  9. }
  10. new Float:fMiddle[3];
  11. new goalEntity = CreateEntityByName("prop_dynamic")
  12. DispatchKeyValue(goalEntity, "spawnflags", "64");
  13.  
  14. DispatchKeyValue(goalEntity, "solid", "2");
  15. DispatchKeyValue(goalEntity, "StartDisabled", "0")
  16. GetMiddleOfABox(fMins, fMaxs, fMiddle);
  17. TeleportEntity(goalEntity , fMiddle, NULL_VECTOR, NULL_VECTOR)
  18. DispatchKeyValue(goalEntity, "model", "models/props_c17/woodbarrel001_static.mdl")
  19. // Have the mins always be negative
  20. fMins[0] = fMins[0] - fMiddle[0];
  21. if(fMins[0] > 0.0)
  22. fMins[0] *= -1.0;
  23. fMins[1] = fMins[1] - fMiddle[1];
  24. if(fMins[1] > 0.0)
  25. fMins[1] *= -1.0;
  26. fMins[2] = fMins[2] - fMiddle[2];
  27. if(fMins[2] > 0.0)
  28. fMins[2] *= -1.0;
  29.  
  30. // And the maxs always be positive
  31. fMaxs[0] = fMaxs[0] - fMiddle[0];
  32. if(fMaxs[0] < 0.0)
  33. fMaxs[0] *= -1.0;
  34. fMaxs[1] = fMaxs[1] - fMiddle[1];
  35. if(fMaxs[1] < 0.0)
  36. fMaxs[1] *= -1.0;
  37. fMaxs[2] = fMaxs[2] - fMiddle[2];
  38. if(fMaxs[2] < 0.0)
  39. fMaxs[2] *= -1.0;
  40.  
  41. SetEntPropVector(goalEntity, Prop_Send, "m_vecMins", fMins);
  42. SetEntPropVector(goalEntity, Prop_Send, "m_vecMaxs", fMaxs);
  43. new iEffects = GetEntProp(goalEntity, Prop_Send, "m_fEffects");
  44. iEffects |= 32;
  45. SetEntProp(goalEntity, Prop_Send, "m_fEffects", iEffects);
  46. return goalEntity
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement