Guest User

Horse Shoe [0.3x]

a guest
May 16th, 2013
545
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.76 KB | None | 0 0
  1. #include <a_samp>
  2. #include <zcmd>
  3. #include <sscanf2>
  4.  
  5. #define COLOR_RED 0xFF0000C8
  6. #define COLOR_YELLOW 0xFFFF00AA
  7.  
  8. #define COLOR_GREEN 0x33CC33C8
  9.  
  10. enum E_HORSE
  11. {
  12. Float:hx,
  13. Float:hy,
  14. Float:hz,
  15. order,
  16. pickup,
  17. reward
  18. }
  19. new shoecord[][E_HORSE] =
  20. {
  21. {2011.8767,1544.7483,9.4787,0,0,1000},
  22. {2323.7659,1283.2438,97.5738,2,1,2000},
  23. {1432.0463,2751.2932,19.5234,3,2,3000},
  24. {-144.1049,1231.6788,26.2031,4,3,4000},
  25. {-688.2123,938.3978,13.6328,5,4,5000},
  26. {-1531.5845,687.4770,133.0514,6,5,6000},
  27. {-1746.0385,528.1078,33.6328,7,6,7000},
  28. {-2342.2903,-163.5137,41.6406,8,7,8000},
  29. {-2397.8435,-246.5068,35.6401,9,8,9000},
  30. {-2758.2698,-417.5380,7.0309,10,9,10000},
  31. {-2173.6699,-2366.3496,30.6250,11,10,11000},
  32. {-1911.3087,-2586.6506,57.0643,12,11,12000},
  33. {-328.0322,-2130.3245,30.5606,13,12,13000},
  34. {-345.5536,-1854.0347,-4.9475,14,13,14000},
  35. {-262.8691,-1638.6805,11.6048,15,14,15000},
  36. {-369.4187,-1417.4979,25.7266,16,15,16000},
  37. {141.8222,-1475.9114,28.5270,17,16,17000},
  38. {388.8241,-1751.6829,20.4459,18,17,18000},
  39. {389.8570,-2033.2495,7.8359,19,18,19000},
  40. {715.2880,-1625.7753,2.4297,20,19,20000},
  41. {1407.0277,-1408.5634,14.2031,21,20,21000},
  42. {1966.0477,-1205.1957,16.5903,22,21,22000},
  43. {2113.9241,-1498.7046,10.4219,23,22,23000},
  44. {1851.5220,-1488.1444,8.8421,24,23,24000},
  45. {2064.7339,-1585.3751,13.4830,25,24,25000},
  46. {2431.4189,-2420.6155,13.1867,26,25,26000},
  47. {2798.5327,-2393.7683,13.9560,27,26,27000},
  48. {984.4499,2562.9263,10.7498,28,27,28000},
  49. {490.8186,1309.3688,10.0656,29,28,29000},
  50. {-425.7174,1390.5726,15.1472,30,29,100000}
  51. };
  52. new hshoe[30],
  53. horseshoe[MAX_PLAYERS]
  54. ;
  55.  
  56. public OnFilterScriptInit()
  57. {
  58. for(new i = 0; i < sizeof(shoecord); i++)
  59. {
  60. hshoe[shoecord[i][pickup]] = CreatePickup(954, 1, shoecord[i][hx], shoecord[i][hy], shoecord[i][hz], 0);
  61. }
  62. return 1;
  63. }
  64.  
  65. public OnFilterScriptExit()
  66. {
  67. for(new i = 0; i < sizeof(shoecord); i++)
  68. {
  69. DestroyPickup(hshoe[shoecord[i][pickup]]);
  70. }
  71. return 1;
  72. }
  73.  
  74. public OnPlayerConnect(playerid)
  75. {
  76. SendClientMessage(playerid, -1, "This script uses Jake's Horse Shoe system!");
  77. horseshoe[playerid] = 0;
  78. return 1;
  79. }
  80.  
  81. public OnPlayerDisconnect(playerid, reason)
  82. {
  83. horseshoe[playerid] = 0;
  84. return 1;
  85. }
  86.  
  87. public OnPlayerPickUpPickup(playerid, pickupid)
  88. {
  89. new str[150], pName[24];
  90. GetPlayerName(playerid, pName, sizeof(pName));
  91. if(pickupid == hshoe[0])
  92. {
  93. if(horseshoe[playerid] != 0)
  94. {
  95. SendClientMessage(playerid, COLOR_RED, "ERROR: You already collected this horseshoe!");
  96. return 1;
  97. }
  98. GameTextForPlayer(playerid, "~w~Horseshoe 1 ~r~out ~w~of 30", 2500, 3);
  99. SendClientMessage(playerid, COLOR_GREEN, "Horseshoe collected! (1/30)");
  100. horseshoe[playerid] = 1;
  101. for(new x = 0; x < sizeof(shoecord); x++)
  102. {
  103. GivePlayerMoney(playerid, shoecord[x][reward]);
  104. }
  105. }
  106. if(pickupid == hshoe[29])
  107. {
  108. if(horseshoe[playerid] < 29) return SendClientMessage(playerid, COLOR_RED, "ERROR: Collect the horseshoe in order! This is 30/30 horseshoe");
  109. if(horseshoe[playerid] == 30)
  110. {
  111. SendClientMessage(playerid, COLOR_RED, "ERROR: You've already completed collecting all horseshoe (30/30)!");
  112. return 1;
  113. }
  114. GameTextForPlayer(playerid, "~w~Horseshoe 30 ~r~out ~w~of 30", 2500, 3);
  115. SendClientMessage(playerid, COLOR_YELLOW, "All horseshoe collected (30/30)");
  116. horseshoe[playerid] = 30;
  117. new moneyreward;
  118. for(new x = 0; x < sizeof(shoecord); x++)
  119. {
  120. GivePlayerMoney(playerid, shoecord[x][reward]);
  121. moneyreward = shoecord[x][reward];
  122. }
  123. format(str, sizeof(str), "%s(ID:%d) has collected all horseshoes (30/30)", pName, playerid);
  124. SendClientMessageToAll(COLOR_YELLOW, str);
  125. new randscore = random(51);
  126. SetPlayerScore(playerid, randscore);
  127. format(str, sizeof(str), "%s receive %i$ + %i score", pName, moneyreward, randscore);
  128. SendClientMessageToAll(COLOR_GREEN, str);
  129. }
  130. for(new i = 0; i < sizeof(shoecord); i++)
  131. {
  132. if(pickupid == hshoe[shoecord[i][pickup]])
  133. {
  134. if(horseshoe[playerid] < shoecord[i][order]-1)
  135. {
  136. format(str, sizeof(str), "ERROR: Collect the horseshoe in order! This is %i/30 horseshoe", shoecord[i][order]);
  137. SendClientMessage(playerid, COLOR_RED, str);
  138. return 1;
  139. }
  140. if(horseshoe[playerid] >= shoecord[i][order]) return SendClientMessage(playerid, COLOR_RED, "ERROR: You already collected this horseshoe!");
  141. format(str, sizeof(str), "~w~Horseshoe %i ~r~out ~w~of 30", shoecord[i][order]);
  142. GameTextForPlayer(playerid, str, 2500, 3);
  143. format(str, sizeof(str), "Horseshoe collected! (%i/20)", shoecord[i][order]);
  144. SendClientMessage(playerid, COLOR_GREEN, str);
  145. horseshoe[playerid] = shoecord[i][order];
  146. GivePlayerMoney(playerid, shoecord[i][reward]);
  147. }
  148. }
  149. return 1;
  150. }
  151.  
  152. CMD:gotohs(playerid, params[])
  153. {
  154. new str[150], id;
  155. if(IsPlayerAdmin(playerid))
  156. {
  157. if(sscanf(params, "i", id))
  158. {
  159. SendClientMessage(playerid, COLOR_RED, "USAGE: /gotohs [0-29]");
  160. SendClientMessage(playerid, -1, "Example: /gotohs 0 (Teleports you to horseshoe 1)");
  161. return 1;
  162. }
  163. if(id < 0 || id > 29) return SendClientMessage(playerid, COLOR_RED, "ERROR: Invalid Horseshoe ID!");
  164. if(id == 0)
  165. {
  166. SetCameraBehindPlayer(playerid);
  167. SetPlayerPos(playerid, 2011.8767,1544.7483+3,9.4787);
  168. SetPlayerInterior(playerid, 0);
  169. SetPlayerVirtualWorld(playerid, 0);
  170. }
  171. else if(id >= 1)
  172. {
  173. SetCameraBehindPlayer(playerid);
  174. SetPlayerPos(playerid, shoecord[id][hx], shoecord[id][hy], shoecord[id][hz]);
  175. SetPlayerInterior(playerid, 0);
  176. SetPlayerVirtualWorld(playerid, 0);
  177. }
  178. format(str, sizeof(str), "Teleported to %i horseshoe!", id);
  179. SendClientMessage(playerid, COLOR_YELLOW, str);
  180. }
  181. else SendClientMessage(playerid, COLOR_RED, ">> You're not RCON Admin! <<");
  182. return 1;
  183. }
Advertisement
Add Comment
Please, Sign In to add comment