Guest User

Untitled

a guest
Sep 15th, 2009
417
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.56 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. /* ===[CONFIGURATION]=== */
  4. #define MAX_PLAY 16 //Slots on your server
  5. #define COVER_SPEED 1 //Speed that the cover will move at (1 is realistic)
  6. #define USE_SOUND true //Change to 0 to disable the sounds
  7.  
  8. //Do not edit below here
  9. #define COVER_STATE_STILL 0
  10. #define COVER_STATE_MOVING 1
  11.  
  12. new LABROOF; //Cover object ID
  13. new bool:openlab; //Is area 69 jetpack cover open/closed
  14. new moving; //Variable to detect if the cover is moving
  15.  
  16. public OnFilterScriptInit()
  17. {
  18. LABROOF = CreateObject(3095, 268.350677, 1883.572875, 16.076126, 0, 0, 0);
  19. return 1;
  20. }
  21.  
  22. public OnFilterScriptExit()
  23. {
  24. DestroyObject(LABROOF);
  25. return 1;
  26. }
  27.  
  28. public OnPlayerCommandText(playerid, cmdtext[])
  29. {
  30. if(!strcmp(cmdtext, "/cover", true)) //Example of using it
  31. {
  32. if(IsLabCoverOpen()) CloseLabCover();
  33. else OpenLabCover();
  34. }
  35. if(!strcmp(cmdtext, "/stop", true)) //Example of using StopLabCover()
  36. {
  37. if(GetLabCoverState() == COVER_STATE_STILL) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: Cover not moving.");
  38. StopLabCover();
  39. if(openlab == true) openlab = false;
  40. else openlab = true;
  41. return 1;
  42. }
  43. return 0;
  44. }
  45.  
  46. public OnObjectMoved(objectid)
  47. {
  48. if(objectid == LABROOF)
  49. {
  50. #if USE_SOUND == true
  51. for(new i=0; i<MAX_PLAY; i++) PlayerPlaySound(i,1154 ,268.350677, 1883.572875, 16.076126); //Closed sound
  52. #endif
  53. moving = COVER_STATE_STILL; //Object is not moving
  54. }
  55. return 1;
  56. }
  57.  
  58. stock OpenLabCover()
  59. {
  60. openlab = true; //Cover now open (or opening)
  61. moving = COVER_STATE_MOVING; //Object is moving
  62. MoveObject(LABROOF, 268.350677, 1875.572875, 16.076126, COVER_SPEED); //Move the object
  63. #if USE_SOUND == true
  64. for(new i=0; i<MAX_PLAY; i++) PlayerPlaySound(i,1153 ,268.350677, 1883.572875, 16.076126); //Opening sound
  65. #endif
  66. return 1;
  67. }
  68.  
  69. stock CloseLabCover()
  70. {
  71. openlab = false; //Cover now closed (or closing)
  72. moving = COVER_STATE_MOVING; //Object is moving
  73. MoveObject(LABROOF, 268.350677, 1883.572875, 16.076126, COVER_SPEED); //Move the object
  74. #if USE_SOUND == true
  75. for(new i=0; i<MAX_PLAY; i++) PlayerPlaySound(i,1153 ,268.350677, 1883.572875, 16.076126); //Closing sound
  76. #endif
  77. return 1;
  78. }
  79.  
  80. stock StopLabCover()
  81. {
  82. StopObject(LABROOF); //Stop the object
  83. moving = COVER_STATE_STILL; //Object is not moving
  84. #if USE_SOUND == true
  85. for(new i=0; i<MAX_PLAY; i++) PlayerPlaySound(i,1154 ,268.350677, 1883.572875, 16.076126); //Stopped sound
  86. #endif
  87. return 1;
  88. }
  89.  
  90. stock IsLabCoverOpen() return openlab;
  91. stock GetLabCoverState() return moving;
Advertisement
Add Comment
Please, Sign In to add comment