Advertisement
Guest User

Untitled

a guest
May 4th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.04 KB | None | 0 0
  1. //na górze kodu:
  2. new ObiektBrama;
  3. new bool:BramaOtwarta = false;
  4. new BramaTimer = 0;
  5. new Hedge[9];
  6.  
  7. //w OnGameModeInit:
  8. ObiektBrama = CreateDynamicObject(971, 1003.05469, -644.46228, 124.12270, 0.00000, 0.00000, 202.50000);
  9. Hedge[0] = CreateDynamicObject(19450, 994.09442, -647.58691, 125.32930, 0.00000, 0.00000, -69.00000);
  10. Hedge[1] = CreateDynamicObject(19450, 985.13251, -650.99402, 125.32930, 0.00000, 0.00000, -69.00000);
  11. Hedge[2] = CreateDynamicObject(19450, 976.53876, -655.19031, 125.32930, 0.00000, 0.00000, -59.16000);
  12. Hedge[3] = CreateDynamicObject(19450, 968.27069, -660.12183, 125.32930, 0.00000, 0.00000, -59.16000);
  13. Hedge[4] = CreateDynamicObject(19450, 960.00513, -665.05450, 125.32930, 0.00000, 0.00000, -59.16000);
  14. Hedge[5] = CreateDynamicObject(19450, 951.74170, -669.98712, 125.32930, 0.00000, 0.00000, -59.16000);
  15. Hedge[6] = CreateDynamicObject(19450, 1011.52808, -646.25287, 124.42931, 0.00000, 0.00000, 37.44000);
  16. Hedge[7] = CreateDynamicObject(19450, 1017.38470, -653.90143, 124.42930, 0.00000, 0.00000, 37.44000);
  17. Hedge[8] = CreateDynamicObject(19450, 1023.24408, -661.54761, 124.42930, 0.00000, 0.00000, 37.44000);
  18. SetDynamicObjectMaterial(Hedge[0], 0, 13805, "bevcunto2_lahills", "aamanbev96x", 0xFFFFFFFF);
  19. SetDynamicObjectMaterial(Hedge[1], 0, 13805, "bevcunto2_lahills", "aamanbev96x", 0xFFFFFFFF);
  20. SetDynamicObjectMaterial(Hedge[2], 0, 13805, "bevcunto2_lahills", "aamanbev96x", 0xFFFFFFFF);
  21. SetDynamicObjectMaterial(Hedge[3], 0, 13805, "bevcunto2_lahills", "aamanbev96x", 0xFFFFFFFF);
  22. SetDynamicObjectMaterial(Hedge[4], 0, 13805, "bevcunto2_lahills", "aamanbev96x", 0xFFFFFFFF);
  23. SetDynamicObjectMaterial(Hedge[5], 0, 13805, "bevcunto2_lahills", "aamanbev96x", 0xFFFFFFFF);
  24. SetDynamicObjectMaterial(Hedge[6], 0, 13805, "bevcunto2_lahills", "aamanbev96x", 0xFFFFFFFF);
  25. SetDynamicObjectMaterial(Hedge[7], 0, 13805, "bevcunto2_lahills", "aamanbev96x", 0xFFFFFFFF);
  26. SetDynamicObjectMaterial(Hedge[8], 0, 13805, "bevcunto2_lahills", "aamanbev96x", 0xFFFFFFFF);
  27.  
  28.  
  29. //Gdzieś na dole kodu:
  30. CMD:brama(playerid)
  31. {
  32. if(GetPlayerDistanceFromPoint(playerid, 1003.1, -644.5, 124.12270) < 10)
  33. {
  34. if(BramaTimer)
  35. KillTimer(BramaTimer);
  36.  
  37. if(BramaOtwarta)
  38. {
  39. BramaTimer = SetTimerEx("PrzesunBrame", 20, true, "d", false); //Zamykanie bramy
  40. BramaOtwarta = false;
  41. }
  42. else
  43. {
  44. BramaTimer = SetTimerEx("PrzesunBrame", 20, true, "d", true); //Otwieranie bramy
  45. BramaOtwarta = true;
  46. }
  47. }
  48.  
  49. return 1;
  50. }
  51.  
  52. forward PrzesunBrame(bool:czy_otwiera); //Jeśli true - otwieramy bramę; jeśli false - zamykamy bramę
  53. public PrzesunBrame(bool:czy_otwiera)
  54. {
  55. new Float:pos[3];
  56. GetDynamicObjectPos(ObiektBrama, pos[0], pos[1], pos[2]);
  57.  
  58. if(czy_otwiera && pos[0]<=996.1 || !czy_otwiera && pos[0]>=1003.1) //Czyli skończyła się już otwierać/zamykać
  59. {
  60. KillTimer(BramaTimer);
  61. BramaTimer = 0;
  62. return 1;
  63. }
  64.  
  65. if(czy_otwiera)
  66. SetDynamicObjectPos(ObiektBrama, pos[0]-0.07, pos[1]-0.028, pos[2]);
  67. else
  68. SetDynamicObjectPos(ObiektBrama, pos[0]+0.07, pos[1]+0.028, pos[2]);
  69.  
  70. return 1;
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement