Guest User

Untitled

a guest
Mar 2nd, 2008
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.53 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. #if defined _w_Gates_included
  4. #endinput
  5. #endif
  6. #define _w_Gates_included
  7. #pragma library w_Gates
  8.  
  9. /*
  10. native AddLSPDGate();
  11. native OpenLSPDGate(playerid,Float:Speed, bool: autoclose, time);
  12. native CloseLSPDGate(playerid,Float:Speed);
  13. native
  14. native AddSFPDGate();
  15. native OpenSFPDGate(playerid,Float:Speed, bool: autoclose, time);
  16. native CloseSFPDGate(playerid,Float:Speed);
  17. native
  18. native AddLVPDGate();
  19. native OpenLVPDGate(playerid,Float:Speed, bool: autoclose, time);
  20. native CloseLvPDGate(playerid,Float:Speed);
  21. */
  22.  
  23. new lsgate, sfgate1, sfgate2, lvgate1, lvgate2;
  24. new LS, SF, LV;
  25. #define COLOR_RED 0xAA3333AA
  26. forward CloseLS(Float:Speed);
  27. forward CloseSF(Float:Speed);
  28. forward CloseLV(Float:Speed);
  29. forward CloseLV2(Float:Speed);
  30. forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
  31.  
  32. stock AddLSPDGate()
  33. {
  34. lsgate = CreateObject(971,1589.022,-1638.016,14.950,0.0,0.0,-180.000);
  35. }
  36.  
  37. stock OpenLSPDGate(playerid,Float:Speed, autoclose, time)
  38. {
  39. if(PlayerToPoint(25.0,playerid,1589.022,-1638.016,14.950) == 1)
  40. {
  41. KillTimer(LS);
  42. MoveObject(lsgate,1596.933,-1638.044,14.924,Float:Speed);
  43. if(autoclose == 1)
  44. {
  45. LS = SetTimerEx("CloseLS",time,0,"f",Float:Speed);
  46. }
  47. }
  48. else
  49. {
  50. SendClientMessage(playerid,COLOR_RED,"Not near LSPD");
  51. }
  52. }
  53.  
  54. stock CloseLSPDGate(playerid,Float:Speed)
  55. {
  56. if(PlayerToPoint(25.0,playerid,1589.022,-1638.016,14.950) == 1)
  57. {
  58. KillTimer(LS);
  59. MoveObject(lsgate,1589.022,-1638.016,14.950,Float:Speed);
  60. }
  61. }
  62.  
  63. public CloseLS(Float:Speed)
  64. {
  65. MoveObject(lsgate,1589.022,-1638.016,14.950,Float:Speed);
  66. }
  67.  
  68.  
  69.  
  70. stock AddSFPDGate()
  71. {
  72. sfgate1 = CreateObject(986,-1627.624,688.599,7.898,0.0,0.0,-180.000);
  73. sfgate2 = CreateObject(985,-1635.789,688.605,7.898,0.0,0.0,-180.000);
  74. }
  75.  
  76. stock OpenSFPDGate(playerid,Float:Speed, autoclose, time)
  77. {
  78. if(PlayerToPoint(25.0,playerid,-1627.624,688.599,7.898) == 1)
  79. {
  80. KillTimer(SF);
  81. MoveObject(sfgate1,-1619.688,688.579,7.901,Float:Speed);
  82. MoveObject(sfgate2,-1643.742,688.616,7.867,Float:Speed);
  83. if(autoclose == 1)
  84. {
  85. SF = SetTimerEx("CloseSF",time,0,"f",Float:Speed);
  86. }
  87. }
  88. else
  89. {
  90. SendClientMessage(playerid,COLOR_RED,"Not near SFPD");
  91. }
  92. }
  93.  
  94. stock CloseSFPDGate(playerid,Float:Speed)
  95. {
  96. if(PlayerToPoint(25.0,playerid,-1627.624,688.599,7.898) == 1)
  97. {
  98. KillTimer(SF);
  99. MoveObject(sfgate1,-1627.624,688.599,7.898,Float:Speed);
  100. MoveObject(sfgate2,-1635.789,688.605,7.898,Float:Speed);
  101. }
  102. }
  103.  
  104. public CloseSF(Float:Speed)
  105. {
  106. MoveObject(sfgate1,-1627.624,688.599,7.898,Float:Speed);
  107. MoveObject(sfgate2,-1635.789,688.605,7.898,Float:Speed);
  108. }
  109.  
  110.  
  111. stock AddLVPDGate()
  112. {
  113. lvgate1 = CreateObject(971,2293.811,2499.461,5.817,0.0,0.0,-90.000);
  114. lvgate2 = CreateObject(971,2334.822,2443.358,8.180,0.0,0.0,59.688);
  115. }
  116.  
  117. stock OpenLVPDGate(playerid,Float:Speed, autoclose, time)
  118. {
  119. if(PlayerToPoint(25.0,playerid,2293.888,2499.231,10.711) == 1)
  120. {
  121. KillTimer(LV);
  122. MoveObject(lvgate1,2293.888,2499.231,10.711,Float:Speed);
  123. if(autoclose == 1)
  124. {
  125. LV = SetTimerEx("CloseLV",time,0,"f",Float:Speed);
  126. }
  127. }
  128.  
  129. else if(PlayerToPoint(25.0,playerid,2339.147,2450.821,8.166) == 1)
  130. {
  131. KillTimer(LV);
  132. MoveObject(lvgate2,2339.147,2450.821,8.166,Float:Speed);
  133. if(autoclose == 1)
  134. {
  135. LV = SetTimerEx("CloseLV2",time,0,"f",Float:Speed);
  136. }
  137. }
  138. else
  139. {
  140. SendClientMessage(playerid,COLOR_RED,"Not near LVPD");
  141. }
  142. }
  143.  
  144. stock CloseLVPDGate(playerid,Float:Speed)
  145. {
  146. if(PlayerToPoint(25.0,playerid,2293.811,2499.461,5.817) == 1)
  147. {
  148. KillTimer(LV);
  149. MoveObject(lvgate1,2293.811,2499.461,5.817,Float:Speed);
  150. }
  151. else if(PlayerToPoint(25.0,playerid,2339.147,2450.821,8.166) == 1)
  152. {
  153. KillTimer(LV);
  154. MoveObject(lvgate2,2334.822,2443.358,8.180,Float:Speed);
  155. }
  156. }
  157.  
  158. public CloseLV(Float:Speed)
  159. {
  160. MoveObject(lvgate1,2293.811,2499.461,5.817,Float:Speed);
  161. }
  162.  
  163. public CloseLV2(Float:Speed)
  164. {
  165. MoveObject(lvgate2,2334.822,2443.358,8.180,Float:Speed);
  166. }
  167.  
  168.  
  169. public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z) // by denver / astro
  170. {
  171. new Float:oldposx, Float:oldposy, Float:oldposz;
  172. new Float:tempposx, Float:tempposy, Float:tempposz;
  173. GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  174. tempposx = (oldposx -x);
  175. tempposy = (oldposy -y);
  176. tempposz = (oldposz -z);
  177. if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  178. {
  179. return 1;
  180. }
  181. return 0;
  182. }
  183.  
  184.  
Advertisement
Add Comment
Please, Sign In to add comment