Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- /* ===[CONFIGURATION]=== */
- #define MAX_PLAY 16 //Slots on your server
- #define COVER_SPEED 1 //Speed that the cover will move at (1 is realistic)
- #define USE_SOUND true //Change to 0 to disable the sounds
- //Do not edit below here
- #define COVER_STATE_STILL 0
- #define COVER_STATE_MOVING 1
- new LABROOF; //Cover object ID
- new bool:openlab; //Is area 69 jetpack cover open/closed
- new moving; //Variable to detect if the cover is moving
- public OnFilterScriptInit()
- {
- LABROOF = CreateObject(3095, 268.350677, 1883.572875, 16.076126, 0, 0, 0);
- return 1;
- }
- public OnFilterScriptExit()
- {
- DestroyObject(LABROOF);
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if(!strcmp(cmdtext, "/cover", true)) //Example of using it
- {
- if(IsLabCoverOpen()) CloseLabCover();
- else OpenLabCover();
- }
- if(!strcmp(cmdtext, "/stop", true)) //Example of using StopLabCover()
- {
- if(GetLabCoverState() == COVER_STATE_STILL) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: Cover not moving.");
- StopLabCover();
- if(openlab == true) openlab = false;
- else openlab = true;
- return 1;
- }
- return 0;
- }
- public OnObjectMoved(objectid)
- {
- if(objectid == LABROOF)
- {
- #if USE_SOUND == true
- for(new i=0; i<MAX_PLAY; i++) PlayerPlaySound(i,1154 ,268.350677, 1883.572875, 16.076126); //Closed sound
- #endif
- moving = COVER_STATE_STILL; //Object is not moving
- }
- return 1;
- }
- stock OpenLabCover()
- {
- openlab = true; //Cover now open (or opening)
- moving = COVER_STATE_MOVING; //Object is moving
- MoveObject(LABROOF, 268.350677, 1875.572875, 16.076126, COVER_SPEED); //Move the object
- #if USE_SOUND == true
- for(new i=0; i<MAX_PLAY; i++) PlayerPlaySound(i,1153 ,268.350677, 1883.572875, 16.076126); //Opening sound
- #endif
- return 1;
- }
- stock CloseLabCover()
- {
- openlab = false; //Cover now closed (or closing)
- moving = COVER_STATE_MOVING; //Object is moving
- MoveObject(LABROOF, 268.350677, 1883.572875, 16.076126, COVER_SPEED); //Move the object
- #if USE_SOUND == true
- for(new i=0; i<MAX_PLAY; i++) PlayerPlaySound(i,1153 ,268.350677, 1883.572875, 16.076126); //Closing sound
- #endif
- return 1;
- }
- stock StopLabCover()
- {
- StopObject(LABROOF); //Stop the object
- moving = COVER_STATE_STILL; //Object is not moving
- #if USE_SOUND == true
- for(new i=0; i<MAX_PLAY; i++) PlayerPlaySound(i,1154 ,268.350677, 1883.572875, 16.076126); //Stopped sound
- #endif
- return 1;
- }
- stock IsLabCoverOpen() return openlab;
- stock GetLabCoverState() return moving;
Advertisement
Add Comment
Please, Sign In to add comment