Guest User

Castle

a guest
Apr 6th, 2009
690
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 7.57 KB | None | 0 0
  1. /*
  2. Jack Sparrow's AKA Castle Area 51 Gates V2
  3. if you are using this Filterscript Please leave credit
  4. */
  5. #include <a_samp>
  6.  
  7. forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
  8. forward ObjectTimers();
  9. #define COLOR_LIGHTRED  0xFF6347AA//LightRed
  10. //#define COLOR_GREED       0x33AA33AA//Greed
  11.  
  12. new aGate, agStatus = 1;//Area 51 Entrance Gate
  13. new aGate2, ag2Status = 1;//Area 51 Garage Shutter
  14. new aLift, aLift2, aLift3, aLift4, alStatus = 1;//Area 51 Lift
  15. new aObj1, aObj2;//Area 51 Objects: Guard Tower, Eastern Blockade
  16.  
  17. public OnFilterScriptInit()
  18. {
  19.     print(" ");
  20.     print("______________________________");
  21.     print("|                            |");
  22.     print("|        ==>Castle<==        |");
  23.     print("|         [FS]Area51         |");
  24.     print("|    Filter Script Loaded    |");
  25.     print("|                            |");
  26.     print("|____________________________|");
  27.     print(" ");
  28.     aGate = CreateObject(985, 96.669350, 1920.033936, 18.855873, 0.0000, 0.0000, 90.0000);//Area 51 Entrance Gate
  29.     aGate2 = CreateObject(10184, 214.337631, 1875.739136, 13.162411, 0.0000, 0.0000, 270.0000);//Area 51 Garage Shutter
  30.     aLift = CreateObject(985, 281.667694, 1821.519043, 16.701317, 270.6186, 0.0000, 270.0000);//Area 51 Lift Object1
  31.     aLift2 = CreateObject(986, 290.248383, 1821.519043, 16.651318, 270.6186, 0.0000, 90.0000);//Area 51 Lift Object2
  32.     aLift3 = CreateObject(985, 275.712830, 1821.519043, 16.701317, 270.6186, 0.0000, 270.0000);//Area 51 Lift Object3
  33.     aLift4 = CreateObject(986, 296.168213, 1821.519043, 16.701317, 270.6186, 0.0000, 90.0000);//Area 51 Lift Object4
  34.     aObj1 = CreateObject(3279, 103.999695, 1932.790771, 16.758234, 0.0000, 0.0000, 0.0000);//Area 51 Guard Tower
  35.     aObj2 = CreateObject(987, 340.080139, 1794.643188, 15.133865, 0.0000, 0.0000, 33.7500);//Area 51 Eastern Blockade
  36.     return 1;
  37. }
  38.  
  39. public OnFilterScriptExit()
  40. {
  41.     print(" ");
  42.     print("______________________________");
  43.     print("|                            |");
  44.     print("|        ==>Castle<==        |");
  45.     print("|         [FS]Area51         |");
  46.     print("|   Filter Script Unloaded   |");
  47.     print("|                            |");
  48.     print("|____________________________|");
  49.     print(" ");
  50.     DestroyObject(aGate);
  51.     DestroyObject(aGate2);
  52.     DestroyObject(aLift);
  53.     DestroyObject(aLift2);
  54.     DestroyObject(aLift3);
  55.     DestroyObject(aLift4);
  56.     DestroyObject(aObj1);
  57.     DestroyObject(aObj2);
  58.     return 1;
  59. }
  60.  
  61. public OnPlayerCommandText(playerid, cmdtext[])
  62. {
  63.     if(strcmp(cmdtext, "/gate", true) == 0)
  64.     {
  65.         if(GetPlayerSkin(playerid) == 287)
  66.         {
  67.             if(PlayerToPoint(15, playerid, 96.669350, 1920.033936, 18.855873))//Aread 51 Entrance Gate
  68.             {
  69.                 if(agStatus == 1)
  70.                 {
  71.                     MoveObject(aGate, 96.669350, 1925.953735, 18.855873, 4);
  72.                     SendClientMessage(playerid, 0x33AA33AA, "Area51 Gate Open, don't forget to close it!");
  73.                     agStatus = 0;
  74.                     SetTimer("ObjectTimers", 5000, false);
  75.                     return 1;
  76.                 }
  77.             }
  78.             if(PlayerToPoint(10, playerid, 214.337631, 1875.739136, 13.162411))//Area 51 Garage Shutter
  79.             {
  80.                 if(ag2Status == 1)
  81.                 {
  82.                     MoveObject(aGate2, 214.337631, 1875.739136, 9.000, 4);
  83.                     SendClientMessage(playerid, 0x33AA33AA, "Area51 Garage Open, don't forget to close it!");
  84.                     ag2Status = 0;
  85.                     SetTimer("ObjectTimers", 5000, false);
  86.                     return 1;
  87.                 }
  88.             }
  89.             else{ SendClientMessage(playerid, COLOR_LIGHTRED, "You are too far away from the Gate/Garage"); return 1; }
  90.         }
  91.         else{ SendClientMessage(playerid, COLOR_LIGHTRED, "You aren't a Soldier"); return 1; }
  92.     }
  93.     if(strcmp(cmdtext, "/lift", true) == 0)
  94.     {
  95.         if(GetPlayerSkin(playerid) == 287)
  96.         {
  97.             if(PlayerToPoint(25, playerid, 281.667694, 1821.519043, 16.701317))//Area 51 Lift
  98.             {
  99.                 if(alStatus == 1)
  100.                 {
  101.                     MoveObject(aLift, 281.667694, 1821.519043, 23.451214, 4);
  102.                     MoveObject(aLift2, 290.248383, 1821.519043, 23.451214, 4);
  103.                     MoveObject(aLift3, 275.712830, 1821.519043, 23.451214, 4);
  104.                     MoveObject(aLift4, 296.168213, 1821.519043, 23.451214, 4);
  105.                     SendClientMessage(playerid, 0x33AA33AA, "Area51 Lift Going Up");
  106.                     alStatus = 0;
  107.                     SetTimer("ObjectTimers", 5000, false);
  108.                     return 1;
  109.                 }
  110.             }
  111.             else{ SendClientMessage(playerid, COLOR_LIGHTRED, "You are too far away from the Elevator"); return 1; }
  112.         }
  113.         else{ SendClientMessage(playerid, COLOR_LIGHTRED, "You aren't a Soldier"); return 1; }
  114.     }
  115. /*  if(strcmp(cmdtext, "/area51", true) == 0)
  116.     {
  117.         SetPlayerPos(playerid, 90.669350, 1920.033936, 18.855873);
  118.         return 1;
  119.     }*/
  120.     return 1;
  121. }
  122.  
  123. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  124. {
  125.     if(newkeys == KEY_FIRE)//RMB or Ctrl
  126.     {
  127.         if(GetPlayerSkin(playerid) == 287)
  128.         {
  129.             if(PlayerToPoint(15, playerid, 96.669350, 1920.033936, 18.855873))//Aread 51 Entrance Gate
  130.             {
  131.                 if(agStatus == 1)
  132.                 {
  133.                     MoveObject(aGate, 96.669350, 1925.953735, 18.855873, 4);
  134.                     SendClientMessage(playerid, 0x33AA33AA, "Area51 Gate Open, don't forget to close it!");
  135.                     agStatus = 0;
  136.                     SetTimer("ObjectTimers", 5000, false);
  137.                     return 1;
  138.                 }
  139.             }
  140.             if(PlayerToPoint(10, playerid, 214.337631, 1875.739136, 13.162411))//Area 51 Garage Shutter
  141.             {
  142.                 if(ag2Status == 1)
  143.                 {
  144.                     MoveObject(aGate2, 214.337631, 1875.739136, 9.000, 4);
  145.                     SendClientMessage(playerid, 0x33AA33AA, "Area51 Garage Open, don't forget to close it!");
  146.                     ag2Status = 0;
  147.                     SetTimer("ObjectTimers", 5000, false);
  148.                     return 1;
  149.                 }
  150.             }
  151.             if(PlayerToPoint(25, playerid, 281.667694, 1821.519043, 16.701317))//Area 51 Lift
  152.             {
  153.                 if(alStatus == 1)
  154.                 {
  155.                     MoveObject(aLift, 281.667694, 1821.519043, 23.451214, 4);
  156.                     MoveObject(aLift2, 290.248383, 1821.519043, 23.451214, 4);
  157.                     MoveObject(aLift3, 275.712830, 1821.519043, 23.451214, 4);
  158.                     MoveObject(aLift4, 296.168213, 1821.519043, 23.451214, 4);
  159.                     SendClientMessage(playerid, 0x33AA33AA, "Area51 Lift Going Up");
  160.                     alStatus = 0;
  161.                     SetTimer("ObjectTimers", 5000, false);
  162.                     return 1;
  163.                 }
  164.             }
  165.             else{ SendClientMessage(playerid, COLOR_LIGHTRED, "You are too far away from the Gate/Garage/Elevator"); return 1; }
  166.         }
  167.         else{ SendClientMessage(playerid, COLOR_LIGHTRED, "You aren't a Soldier"); return 1; }
  168.     }
  169.     return 1;
  170. }
  171.  
  172. public ObjectTimers()
  173. {
  174.     if(agStatus == 0)
  175.     {
  176.         MoveObject(aGate, 96.669350, 1920.033936, 18.855873, 4);
  177.         agStatus = 1;
  178.         return 1;
  179.     }
  180.     if(ag2Status == 0)
  181.     {
  182.         MoveObject(aGate2, 214.337631, 1875.739136, 13.162411, 4);
  183.         ag2Status = 1;
  184.         return 1;
  185.     }
  186.     if(alStatus == 0)
  187.     {
  188.         MoveObject(aLift, 281.667694, 1821.519043, 16.701317, 4);
  189.         MoveObject(aLift2, 290.248383, 1821.519043, 16.701317, 4);
  190.         MoveObject(aLift3, 275.712830, 1821.519043, 16.701317, 4);
  191.         MoveObject(aLift4, 296.168213, 1821.519043, 16.701317, 4);
  192.         alStatus = 1;
  193.         return 1;
  194.     }
  195.     return 1;
  196. }
  197.  
  198. public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
  199. {
  200.     if(IsPlayerConnected(playerid))
  201.     {
  202.         new Float:oldposx, Float:oldposy, Float:oldposz;
  203.         new Float:tempposx, Float:tempposy, Float:tempposz;
  204.         GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  205.         tempposx = (oldposx -x);
  206.         tempposy = (oldposy -y);
  207.         tempposz = (oldposz -z);
  208.         if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  209.         {
  210.             return 1;
  211.         }
  212.     }
  213.     return 0;
  214. }
Advertisement
Add Comment
Please, Sign In to add comment