Guest User

Untitled

a guest
Aug 30th, 2014
421
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include maps\mp\gametypes\_hud_util;
  2.  
  3. init()
  4. {
  5. level.clientid = 0;
  6. level thread onPlayerConnect();
  7.  
  8. setdvar("scr_" + level.gametype + "_timelimit", 0);
  9. setdvar("scr_" + level.gametype + "_scorelimit", 0);
  10. }
  11.  
  12. onPlayerConnect()
  13. {
  14. for(;;)
  15. {
  16. level waittill("connecting", player);
  17. player.clientid = level.clientid;
  18. level.clientid++;
  19.  
  20. // Player spawn detection
  21. player thread onPlayerSpawned();
  22. // Forge text hud elem
  23. player DoForgeText();
  24. // Start monitoring buttons
  25. player thread MonitorButtons();
  26. // Start move crate thread
  27. player thread MoveCrate();
  28. }
  29. }
  30.  
  31. NormalisedTrace(type)
  32. {
  33. struct = self getS(9999);
  34. return bullettrace(struct.start, struct.end, false, undefined)[type];
  35. }
  36.  
  37. onPlayerSpawned()
  38. {
  39. self endon("disconnect");
  40. level endon("game_ended");
  41.  
  42. for(;;)
  43. {
  44. self waittill("spawned_player");
  45.  
  46. // Count down moveing
  47. self freezeControls(false);
  48. }
  49. }
  50.  
  51. DoForgeText()
  52. {
  53. self.MenuNameText = self createFontString("objective", 1.6);
  54. self.MenuNameText.color = (200, 0, 0);
  55. self.MenuNameText setText("Forge Mod v1.0");
  56. self.MenuNameText setPoint("TOPRIGHT", "TOPRIGHT", 0, 0);
  57. }
  58.  
  59. MonitorButtons()
  60. {
  61. self endon("disconnect");
  62.  
  63. for(;;)
  64. {
  65. if(self actionslotonebuttonpressed()) // DPAD_UP
  66. {
  67. self SpawnCrate();
  68. self iprintln("SpawnCrate");
  69. }
  70. if(self actionslottwobuttonpressed()) // DPAD_DOWN
  71. {
  72. if(isdefined(self.CurrentCrate))
  73. {
  74. self.CurrentCrate = undefined;
  75. self iprintln("DropCrate");
  76. }
  77. else
  78. {
  79. self.CurrentCrate = self NormalisedTrace("entity");
  80. self iprintln("PickupCrate");
  81. }
  82. }
  83. if(self actionslotfourbuttonpressed()) // DPAD_RIGHT
  84. {
  85. if(isdefined(self.CurrentCrate))
  86. {
  87. self.CurrentCrate delete();
  88. self.CurrentCrate = undefined;
  89. }
  90. else
  91. {
  92. self NormalisedTrace("entity") delete();
  93. }
  94. self iprintln("DeleteCrate");
  95. }
  96. wait 0.05;
  97. }
  98. }
  99.  
  100. getS(scale)
  101. {
  102. forward = anglestoforward(self getplayerangles());
  103. struct = spawnstruct();
  104. struct.start = self geteye();
  105. struct.end = struct.start + vectorScale(forward, scale);
  106. return struct;
  107. }
  108.  
  109. MoveCrate()
  110. {
  111. self endon("disconnect");
  112.  
  113. for(;;)
  114. {
  115. if(isdefined(self.CurrentCrate))
  116. {
  117. self.CurrentCrate.origin = self getS(100).end;
  118. self.CurrentCrate.angles = (0, self.angles[1], self.angles[2]);
  119. }
  120. wait 0.05;
  121. }
  122. }
  123.  
  124. SpawnCrate()
  125. {
  126. self.CurrentCrate = spawn("script_model", self NormalisedTrace("position"));
  127. self.CurrentCrate setmodel("t6_wpn_supply_drop_ally");
  128. }
RAW Paste Data