Guest User

LS Parkplatz [Filterscript]

a guest
Sep 8th, 2011
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.15 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. #define FILTERSCRIPT
  4.  
  5. #if defined FILTERSCRIPT
  6.  
  7. #define COLOR_RED 0xAA3333AA
  8. #define COLOR_GREEN 0x33AA33AA
  9. new Gate;
  10. new EnterCarTimer;
  11. new ExitCarTimer;
  12. new CloseParkTimer;
  13. new Ticket;
  14. forward ClosePark();
  15. forward EnterParkText();
  16. forward ExitParkText();
  17. forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
  18.  
  19. public OnFilterScriptInit()
  20. {
  21. print("\n=============== Filterscript ===============");
  22. print(" Los Santos Parkplatz - by Crypt");
  23. print("============================================\n");
  24.  
  25. //Zaun etc.
  26. CreateObject(982, 1101.9345703125, -1764.2861328125, 13.20042514801, 0, 0, 0);
  27. CreateObject(982, 1089.10546875, -1777.107421875, 13.199911117554, 0, 0, 90);
  28. CreateObject(982, 1089.0148925781, -1735.7530517578, 13.417594909668, 0, 0, 90);
  29. CreateObject(982, 1071.4642333984, -1735.7451171875, 13.370635986328, 0, 0, 90);
  30. CreateObject(982, 1071.5245361328, -1777.1121826172, 13.200019836426, 0, 0, 90);
  31. CreateObject(982, 1058.69140625, -1764.2805175781, 13.251355171204, 0, 0, 0);
  32. CreateObject(982, 1058.6650390625, -1748.4953613281, 13.302135467529, 0, 0, 0);
  33. CreateObject(983, 1101.9666748047, -1749.9284667969, 13.22520160675, 0, 0, 0);
  34. CreateObject(4641, 1103.6424560547, -1747.7600097656, 14.262054443359, 0, 0, 180);
  35. //---
  36. CreateObject(970, 1085.2596435547, -1748.0795898438, 12.968771934509, 0, 0, 0);
  37. CreateObject(970, 1080.828125, -1748.0407714844, 12.979933738708, 0, 0, 0);
  38. CreateObject(970, 1076.4321289063, -1748.0556640625, 12.990538597107, 0, 0, 0);
  39. CreateObject(970, 1076.4425048828, -1752.8205566406, 12.95593547821, 0, 0, 0);
  40. CreateObject(970, 1085.2845458984, -1752.9266357422, 12.938941955566, 0, 0, 0);
  41. CreateObject(970, 1080.8505859375, -1752.9403076172, 12.945717811584, 0, 0, 0);
  42. CreateObject(970, 1087.3603515625, -1750.4136962891, 12.939476966858, 0, 0, 90);
  43. CreateObject(970, 1074.3697509766, -1750.4799804688, 12.974703788757, 0, 0, 90);
  44. //---
  45. CreateObject(1251, 1103.3505859375, -1741.0686035156, 12.592844009399, 0, 0, 0);
  46.  
  47. //Schranke
  48. Gate = CreateObject(979, 1101.9207763672, -1741.2805175781, 13.345894813538, 0, 0, 270);
  49. EnterCarTimer = SetTimer("EnterParkText", 3000, 1);
  50. ExitCarTimer = SetTimer("ExitParkText",3000,1);
  51. CloseParkTimer = SetTimer("ClosePark",10000,1);
  52. return 1;
  53. }
  54.  
  55. public OnFilterScriptExit()
  56. {
  57. KillTimer(EnterCarTimer);
  58. KillTimer(ExitCarTimer);
  59. KillTimer(CloseParkTimer);
  60. return 1;
  61. }
  62.  
  63. #else
  64.  
  65. main()
  66. {
  67. print("\n=============== Filterscript ===============");
  68. print(" Parkplatz in LS - By Crypt ");
  69. print("============================================\n");
  70. }
  71.  
  72. #endif
  73.  
  74.  
  75.  
  76.  
  77.  
  78. public OnPlayerCommandText(playerid, cmdtext[])
  79. {
  80. //Parkplatz reinfahren
  81. if(strcmp(cmdtext, "/openp", true) == 0)
  82. {
  83. if (PlayerToPoint(5.0, playerid, 1102.2005615234, -1741.8996582031, 13.353673934937))
  84. {
  85. MoveObject(Gate, 1102.2005615234, -1741.8996582031, 11.353673934937, 2.00);
  86. SendClientMessage(playerid, COLOR_GREEN, "[Parkplatz]Du hast dir erfolgreich ein Ticket gekauft.");
  87. SendClientMessage(playerid, COLOR_GREEN, "[Parkplatz]Gute Weiterfahrt!");
  88. GivePlayerMoney(playerid,-100);
  89. PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
  90. Ticket = 1;
  91. return 1;
  92. }
  93. }
  94. //Parkplatz verlassen
  95. if(strcmp(cmdtext, "/openp", true) == 0)
  96. {
  97. if (PlayerToPoint(5.0, playerid, 1102.2005615234, -1741.8996582031, 13.353673934937))
  98. {
  99. if (Ticket == 1)
  100. {
  101. SendClientMessage(playerid, COLOR_GREEN, "[Parkplatz]Du hast dein Ticket eingelöst.");
  102. SendClientMessage(playerid, COLOR_GREEN, "[Parkplatz]Bis bald!");
  103. PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
  104. MoveObject(Gate, 1102.2005615234, -1741.8996582031, 11.353673934937, 2.00);
  105. Ticket = 0;
  106. return 1;
  107. }
  108. else
  109. {
  110. SendClientMessage(playerid, COLOR_RED, "[Parkplatz]Du hast kein Ticket erworben. Kaufe es an der Einfahrt!");
  111. return 1;
  112. }
  113. }
  114. }
  115. return 0;
  116. }
  117. public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
  118. {
  119. if(IsPlayerConnected(playerid))
  120. {
  121. new Float:oldposx, Float:oldposy, Float:oldposz;
  122. new Float:tempposx, Float:tempposy, Float:tempposz;
  123. GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  124. tempposx = (oldposx -x);
  125. tempposy = (oldposy -y);
  126. tempposz = (oldposz -z);
  127. if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  128. {
  129. return 1;
  130. }
  131. }
  132. return 0;
  133. }
  134. public EnterParkText()
  135. {
  136. for(new i = 0; i < MAX_PLAYERS; i++)
  137. if (PlayerToPoint(5.0, i, 1103.2005615234, -1741.8996582031, 13.353673934937))
  138. {
  139. Create3DTextLabel("Los Santos Parkplatz | Kosten: 100$\n-----\tBenutze /openp",0xFFFFFFFF,1101.9207763672, -1741.2805175781, 13.345894813538,80,0,0);
  140. }
  141. }
  142. public ClosePark()
  143. {
  144. for(new i = 0; i < MAX_PLAYERS; i++)
  145. if (!PlayerToPoint(1.5, i, 1102.2005615234, -1741.8996582031, 13.353673934937) || !PlayerToPoint(5.0, i, 1102.2005615234, -1741.8996582031, 13.353673934937))
  146. {
  147. MoveObject(Gate, 1102.2005615234, -1741.8996582031, 13.353673934937, 2.00);
  148. }
  149. }
Advertisement
Add Comment
Please, Sign In to add comment