Advertisement
Guest User

Castle

a guest
Apr 11th, 2009
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.82 KB | None | 0 0
  1. forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
  2. forward FixHour(hour);
  3. forward SFAirPort();
  4.  
  5. new sfarg1, sfarg2, sfars1, sfars2, sfars3, sfars4, sfareStatus = 1, sfarg1Status = 1, sfarg2Status = 1;
  6. new timeshift = -1;
  7.  
  8. public OnFilterScriptInit()
  9. {
  10.     sfarg1 = CreateStreamedObject(989, -1547.597900, -428.788361, 6.815458, 0.0000, 0.0000, 241.9707);//SF Air Port Gate1
  11.     sfarg2 = CreateStreamedObject(989, -1543.697266, -432.671570, 6.815458, 0.0000, 0.0000, 241.9707);//SF Air Port Gate2
  12.     sfars1 = CreateStreamedObject(10184, -1394.588013, -267.306000, 7.521763, 0.0000, 0.0000, 270.0000);//SF Air Port Parking Gate1
  13.     sfars2 = CreateStreamedObject(10184, -1394.588013, -267.306000, 12.238979, 179.9087, 0.0000, 270.0000);//SF Air Port Parking Gate1 Higher
  14.     sfars3 = CreateStreamedObject(10184, -1417.434326, -267.306000, 7.489068, 0.0000, 0.0000, 270.0000);//SF Air Port Parking Gate2
  15.     sfars4 = CreateStreamedObject(10184, -1417.434326, -267.306000, 12.238979, 179.9087, 0.0000, 270.0000);//SF Air Port Parking Gate2 Higher
  16.     return 1;
  17. }
  18.  
  19. public OnFilterScriptExit()
  20. {
  21.     DestroyObjectsCreatedByMe();
  22.     return 1;
  23. }
  24.  
  25. public OnPlayerSpawn(playerid)
  26. {
  27.     new hour, minute, second;
  28.     gettime(hour, minute, second);
  29.     FixHour(hour+8);
  30.     if(hour>6 || hour<24)
  31.     {
  32.         if(PlayerToPoint(20, playerid, -1547.597900, -428.788361, 6.815458))
  33.         {
  34.             if(sfareStatus == 1)
  35.             {
  36.                 MoveStreamedObject(sfarg1, -1551.483276, -424.904022, 6.815458,3);
  37.                 MoveStreamedObject(sfarg2, -1539.796509, -436.567444, 6.815458,3);
  38.                 sfareStatus = 0;
  39.                 SetTimer("SFAirPort", 5000, false);
  40.                 return 1;
  41.             }
  42.         }
  43.         if(PlayerToPoint(20, playerid, -1394.588013, -267.306000, 7.521763))
  44.         {
  45.             if(sfarg1Status == 1)
  46.             {
  47.                 MoveStreamedObject(sfars1, -1394.588013, -267.306000, 14.263948,3);
  48.                 MoveStreamedObject(sfars2, -1394.588013, -267.306000, 18.981164,3);
  49.                 sfarg1Status = 0;
  50.                 SetTimer("SFAirPort", 5000, false);
  51.                 return 1;
  52.             }
  53.         }
  54.         if(PlayerToPoint(20, playerid, -1417.434326, -267.306000, 7.489068))
  55.         {
  56.             if(sfarg2Status == 1)
  57.             {
  58.                 MoveStreamedObject(sfars3, -1417.457764, -267.306000, 14.263948,3);
  59.                 MoveStreamedObject(sfars4, -1417.457764, -267.306000, 18.981164,3);
  60.                 sfarg2Status = 0;
  61.                 SetTimer("SFAirPort", 5000, false);
  62.                 return 1;
  63.             }
  64.         }
  65.     }
  66.     return 1;
  67. }
  68.  
  69. public SFAirPort()
  70. {
  71.     if(sfareStatus == 0)
  72.     {
  73.         MoveStreamedObject(sfarg1, -1547.597900, -428.788361, 6.815458,3);
  74.         MoveStreamedObject(sfarg2, -1543.697266, -432.671570, 6.815458,3);
  75.         sfareStatus = 1;
  76.         return 1;
  77.     }
  78.     if(sfarg1Status == 0)
  79.     {
  80.         MoveStreamedObject(sfars1, -1394.588013, -267.306000, 7.521763,3);
  81.         MoveStreamedObject(sfars2, -1394.588013, -267.306000, 12.238979,3);
  82.         sfarg1Status = 1;
  83.         return 1;
  84.     }
  85.     if(sfarg2Status == 0)
  86.     {
  87.         MoveStreamedObject(sfars3, -1417.457764, -267.306000, 7.521763,3);
  88.         MoveStreamedObject(sfars4, -1417.457764, -267.306000, 12.238979,3);
  89.         sfarg2Status = 1;
  90.         return 1;
  91.     }
  92.     return 1;
  93. }
  94.    
  95.  
  96. public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
  97. {
  98.     if(IsPlayerConnected(playerid))
  99.     {
  100.         new Float:oldposx, Float:oldposy, Float:oldposz;
  101.         new Float:tempposx, Float:tempposy, Float:tempposz;
  102.         GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  103.         tempposx = (oldposx -x);
  104.         tempposy = (oldposy -y);
  105.         tempposz = (oldposz -z);
  106.         //printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
  107.         if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  108.         {
  109.             return 1;
  110.         }
  111.     }
  112.     return 0;
  113. }
  114.  
  115. public FixHour(hour)
  116. {
  117.     hour = timeshift+hour;
  118.     if (hour < 0)
  119.     {
  120.         hour = hour+24;
  121.     }
  122.     else if (hour > 23)
  123.     {
  124.         hour = hour-24;
  125.     }
  126.     return 1;
  127. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement