Guest User

Moving Gate by Spongegar

a guest
Jun 29th, 2016
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.22 KB | None | 0 0
  1. //#define FILTERSCRIPT
  2. #include <a_samp>
  3. #if defined FILTERSCRIPT
  4.  
  5. public OnFilterScriptInit()
  6. {
  7. print("\n--------------------------------------");
  8. print("Moving Gate by Spongegar");
  9. print("--------------------------------------\n");
  10. return 1;
  11. }
  12.  
  13. public OnFilterScriptExit()
  14. {
  15. return 1;
  16. }
  17.  
  18. #else
  19. new nb;
  20. new sb;
  21. main()
  22. {
  23.  
  24. }
  25. #endif
  26.  
  27. //NorthBound Closing Blocker
  28. forward close();
  29. public close ()//close for North Bound Gate
  30. {
  31. MoveObject(nb, 1839.9758300,-3562.6206100,24.8720000,4); //after 4 seconds of opened gate it will now closed and will return to it's original position. Closed Position.
  32. return 1;
  33. }
  34. //Southbound Closing Blocker
  35. forward close2();
  36. public close2 ()
  37. {
  38. MoveObject(sb, 1852.3601100,-3552.4511700,24.8720000,4);//after 4 seconds of opened gate it will now closed and will return to it's original position. Closed Position.
  39. return 1;
  40. }
  41.  
  42. public OnGameModeInit()
  43. {
  44. nb = CreateObject(3578,1839.9758300,-3562.6206100,24.8720000,0.0000000,0.0000000,90.0000000); // North Bound Closed Blocker/Original Position
  45. sb = CreateObject(3578,1852.3601100,-3552.4511700,24.8720000,0.0000000,0.0000000,90.0000000); // South Bound Closed Blocker /Original Position
  46. return 1;
  47. }
  48.  
  49. public OnPlayerUpdate(playerid)//placed here so every millisecond the script will detect player's movement
  50. {
  51. if(IsPlayerInRangeOfPoint(playerid, 5, 1839.9758300,-3562.6206100,24.8720000)) //Range/area same with the Gate
  52. {
  53. MoveObject(nb, 1839.9956, -3562.6233, 23.4365,3); // if the player is in range/area this line will move the gate's Z position in other words the gates will lower in order to open. This is now the OPEN Position of gate
  54. SetTimer("close", 4000, 0);//Timer before closing (4,000 milliseconds = 4 seconds) and will call the close function
  55. }
  56. if(IsPlayerInRangeOfPoint(playerid, 5, 1852.3601,-3552.4512,24.8720000))//Range/area same with the Gate
  57. {
  58. MoveObject(sb, 1852.3601, -3552.4512, 23.3609, 3);// if the player is in range/area this line will move the gate's Z position in other words the gates will lower in order to open. This is now the OPEN Position of gate
  59. SetTimer("close2", 4000, 0);//Timer before closing (4,000 milliseconds = 4 seconds) and will call the close2 function
  60. }
  61. return 1;
  62. }
Advertisement
Add Comment
Please, Sign In to add comment