Advertisement
Guest User

Untitled

a guest
Jun 28th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.05 KB | None | 0 0
  1. #include <a_samp>
  2. #include <zcmd>
  3.  
  4. main(){}
  5.  
  6. #define DIALOG_RANGE_MAIN 100
  7. #define DIALOG_RANGE_SPEED 101
  8. #define DIALOG_RANGE_WEAPON 102
  9.  
  10. #define SendFormatMessage(%0,%1,%2,%3) format(String, sizeof(String),%2,%3) \
  11. && SendClientMessage(%0, %1, String)
  12. #define SendFormatMessageToAll(%0,%1,%2) format(String, sizeof(String),%1,%2) \
  13. && SendClientMessageToAll(%0, String)
  14.  
  15. new
  16. pSRObj[MAX_PLAYERS],
  17. pSRType[MAX_PLAYERS],
  18. Float:pSRSpeed[MAX_PLAYERS],
  19. pSRMoved[MAX_PLAYERS],
  20. pSRTimer[MAX_PLAYERS],
  21. pSRScore[MAX_PLAYERS],
  22. pName[MAX_PLAYER_NAME][MAX_PLAYERS],
  23. String[256],
  24. BestRangePointName[MAX_PLAYER_NAME], // משתנה נשמר לשם השחקן עם הכי הרבה נקודות
  25. BestRangePointScore // משתנה נשמר לכמות עם הכי הרבה נקודות
  26. ;
  27.  
  28. enum ShootingRangeInfo
  29. {
  30. srHName[15],
  31. srObj,
  32. Float:srSpeed[3],
  33. Float:srPos1[3],
  34. Float:srPos2[3]
  35. };
  36. new srInfo[][ShootingRangeInfo] =
  37. {
  38. {"שמאל / ימין", 1584, {5.0, 12.0, 15.0}, {810.0, 1635.0, 4.0}, {791.0, 1635.0, 4.0}},
  39. {"למעלה / למטה", 1583, {10.0, 20.0, 24.0}, {801.0, 1638.0, 4.0}, {801.0, 1638.0, 12.0}},
  40. {"אלסון", 1584, {10.0, 18.0, 30.0}, {810.0, 1614.0, 4.0}, {797.0, 1649.0, 4.0}},
  41. {"התפוגגות", 1583, {13.0, 24.0, 32.0}, {801.0, 1624.0, 4.0}, {801.0, 1659.0, 7.0}},
  42. {"אחורה / קדימה", 1583, {7.0, 15.0, 30.0}, {801.0, 1638.0, 4.0}, {801.0, 1661.0, 4.0}}
  43. };
  44.  
  45. CMD:range(playerid, params[])
  46. {
  47. for (new i; i < sizeof(srInfo); i++) format(String, sizeof(String), "%s%d\t%s\n", String, i, srInfo[i][srHName]);
  48. format(String, sizeof(String), "#\tסגנון\n%s", String);
  49. ShowPlayerDialog(playerid,DIALOG_RANGE_MAIN,DIALOG_STYLE_TABLIST_HEADERS,"מטווח",String,"אישור", "");
  50. return 1;
  51. }
  52.  
  53. public OnPlayerConnect(playerid) return GetPlayerName(playerid, pName[playerid], MAX_PLAYER_NAME);
  54. public OnGameModeInit()
  55. {
  56. // Don't use these lines if it's a filterscript
  57. SetGameModeText("Blank Script");
  58. AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  59. return 1;
  60. }
  61.  
  62. public OnGameModeExit()
  63. {
  64. return 1;
  65. }
  66.  
  67. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  68. {
  69. switch(dialogid)
  70. {
  71. case DIALOG_RANGE_MAIN:
  72. {
  73. if (!response) return 0;
  74. format(String, sizeof(String), "#\tמהירות\tסגנון\n01\t%f\tאיטי\n02\t%f\tמהיר\n03\t%f\tמהיר מאוד", srInfo[pSRType[playerid]][srSpeed][0], srInfo[pSRType[playerid]][srSpeed][1], srInfo[pSRType[playerid]][srSpeed][2]);
  75. ShowPlayerDialog(playerid,DIALOG_RANGE_SPEED,DIALOG_STYLE_TABLIST_HEADERS,"מטווח > מהירות",String,"אישור", "");
  76. pSRType[playerid] = listitem;
  77. }
  78. case DIALOG_RANGE_SPEED:
  79. {
  80. if (!response) return cmd_range(playerid, "");
  81. ShowPlayerDialog(playerid, DIALOG_RANGE_WEAPON, DIALOG_STYLE_TABLIST_HEADERS, "מטווח > מהירות > נשקים", "#\tנשק\n1\tSniper Rifle - צלף רייפל\n2\tCountry Rifle - קאנטרי רייפל\n3\tAK47 - קלשניקוב 47","אישור", "");
  82. pSRSpeed[playerid] = srInfo[pSRType[playerid]][srSpeed][listitem];
  83. MovePlayerObject(playerid, pSRObj[playerid], srInfo[pSRType[playerid]][srPos2][0], srInfo[pSRType[playerid]][srPos2][1], srInfo[pSRType[playerid]][srPos2][2], pSRSpeed[playerid], 0.0, 0.0, 0.0);
  84. pSRMoved[playerid] = 0;
  85. }
  86. case DIALOG_RANGE_WEAPON:
  87. {
  88. if (!response) return OnDialogResponse(playerid, DIALOG_RANGE_MAIN, 1, pSRType[playerid], "");
  89. switch(listitem)
  90. {
  91. case 0: GivePlayerWeapon(playerid, 34, 99999);
  92. case 1: GivePlayerWeapon(playerid, 33, 99999);
  93. case 2: GivePlayerWeapon(playerid, 30, 99999);
  94. }
  95. SetPlayerPos(playerid, 801.5965,1668.9072,5.2813);
  96. SetPlayerFacingAngle(playerid, 181.3183);
  97. PlayerRange(playerid, 60, 10);
  98. pSRObj[playerid] = CreatePlayerObject(playerid, srInfo[pSRType[playerid]][srObj], srInfo[pSRType[playerid]][srPos2][0], srInfo[pSRType[playerid]][srPos2][1], srInfo[pSRType[playerid]][srPos2][2], 0.0, 0.0, 0.0);
  99. SetPlayerVirtualWorld(playerid, playerid);
  100. }
  101. }
  102. return 1;
  103. }
  104. public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
  105. {
  106. if ((hittype == BULLET_HIT_TYPE_PLAYER_OBJECT) && (hitid == pSRObj[playerid]))
  107. {
  108. DestroyPlayerObject(playerid, pSRObj[playerid]);
  109. pSRObj[playerid] = CreatePlayerObject(playerid, srInfo[pSRType[playerid]][srObj], srInfo[pSRType[playerid]][srPos2][0], srInfo[pSRType[playerid]][srPos2][1], srInfo[pSRType[playerid]][srPos2][2], 0.0, 0.0, 0.0);
  110. if (pSRMoved[playerid]) MovePlayerObject(playerid, pSRObj[playerid], srInfo[pSRType[playerid]][srPos1][0], srInfo[pSRType[playerid]][srPos1][1], srInfo[pSRType[playerid]][srPos1][2], pSRSpeed[playerid], 0.0, 0.0, 0.0);
  111. else MovePlayerObject(playerid, pSRObj[playerid], srInfo[pSRType[playerid]][srPos2][0], srInfo[pSRType[playerid]][srPos2][1], srInfo[pSRType[playerid]][srPos2][2], pSRSpeed[playerid], 0.0, 0.0, 0.0);
  112. }
  113. return 1;
  114. }
  115. public OnPlayerObjectMoved(playerid, objectid)
  116. {
  117. if (objectid == pSRObj[playerid])
  118. {
  119. pSRMoved[playerid] = pSRMoved[playerid]?(0):(1);
  120. if (pSRMoved[playerid]) MovePlayerObject(playerid, pSRObj[playerid], srInfo[pSRType[playerid]][srPos1][0], srInfo[pSRType[playerid]][srPos1][1], srInfo[pSRType[playerid]][srPos1][2], pSRSpeed[playerid], 0.0, 0.0, 0.0);
  121. else MovePlayerObject(playerid, pSRObj[playerid], srInfo[pSRType[playerid]][srPos2][0], srInfo[pSRType[playerid]][srPos2][1], srInfo[pSRType[playerid]][srPos2][2], pSRSpeed[playerid], 0.0, 0.0, 0.0);
  122. }
  123. return 1;
  124. }
  125.  
  126. forward PlayerRange(playerid, time, attamp);
  127. public PlayerRange(playerid, time, attamp)
  128. {
  129. new str[128];
  130. if (!IsPlayerConnected(playerid))
  131. {
  132. // השחקן יצא מהשרת בלה בלה בצ'אט
  133. if (IsValidPlayerObject(playerid, pSRObj[playerid])) DestroyPlayerObject(playerid, pSRObj[playerid]);
  134. pSRType[playerid] = -1;
  135. pSRSpeed[playerid] = 0.0;
  136. pSRMoved[playerid] = -1;
  137. pSRScore[playerid] = 0;
  138. KillTimer(pSRTimer[playerid]);
  139. }
  140. if (!IsPlayerInRangeOfPoint(playerid, 5.0, 801.5965, 1668.9072, 5.2813))
  141. {
  142. attamp--;
  143. if (attamp > 0) SendFormatMessage(playerid, -1, "!חזור אל מתחם המטווח או שתפסל %d/10", attamp);
  144. else
  145. {
  146. SendFormatMessage(playerid, -1, ">> [Range]: .נפסלת בגלל שיצאת מהאזור, אך צברת %d נקודות", pSRScore[playerid]);
  147. // השחקן בלה בלה יצא מהמתחם תרשום בצ'אט
  148. if (IsValidPlayerObject(playerid, pSRObj[playerid])) DestroyPlayerObject(playerid, pSRObj[playerid]);
  149. pSRType[playerid] = -1;
  150. pSRSpeed[playerid] = 0.0;
  151. pSRMoved[playerid] = -1;
  152. pSRScore[playerid] = 0;
  153. KillTimer(pSRTimer[playerid]);
  154. ResetPlayerWeapons(playerid);
  155. SpawnPlayer(playerid);
  156. }
  157. }
  158. if (time > 0)
  159. {
  160. time--;
  161. if (time % 20 == 0) SendFormatMessage(playerid, -1, ">> [Range]: .נותרו %d שניות מתוך 60 שניות וצברת %d נקודות", time, pSRScore[playerid]);
  162. format(str, sizeof(str), "~n~~n~~n~~n~~n~~n~~n~~y~~h~ time left: ! ~n~~y~ %d/60", time);
  163. GameTextForPlayer(playerid, str, 5400, 3);
  164. return pSRTimer[playerid] = SetTimerEx("PlayerRange", 1000, false, "ddd", playerid, time, attamp);
  165. }
  166. else
  167. {
  168. SendFormatMessage(playerid, -1, ">> [Range]: .צברת שיא של %d נקודות, כל הכבוד", pSRScore[playerid]);
  169. if (pSRScore[playerid] > BestRangePointScore)
  170. {
  171. SendFormatMessageToAll(-1, ">> [Range]: .ולכן נקבע שיא של %d נקודות לעומת השיא הקודם של %d נקודות %s שבר את השיא של השחקן %s השחקן", pSRScore[playerid], BestRangePointScore, BestRangePointName, pName[playerid]);
  172. format(BestRangePointName, MAX_PLAYER_NAME, pName[playerid]);
  173. }
  174. if (IsValidPlayerObject(playerid, pSRObj[playerid])) DestroyPlayerObject(playerid, pSRObj[playerid]);
  175. pSRType[playerid] = -1;
  176. pSRSpeed[playerid] = 0.0;
  177. pSRMoved[playerid] = -1;
  178. pSRScore[playerid] = 0;
  179. KillTimer(pSRTimer[playerid]);
  180. ResetPlayerWeapons(playerid);
  181. SpawnPlayer(playerid);
  182. }
  183. return 1;
  184. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement