Advertisement
Guest User

MyScript

a guest
Oct 3rd, 2015
395
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.39 KB | None | 0 0
  1. //This is only executed when the map is loaded for the first time.
  2. //Only happens once. Can be used for adding effects and callbacks that should not repeat.//
  3.  
  4.  
  5. void OnStart()
  6. {
  7. AddUseItemCallback("", "Crowbar", "DoorCrowbar", "UseCrowbarOnDoor", true);
  8. AddEntityCollideCallback(""CrowbarJoint", "AreaBreak", "BreakDoor", true, 1);
  9. }
  10.  
  11. void UseCrowbarOnDoor(string &in asItem, string &in asEntity)
  12. {
  13. RemoveItem(asItem);
  14. PlaySoundAtEntity("", "player_crouch.snt", "Player", 0.05, false);
  15. AddTimer(asEntity, 0.2, "TimerPlaceCrowbar");
  16. }
  17.  
  18. void TimerPlaceCrowbar(string &in asTimer)
  19. {
  20. SetEntityActive("CrowbarJoint", true);
  21. PlaySoundAtEntity("", "puzzle_place_jar.snt", asTimer, 0.05, false);
  22. }
  23.  
  24. void BreakDoor(string &in asParent, string &in asChild, int alState)
  25. {
  26. SetEntityActive("CrowbarJoint", false);
  27. SetEntityActive("CrowbarBroken", true);
  28.  
  29. SetSwingDoorLocked("DoorCrowbar", false, false);
  30. SetSwingDoorClosed("DoorCrowbar", false, false);
  31. SetSwingDoorDisableAutoClose("DoorCrowbar", true);
  32.  
  33. AddPropImpulse("DoorCrowbar", 0, 0, 3, "world");
  34.  
  35. CreateParticleSystemAtEntity("", "ps_hit_wood.ps", "AreaEffect", false);
  36. PlaySoundAtEntity("", "break_wood_metal", "AreaEffect", 0, false);
  37.  
  38. GiveSanityBoostSmall();
  39.  
  40. PlayMusic("10_puzzle01.ogg", false, 0.7, 0.1, 10, false);
  41.  
  42. AddTimer("", 0.1, "TimerPushDoor");
  43. }
  44.  
  45. void TimerPushDoor(string &in asTimer)
  46. {
  47. AddPropImpulse("DoorCrowbar", -4, 2, 1, "world");
  48. AddTimer("", 1.1, "TimerDoorCanClose");
  49. }
  50.  
  51. void TimerDoorCanClose(string &in asTimer)
  52. {
  53. SetSwingDoorDisableAutoClose("DoorCrowbar", false);
  54. }
  55.  
  56. void InteractPassage(string &in asEntity)
  57. {
  58. int interactCount = GetLocalVarInt("HitCount");
  59.  
  60. AddLocalVarInt("HitCount", 1);
  61. AddTimer("", 0.7, "DecreaseHitCount");
  62.  
  63. CreateParticleSystemAtEntity("", "ps_dust_impact.ps", "AreaParticle_" + RandInt(1, 4), false);
  64. if (interactCount == 3)
  65. {
  66. SetPropHealth("WallPassage", 0);
  67. }
  68.  
  69. if (GetTimerTimeLeft("limitsound") == 0)
  70. {
  71. AddTimer("limitsound", 0.7, "");
  72. PlayGuiSound("impact_rock_low3.ogg", 1);
  73. PlayGuiSound("15_rock_break", 1);
  74. }
  75. }
  76.  
  77. void DecreaseHitCount(string &in asTimer)
  78. {
  79. AddLocalVarInt("HitCount", -1);
  80. }
  81.  
  82. void BreakWall(string &in asEntity, string &in type)
  83. {
  84. GiveSanityBoostSmall();
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement