Guest User

moneybag

a guest
May 16th, 2014
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.27 KB | None | 0 0
  1. #include <a_samp>
  2. #include <zcmd>
  3. #include <streamer>
  4.  
  5. enum mbinfo
  6. {
  7. Float:XPOS,
  8. Float:YPOS,
  9. Float:ZPOS,
  10. Position[50]
  11. };
  12.  
  13. new Float:MBSPAWN[][mbinfo] =
  14. {
  15. // Positions, (X, Y, Z, Location)
  16. {713.073852, 912.842224, -19.096578, "The Quarry"},
  17. {2302.0247, 1283.4984, 67.4688, "LV Pyramid"},
  18. {2323.6279, 1304.7378, 67.4688, "LV Pyramid"},
  19. {2345.5537, 1287.0211, 67.4688, "LV Pyramid"},
  20. {2329.0593, 1261.4042, 67.4688, "LV Pyramid"},
  21. {2551.7988, 1223.7418, 10.8203, "LV Pyramid"},
  22. {2644.5469, 1206.3735, 26.9233, "LV Pyramid"},
  23. {2553.7424, 1102.0887, 16.1149, "LV Pyramid"},
  24. {2568.9570, 1101.8331, 16.1103, "LV Pyramid"},
  25. {2908.9858, 986.5837, 10.8984, "Linden Side"},
  26. {2886.3406, 909.0569, 10.7500, "Rockshore East"},
  27. {2888.1458, 873.2290, 11.3677, "Rockshore East"},
  28. {2690.8811, 855.1355, 9.9220, "Rockshore East"},
  29. {2690.5376, 866.3606, 9.9374, "Rockshore East"},
  30. {2695.1758, 877.2897, 10.5842, "Rockshore East"},
  31. {2699.2920, 878.2109, 10.5755, "Rockshore East"},
  32. {2676.1406, 826.9889, 10.9545, "Rockshore East"},
  33. {2681.0967, 835.7373, 13.7127, "Rockshore East"},
  34. {1765.5985, 623.9385, 10.8203, "Randolph Industrial Estate"},
  35. {1762.1816, 590.4581, 10.8198, "Randolph Industrial Estate"},
  36. {1750.6249, 559.7758, 4.8828, "The Mako Span"},
  37. {1092.0543, 1077.4070, 10.8359, "Greenglass College"},
  38. {1016.0862, 1412.4600, 10.8203, "BlackField"},
  39. {939.6505, 1727.3956, 8.8516, "Whitewood Estates"},
  40. {925.5185, 2085.7004, 10.8203, "Whitewood Estates"},
  41. {884.7825, 2732.9546, 20.3383, "Bone Country"},
  42. {1051.7709, 2918.0928, 51.6622, "Bone Country"},
  43. {1764.8000, 2814.1255, 8.3359, "Ireland"},
  44. {2332.3621, 2785.3711, 12.2710, "Prickle Pine"},
  45. {2338.0291, 2814.1985, 14.8222, "Prickle Pine"},
  46. {2438.4714, 2828.1865, 10.8203, "Prickle Pine"},
  47. {2809.6355, 2934.6953, 37.0000, "Prickle Pine"},
  48. {2809.8416, 2946.9160, 31.5173, "Prickle Pine"},
  49. {2810.2515, 2927.0991, 40.3436, "Prickle Pine"},
  50. {2799.3979, 2574.8459, 10.8203, "Creek"},
  51. {2879.0901, 1594.2798, 10.8203, "Sobell Rail Yards"},
  52. {2482.5981, 1526.8191, 11.4006, "Pilgrim"},
  53. {2000.6729, 1565.8490, 15.3672, "Pirates In Mens Pants"},
  54. {2059.1453, 2010.1351, 10.8203, "The Visage"},
  55. {1801.1699, 2074.7278, 23.1674, "Harry Gold Parkway"},
  56. {1550.4684, 2057.5571, 31.1028, "Redsands West"},
  57. {1409.7883, 2133.5901, 12.0156, "Redsands West"},
  58. {1368.3809, 2195.6572, 9.7578, "Redsands West"},
  59. {354.7249, 1305.8237, 13.3625, "BoneCountry"},
  60. {22.4837, 1531.0942, 12.7500, "BoneCountry"},
  61. {14.9445, 1724.7888, 22.6349, "BoneCountry"},
  62. {163.4471, 1933.6057, 25.4985, "BoneCountry"},
  63. {414.7330, 2533.2129, 19.1484, "BoneCountry"},
  64. {-280.5523, 2584.6829, 59.4101, "BoneCountry"},
  65. {-938.1578, 2644.2849, 42.2968, "Tierra Robada"},
  66. {-1481.3164, 2629.3315, 58.7813, "Tierra Robada"},
  67. {-1378.1187, 2109.7971, 42.2000, "Tierra Robada"},
  68. {-1048.3119, 1551.0740, 33.4376, "Tierra Robada"},
  69. {-730.8501, 1539.1110, 40.4488, "Tierra Robada"},
  70. {-480.5752, 1053.5299, 1.9942, "Tierra Robada"}
  71. };
  72.  
  73. new Float:MoneyBagPos[3], MoneyBagFound=1, MoneyBagLocation[50], MoneyBagPickup = 600, Timer[2], GoAgainTimer;
  74.  
  75. //Hours, Minutes, Seconds, Milliseconds
  76. #define MoneyBagDelay(%1,%2,%3,%4) (%1*3600000)+(%2*60000)+(%3*1000)+%4
  77. //20 = 200,000 minimum 30 = 200,000 -> 500,000
  78. #define MoneyBagCash ((random(35)+09)*10000)
  79. //10 mins!
  80. #define MB_DELAY MoneyBagDelay(0, 10, 0, 0)
  81.  
  82. public OnFilterScriptInit()
  83. {
  84. Timer[1] = SetTimer("MoneyBag", MB_DELAY, true);
  85. return 1;
  86. }
  87.  
  88. forward MoneyBag();
  89. public MoneyBag()
  90. {
  91. new string[250];
  92. if(!MoneyBagFound)
  93. {
  94. format(string, sizeof(string), "{FFFF66}**The lost briefcase has not been found, it is still located in {FF0000}%s", MoneyBagLocation);
  95. SendClientMessageToAll(-1, string);
  96. }
  97. else if(MoneyBagFound)
  98. {
  99. MoneyBagFound = 0;
  100. new randombag = random(sizeof(MBSPAWN));
  101. MoneyBagPos[0] = MBSPAWN[randombag][XPOS];
  102. MoneyBagPos[1] = MBSPAWN[randombag][YPOS];
  103. MoneyBagPos[2] = MBSPAWN[randombag][ZPOS];
  104. format(MoneyBagLocation, sizeof(MoneyBagLocation), "%s", MBSPAWN[randombag][Position]);
  105. format(string, sizeof(string), "{FFFF66}**A Robber has lost his robbed briefcase in {FF0000}%s!{FFFF66} Type /lbc to join the briefcase hunt.",MoneyBagLocation);
  106. SendClientMessageToAll(-1, string);
  107. MoneyBagPickup = CreateDynamicPickup(1210, 19, MoneyBagPos[0], MoneyBagPos[1], MoneyBagPos[2], -1, -1, -1, 1000.0);
  108. new distancestring[127];
  109. for(new i = 0; i < MAX_PLAYERS; i++)
  110. {
  111. new Float:distance = GetPlayerDistanceFromPoint(i, MoneyBagPos[0], MoneyBagPos[1], MoneyBagPos[2]);
  112. format(distancestring, sizeof(string), "{00B2EE}The lost briefcase is %i meters away and located in %s!!", floatround(distance, floatround_ceil),MoneyBagLocation);
  113. SendClientMessage(i, -1, distancestring);
  114. }
  115. }
  116. return 1;
  117. }
  118.  
  119. public OnPlayerCommandText(playerid, cmdtext[])
  120. {
  121. return 0;
  122. }
  123.  
  124. CMD:briefcase( playerid, params[ ] )
  125. {
  126.  
  127. if(!MoneyBagFound)
  128. {
  129. new string[150];
  130. format(string, sizeof(string), "{FFFF66}**The briefcase has been Lost in {FF0000}%s!!",MoneyBagLocation);
  131. return SendClientMessage(playerid, -1, string);
  132. }
  133. else if(MoneyBagFound)
  134. {
  135. new string[150];
  136. format(string, sizeof(string), "{FFFF66}**The briefcase event is currently {FF0000}not running!");
  137. return SendClientMessage(playerid, -1, string);
  138. }
  139. return 1;
  140. }
  141. CMD:lbc(playerid, params[])
  142. {
  143. if(!MoneyBagFound)
  144. {
  145. new string[64];
  146. new Float:distance = GetPlayerDistanceFromPoint(playerid, MoneyBagPos[0], MoneyBagPos[1], MoneyBagPos[2]);
  147. format(string, sizeof(string), "{00B2EE}**The lost briefcase is %i meters away in %s!!", floatround(distance, floatround_ceil),MoneyBagLocation);
  148. SendClientMessage(playerid, -1, string);
  149. return 1;
  150. }
  151. else if(MoneyBagFound)
  152. {
  153. new string[150];
  154. format(string, sizeof(string), "{FFFF66}**The briefcase event is currently {FF0000}not running!");
  155. return SendClientMessage(playerid, -1, string);
  156. }
  157. return 1;
  158. }
  159. CMD:gotobriefcase( playerid, params[ ] )
  160. {
  161. if(IsPlayerAdmin(playerid))
  162. {
  163. SetPlayerPos(playerid, MoneyBagPos[0], MoneyBagPos[1] +3, MoneyBagPos[2]);
  164. return SendClientMessage(playerid, -1, "You have been {FF0000}teleported {FFFFFF}to the {33FF66}briefcase");
  165. }
  166. else
  167. {
  168. return 0;
  169. }
  170. }
  171. CMD:startbriefcase( playerid, params[ ] )
  172. {
  173. if(IsPlayerAdmin(playerid))
  174. {
  175. KillTimer(GoAgainTimer);
  176. return MoneyBag();
  177. }
  178. else
  179. {
  180. return 0;
  181. }
  182. }
  183.  
  184. public OnPlayerPickUpDynamicPickup(playerid, pickupid)
  185. {
  186. if(pickupid == MoneyBagPickup)
  187. {
  188. new string[180], pname[24], money = MoneyBagCash;
  189. GetPlayerName(playerid, pname, 24);
  190. format(string, sizeof(string), "**{99FFFF}%s{FFFF66} has found the lost briefcase that had {33FF00}$%d {FFFF66} in %s", pname, money, MoneyBagLocation);
  191. MoneyBagFound = 1;
  192. SendClientMessageToAll(-1, string);
  193. SendClientMessageToAll(-1, "{FFFF66}A new briefcase event will start in 30 minutes!");
  194. DestroyDynamicPickup(MoneyBagPickup);
  195. SendClientMessage(playerid, -1, "{33FF66}You have found the lost briefcase!");
  196. GivePlayerMoney(playerid, money);
  197. ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
  198. GoAgainTimer = SetTimer("GoAgain", 1800000, false);
  199. }
  200. return 1;
  201. }
  202. forward GoAgain();
  203. public GoAgain()
  204. {
  205. return MoneyBag();
  206. }
Add Comment
Please, Sign In to add comment