horsey.pwn 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664
  1. /*
  2. /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$$
  3. | $$$ | $$ /$$__ $$ | $$__ $$| $$__ $$
  4. | $$$$| $$| $$ \__/ | $$ \ $$| $$ \ $$
  5. | $$ $$ $$| $$ /$$$$ /$$$$$$| $$$$$$$/| $$$$$$$/
  6. | $$ $$$$| $$|_ $$|______/| $$__ $$| $$____/
  7. | $$\ $$$| $$ \ $$ | $$ \ $$| $$
  8. | $$ \ $$| $$$$$$/ | $$ | $$| $$
  9. |__/ \__/ \______/ |__/ |__/|__/
  10. Horse Race Gambling System
  11. by Hector
  12. Next Generation Gaming, LLC
  13. (created by Next Generation Gaming Development Team)
  14. * Copyright (c) 2016, Next Generation Gaming, LLC
  15. *
  16. * All rights reserved.
  17. *
  18. * Redistribution and use in source and binary forms, with or without modification,
  19. * are not permitted in any case.
  20. *
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  23. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  24. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  25. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  26. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  27. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  28. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  29. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  30. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  31. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  32. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  33. */
  34. #include <YSI\y_hooks>
  35. CMD:placebet(playerid, params[])
  36. {
  37. if(!IsAtCasino(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not in a Casino."); // Check to see if the player is inside of a casino
  38. if((PlayerInfo[playerid][pHorse] > 0)) return SendClientMessage(playerid, COLOR_GREY, "You are already in a game."); // Check to make sure the player can't place another bet while he has horsetimer going
  39. #if defined zombiemode
  40. if(zombieevent == 1 && GetPVarType(playerid, "pIsZombie")) return SendClientMessageEx(playerid, COLOR_GREY, "Zombies can't use this.");
  41. #endif
  42. if(GetPVarType(playerid, "Injured")) return SendClientMessageEx(playerid, COLOR_GRAD1, "You cannot do this right now.");
  43. if(GetPVarType(playerid, "PlayerCuffed") || GetPVarInt(playerid, "pBagged") >= 1 || GetPVarType(playerid, "IsFrozen") || PlayerInfo[playerid][pHospital] || (PlayerInfo[playerid][pJailTime] > 0 && strfind(PlayerInfo[playerid][pPrisonReason], "[OOC]", true) != -1))
  44. return SendClientMessage(playerid, COLOR_GRAD2, "You can't do that at this time!");
  45. /*ShowPlayerDialog(playerid, DIALOG_HORSE_RACE, DIALOG_STYLE_TABLIST_HEADERS, "Inside Track Betting",
  46. "Horse\tBet\tPayout\n\
  47. Wong's Wang\t$18000\t$40000\n\
  48. Flaps's Ahoy\t$32000\t$70000\n\
  49. Beanflicker\t$46000\t$101000\n\
  50. Axe Wound\t$55000\t$123000\n\
  51. McTagnut & Fries\t$73000\t$161000\n\
  52. Love Torpedo\t$150000\t$330000\n\
  53. Arthur or Martha\t$425000\t$935000\n\
  54. Purple Love\t$875000\t$1900000\n\
  55. Billy Sastard\t$10000000\t$22000000",
  56. "Select", "Cancel");*/
  57. Dialog_Show(playerid, PlaceHorseBet, DIALOG_STYLE_TABLIST_HEADERS, "Inside Track Betting",
  58. "Horse\tBet\tPayout\n\
  59. Wong's Wang\t$18000\t$40000\n\
  60. Flaps's Ahoy\t$32000\t$70000\n\
  61. Beanflicker\t$46000\t$101000\n\
  62. Axe Wound\t$55000\t$123000\n\
  63. McTagnut & Fries\t$73000\t$161000\n\
  64. Love Torpedo\t$150000\t$330000\n\
  65. Arthur or Martha\t$425000\t$935000\n\
  66. Purple Love\t$875000\t$1900000\n\
  67. Billy Sastard\t$10000000\t$22000000",
  68. "Select", "Cancel");
  69. SendClientMessage(playerid, COLOR_GREY, "Welcome to Inside Track Betting!.");
  70. return 1;
  71. }
  72. Dialog:PlaceHorseBet(playerid, response, listitem, inputtext[]) {
  73. new string[128];
  74. if(!response) return 1;
  75. switch(listitem) {
  76. case 0:
  77. {
  78. if(PlayerInfo[playerid][pCash] >= 18000)
  79. {
  80. if(Businesses[InBusiness(playerid)][bSafeBalance] < 40000) return SendClientMessage(playerid, COLOR_GREY, "The casino doesn't have enough money.");
  81. PlayerInfo[playerid][pHorse] = 1;
  82. TogglePlayerControllable(playerid, 0);
  83. GivePlayerCash(playerid, -18000);
  84. format(string, sizeof(string), "%s has bet $18000 on a horse", GetPlayerNameEx(playerid));
  85. Log("logs/horse.log", string);
  86. Businesses[InBusiness(playerid)][bSafeBalance] += 18000; // Adds the money to the biz
  87. SaveBusiness(InBusiness(playerid));
  88. SendClientMessage(playerid, COLOR_GREY, "You have placed a bet on Wong's Wang for $18000.");
  89. SetTimerEx("HorseTimer", 15000, false, "i", playerid);
  90. PlayerPlaySound(playerid, 3200, 0.0, 0.0, 0.0);
  91. format(szMiscArray, sizeof(szMiscArray), "%s places their bet and waits for the race to start", GetPlayerNameEx(playerid));
  92. ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  93. SendClientMessage(playerid, COLOR_GREY, "**Announcer** And they're off!.");
  94. }
  95. else return SendClientMessage(playerid, COLOR_GREY,"You don't have enough money to place the bet.");
  96. }
  97. case 1:
  98. {
  99. if(PlayerInfo[playerid][pCash] >= 32000)
  100. {
  101. if(Businesses[InBusiness(playerid)][bSafeBalance] < 70000) return SendClientMessage(playerid, COLOR_GREY, "The casino doesn't have enough money.");
  102. PlayerInfo[playerid][pHorse] = 2;
  103. TogglePlayerControllable(playerid, 0);
  104. GivePlayerCash(playerid, -32000);
  105. format(string, sizeof(string), "%s has bet $32000 on a horse", GetPlayerNameEx(playerid));
  106. Log("logs/horse.log", string);
  107. Businesses[InBusiness(playerid)][bSafeBalance] += 32000; // Adds the money to the biz
  108. SaveBusiness(InBusiness(playerid));
  109. SendClientMessage(playerid, COLOR_GREY, "You have placed a bet on Flap's Ahoy for $32000.");
  110. SetTimerEx("HorseTimer", 15000, false, "i", playerid);
  111. PlayerPlaySound(playerid, 3200, 0.0, 0.0, 0.0);
  112. format(szMiscArray, sizeof(szMiscArray), "%s places their bet and waits for the race to start", GetPlayerNameEx(playerid));
  113. ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  114. SendClientMessage(playerid, COLOR_GREY, "**Announcer** And they're off!.");
  115. }
  116. else return SendClientMessage(playerid, COLOR_GREY,"You don't have enough money to place the bet.");
  117. }
  118. case 2:
  119. {
  120. if(PlayerInfo[playerid][pCash] >= 46000)
  121. {
  122. if(Businesses[InBusiness(playerid)][bSafeBalance] < 101000) return SendClientMessage(playerid, COLOR_GREY, "The casino doesn't have enough money.");
  123. PlayerInfo[playerid][pHorse] = 3;
  124. TogglePlayerControllable(playerid, 0);
  125. GivePlayerCash(playerid, -46000);
  126. format(string, sizeof(string), "%s has bet $46000 on a horse", GetPlayerNameEx(playerid));
  127. Log("logs/horse.log", string);
  128. Businesses[InBusiness(playerid)][bSafeBalance] += 46000; // Adds the money to the biz
  129. SaveBusiness(InBusiness(playerid));
  130. SendClientMessage(playerid, COLOR_GREY, "You have placed a bet on Beanflicker for $46000.");
  131. SetTimerEx("HorseTimer", 15000, false, "i", playerid);
  132. PlayerPlaySound(playerid, 1142, 0.0, 0.0, 0.0);
  133. format(szMiscArray, sizeof(szMiscArray), "%s places their bet and waits for the race to start", GetPlayerNameEx(playerid));
  134. ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  135. SendClientMessage(playerid, COLOR_GREY, "**Announcer** And they're off!.");
  136. }
  137. else return SendClientMessage(playerid, COLOR_GREY,"You don't have enough money to place the bet.");
  138. }
  139. case 3:
  140. {
  141. if(PlayerInfo[playerid][pCash] >= 55000)
  142. {
  143. if(Businesses[InBusiness(playerid)][bSafeBalance] < 123000) return SendClientMessage(playerid, COLOR_GREY, "The casino doesn't have enough money.");
  144. PlayerInfo[playerid][pHorse] = 4;
  145. TogglePlayerControllable(playerid, 0);
  146. GivePlayerCash(playerid, -55000);
  147. format(string, sizeof(string), "%s has bet $55000 on a horse", GetPlayerNameEx(playerid));
  148. Log("logs/horse.log", string);
  149. Businesses[InBusiness(playerid)][bSafeBalance] += 55000; // Adds the money to the biz
  150. SaveBusiness(InBusiness(playerid));
  151. SendClientMessage(playerid, COLOR_GREY, "You have placed a bet on Axe Wound for $55000.");
  152. SetTimerEx("HorseTimer", 15000, false, "i", playerid);
  153. PlayerPlaySound(playerid, 3200, 0.0, 0.0, 0.0);
  154. format(szMiscArray, sizeof(szMiscArray), "%s places their bet and waits for the race to start", GetPlayerNameEx(playerid));
  155. ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  156. SendClientMessage(playerid, COLOR_GREY, "**Announcer** And they're off!.");
  157. }
  158. else return SendClientMessage(playerid, COLOR_GREY,"You don't have enough money to place the bet.");
  159. }
  160. case 4:
  161. {
  162. if(PlayerInfo[playerid][pCash] >= 73000)
  163. {
  164. if(Businesses[InBusiness(playerid)][bSafeBalance] < 161000) return SendClientMessage(playerid, COLOR_GREY, "The casino doesn't have enough money.");
  165. PlayerInfo[playerid][pHorse] = 5;
  166. TogglePlayerControllable(playerid, 0);
  167. GivePlayerCash(playerid, -73000);
  168. format(string, sizeof(string), "%s has bet $73000 on a horse", GetPlayerNameEx(playerid));
  169. Log("logs/horse.log", string);
  170. Businesses[InBusiness(playerid)][bSafeBalance] += 73000; // Adds the money to the biz
  171. SaveBusiness(InBusiness(playerid));
  172. SendClientMessage(playerid, COLOR_GREY, "You have placed a bet on McTagnut & Fries for $73000.");
  173. SetTimerEx("HorseTimer", 15000, false, "i", playerid);
  174. PlayerPlaySound(playerid, 1142, 0.0, 0.0, 0.0);
  175. format(szMiscArray, sizeof(szMiscArray), "%s places their bet and waits for the race to start", GetPlayerNameEx(playerid));
  176. ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  177. SendClientMessage(playerid, COLOR_GREY, "**Announcer** And they're off!.");
  178. }
  179. else return SendClientMessage(playerid, COLOR_GREY,"You don't have enough money to place the bet.");
  180. }
  181. case 5:
  182. {
  183. if(PlayerInfo[playerid][pCash] >= 150000)
  184. {
  185. if(Businesses[InBusiness(playerid)][bSafeBalance] < 330000) return SendClientMessage(playerid, COLOR_GREY, "The casino doesn't have enough money.");
  186. PlayerInfo[playerid][pHorse] = 6;
  187. TogglePlayerControllable(playerid, 0);
  188. GivePlayerCash(playerid, -150000);
  189. format(string, sizeof(string), "%s has bet $150000 on a horse", GetPlayerNameEx(playerid));
  190. Log("logs/horse.log", string);
  191. Businesses[InBusiness(playerid)][bSafeBalance] += 150000; // Adds the money to the biz
  192. SaveBusiness(InBusiness(playerid));
  193. SendClientMessage(playerid, COLOR_GREY, "You have placed a bet on Love Torpedo for $150000.");
  194. SetTimerEx("HorseTimer", 15000, false, "i", playerid);
  195. PlayerPlaySound(playerid, 3200, 0.0, 0.0, 0.0);
  196. format(szMiscArray, sizeof(szMiscArray), "%s places their bet and waits for the race to start", GetPlayerNameEx(playerid));
  197. ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  198. SendClientMessage(playerid, COLOR_GREY, "**Announcer** And they're off!.");
  199. }
  200. else return SendClientMessage(playerid, COLOR_GREY,"You don't have enough money to place the bet.");
  201. }
  202. case 6:
  203. {
  204. if(PlayerInfo[playerid][pCash] >= 425000)
  205. {
  206. if(Businesses[InBusiness(playerid)][bSafeBalance] < 935000) return SendClientMessage(playerid, COLOR_GREY, "The casino doesn't have enough money.");
  207. PlayerInfo[playerid][pHorse] = 7;
  208. TogglePlayerControllable(playerid, 0);
  209. GivePlayerCash(playerid, -425000);
  210. format(string, sizeof(string), "%s has bet $425000 on a horse", GetPlayerNameEx(playerid));
  211. Log("logs/horse.log", string);
  212. Businesses[InBusiness(playerid)][bSafeBalance] += 425000; // Adds the money to the biz
  213. SaveBusiness(InBusiness(playerid));
  214. SendClientMessage(playerid, COLOR_GREY, "You have placed a bet on Arthur or Martha for $425000.");
  215. SetTimerEx("HorseTimer", 15000, false, "i", playerid);
  216. PlayerPlaySound(playerid, 1142, 0.0, 0.0, 0.0);
  217. format(szMiscArray, sizeof(szMiscArray), "%s places their bet and waits for the race to start", GetPlayerNameEx(playerid));
  218. ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  219. SendClientMessage(playerid, COLOR_GREY, "**Announcer** And they're off!.");
  220. }
  221. else return SendClientMessage(playerid, COLOR_GREY,"You don't have enough money to place the bet.");
  222. }
  223. case 7:
  224. {
  225. if(PlayerInfo[playerid][pCash] >= 875000)
  226. {
  227. if(Businesses[InBusiness(playerid)][bSafeBalance] < 1900000) return SendClientMessage(playerid, COLOR_GREY, "The casino doesn't have enough money.");
  228. PlayerInfo[playerid][pHorse] = 8;
  229. TogglePlayerControllable(playerid, 0);
  230. GivePlayerCash(playerid, -875000);
  231. format(string, sizeof(string), "%s has bet $875000 on a horse", GetPlayerNameEx(playerid));
  232. Log("logs/horse.log", string);
  233. Businesses[InBusiness(playerid)][bSafeBalance] += 875000; // Adds the money to the biz
  234. SaveBusiness(InBusiness(playerid));
  235. SendClientMessage(playerid, COLOR_GREY, "You have placed a bet on Purple Love for $875000.");
  236. SetTimerEx("HorseTimer", 15000, false, "i", playerid);
  237. PlayerPlaySound(playerid, 3200, 0.0, 0.0, 0.0);
  238. format(szMiscArray, sizeof(szMiscArray), "%s places their bet and waits for the race to start", GetPlayerNameEx(playerid));
  239. ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  240. SendClientMessage(playerid, COLOR_GREY, "**Announcer** And they're off!.");
  241. }
  242. else return SendClientMessage(playerid, COLOR_GREY,"You don't have enough money to place the bet.");
  243. }
  244. case 8:
  245. {
  246. if(PlayerInfo[playerid][pCash] >= 10000000)
  247. {
  248. if(Businesses[InBusiness(playerid)][bSafeBalance] < 22000000) return SendClientMessage(playerid, COLOR_GREY, "The casino doesn't have enough money.");
  249. PlayerInfo[playerid][pHorse] = 9;
  250. TogglePlayerControllable(playerid, 0);
  251. GivePlayerCash(playerid, -10000000);
  252. format(string, sizeof(string), "%s has bet $100000000 on a horse", GetPlayerNameEx(playerid));
  253. Log("logs/horse.log", string);
  254. Businesses[InBusiness(playerid)][bSafeBalance] += 10000000; // Adds the money to the biz
  255. SaveBusiness(InBusiness(playerid));
  256. SendClientMessage(playerid, COLOR_GREY, "You have placed a bet on Billy Sastard for $10000000.");
  257. SetTimerEx("HorseTimer", 15000, false, "i", playerid);
  258. PlayerPlaySound(playerid, 3200, 0.0, 0.0, 0.0);
  259. format(szMiscArray, sizeof(szMiscArray), "%s places their bet and waits for the race to start", GetPlayerNameEx(playerid));
  260. ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  261. SendClientMessage(playerid, COLOR_GREY, "**Announcer** And they're off!.");
  262. }
  263. else return SendClientMessage(playerid, COLOR_GREY,"You don't have enough money to place the bet.");
  264. }
  265. }
  266. return 1;
  267. }
  268. /*
  269. hook OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  270. {
  271. if(arrAntiCheat[playerid][ac_iFlags][AC_DIALOGSPOOFING] > 0) return 1;
  272. new string[128];
  273. switch(dialogid) {
  274. case DIALOG_HORSE_RACE: {
  275. if(!response)return 1;
  276. else
  277. {
  278. switch(listitem)
  279. {
  280. case 0:
  281. {
  282. if(PlayerInfo[playerid][pCash] >= 18000)
  283. {
  284. if(Businesses[InBusiness(playerid)][bSafeBalance] < 40000) return SendClientMessage(playerid, COLOR_GREY, "The casino doesn't have enough money.");
  285. PlayerInfo[playerid][pHorse] = 1;
  286. TogglePlayerControllable(playerid, 0);
  287. GivePlayerCash(playerid, -18000);
  288. format(string, sizeof(string), "%s has bet $18000 on a horse", GetPlayerNameEx(playerid));
  289. Log("logs/horse.log", string);
  290. Businesses[InBusiness(playerid)][bSafeBalance] += 18000; // Adds the money to the biz
  291. SaveBusiness(InBusiness(playerid));
  292. SendClientMessage(playerid, COLOR_GREY, "You have placed a bet on Wong's Wang for $18000.");
  293. SetTimerEx("HorseTimer", 15000, false, "i", playerid);
  294. PlayerPlaySound(playerid, 3200, 0.0, 0.0, 0.0);
  295. format(szMiscArray, sizeof(szMiscArray), "%s places their bet and waits for the race to start", GetPlayerNameEx(playerid));
  296. ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  297. SendClientMessage(playerid, COLOR_GREY, "**Announcer** And they're off!.");
  298. }
  299. else return SendClientMessage(playerid, COLOR_GREY,"You don't have enough money to place the bet.");
  300. }
  301. case 1:
  302. {
  303. if(PlayerInfo[playerid][pCash] >= 32000)
  304. {
  305. if(Businesses[InBusiness(playerid)][bSafeBalance] < 70000) return SendClientMessage(playerid, COLOR_GREY, "The casino doesn't have enough money.");
  306. PlayerInfo[playerid][pHorse] = 2;
  307. TogglePlayerControllable(playerid, 0);
  308. GivePlayerCash(playerid, -32000);
  309. format(string, sizeof(string), "%s has bet $32000 on a horse", GetPlayerNameEx(playerid));
  310. Log("logs/horse.log", string);
  311. Businesses[InBusiness(playerid)][bSafeBalance] += 32000; // Adds the money to the biz
  312. SaveBusiness(InBusiness(playerid));
  313. SendClientMessage(playerid, COLOR_GREY, "You have placed a bet on Flap's Ahoy for $32000.");
  314. SetTimerEx("HorseTimer", 15000, false, "i", playerid);
  315. PlayerPlaySound(playerid, 3200, 0.0, 0.0, 0.0);
  316. format(szMiscArray, sizeof(szMiscArray), "%s places their bet and waits for the race to start", GetPlayerNameEx(playerid));
  317. ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  318. SendClientMessage(playerid, COLOR_GREY, "**Announcer** And they're off!.");
  319. }
  320. else return SendClientMessage(playerid, COLOR_GREY,"You don't have enough money to place the bet.");
  321. }
  322. case 2:
  323. {
  324. if(PlayerInfo[playerid][pCash] >= 46000)
  325. {
  326. if(Businesses[InBusiness(playerid)][bSafeBalance] < 101000) return SendClientMessage(playerid, COLOR_GREY, "The casino doesn't have enough money.");
  327. PlayerInfo[playerid][pHorse] = 3;
  328. TogglePlayerControllable(playerid, 0);
  329. GivePlayerCash(playerid, -46000);
  330. format(string, sizeof(string), "%s has bet $46000 on a horse", GetPlayerNameEx(playerid));
  331. Log("logs/horse.log", string);
  332. Businesses[InBusiness(playerid)][bSafeBalance] += 46000; // Adds the money to the biz
  333. SaveBusiness(InBusiness(playerid));
  334. SendClientMessage(playerid, COLOR_GREY, "You have placed a bet on Beanflicker for $46000.");
  335. SetTimerEx("HorseTimer", 15000, false, "i", playerid);
  336. PlayerPlaySound(playerid, 1142, 0.0, 0.0, 0.0);
  337. format(szMiscArray, sizeof(szMiscArray), "%s places their bet and waits for the race to start", GetPlayerNameEx(playerid));
  338. ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  339. SendClientMessage(playerid, COLOR_GREY, "**Announcer** And they're off!.");
  340. }
  341. else return SendClientMessage(playerid, COLOR_GREY,"You don't have enough money to place the bet.");
  342. }
  343. case 3:
  344. {
  345. if(PlayerInfo[playerid][pCash] >= 55000)
  346. {
  347. if(Businesses[InBusiness(playerid)][bSafeBalance] < 123000) return SendClientMessage(playerid, COLOR_GREY, "The casino doesn't have enough money.");
  348. PlayerInfo[playerid][pHorse] = 4;
  349. TogglePlayerControllable(playerid, 0);
  350. GivePlayerCash(playerid, -55000);
  351. format(string, sizeof(string), "%s has bet $55000 on a horse", GetPlayerNameEx(playerid));
  352. Log("logs/horse.log", string);
  353. Businesses[InBusiness(playerid)][bSafeBalance] += 55000; // Adds the money to the biz
  354. SaveBusiness(InBusiness(playerid));
  355. SendClientMessage(playerid, COLOR_GREY, "You have placed a bet on Axe Wound for $55000.");
  356. SetTimerEx("HorseTimer", 15000, false, "i", playerid);
  357. PlayerPlaySound(playerid, 3200, 0.0, 0.0, 0.0);
  358. format(szMiscArray, sizeof(szMiscArray), "%s places their bet and waits for the race to start", GetPlayerNameEx(playerid));
  359. ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  360. SendClientMessage(playerid, COLOR_GREY, "**Announcer** And they're off!.");
  361. }
  362. else return SendClientMessage(playerid, COLOR_GREY,"You don't have enough money to place the bet.");
  363. }
  364. case 4:
  365. {
  366. if(PlayerInfo[playerid][pCash] >= 73000)
  367. {
  368. if(Businesses[InBusiness(playerid)][bSafeBalance] < 161000) return SendClientMessage(playerid, COLOR_GREY, "The casino doesn't have enough money.");
  369. PlayerInfo[playerid][pHorse] = 5;
  370. TogglePlayerControllable(playerid, 0);
  371. GivePlayerCash(playerid, -73000);
  372. format(string, sizeof(string), "%s has bet $73000 on a horse", GetPlayerNameEx(playerid));
  373. Log("logs/horse.log", string);
  374. Businesses[InBusiness(playerid)][bSafeBalance] += 73000; // Adds the money to the biz
  375. SaveBusiness(InBusiness(playerid));
  376. SendClientMessage(playerid, COLOR_GREY, "You have placed a bet on McTagnut & Fries for $73000.");
  377. SetTimerEx("HorseTimer", 15000, false, "i", playerid);
  378. PlayerPlaySound(playerid, 1142, 0.0, 0.0, 0.0);
  379. format(szMiscArray, sizeof(szMiscArray), "%s places their bet and waits for the race to start", GetPlayerNameEx(playerid));
  380. ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  381. SendClientMessage(playerid, COLOR_GREY, "**Announcer** And they're off!.");
  382. }
  383. else return SendClientMessage(playerid, COLOR_GREY,"You don't have enough money to place the bet.");
  384. }
  385. case 5:
  386. {
  387. if(PlayerInfo[playerid][pCash] >= 150000)
  388. {
  389. if(Businesses[InBusiness(playerid)][bSafeBalance] < 330000) return SendClientMessage(playerid, COLOR_GREY, "The casino doesn't have enough money.");
  390. PlayerInfo[playerid][pHorse] = 6;
  391. TogglePlayerControllable(playerid, 0);
  392. GivePlayerCash(playerid, -150000);
  393. format(string, sizeof(string), "%s has bet $150000 on a horse", GetPlayerNameEx(playerid));
  394. Log("logs/horse.log", string);
  395. Businesses[InBusiness(playerid)][bSafeBalance] += 150000; // Adds the money to the biz
  396. SaveBusiness(InBusiness(playerid));
  397. SendClientMessage(playerid, COLOR_GREY, "You have placed a bet on Love Torpedo for $150000.");
  398. SetTimerEx("HorseTimer", 15000, false, "i", playerid);
  399. PlayerPlaySound(playerid, 3200, 0.0, 0.0, 0.0);
  400. format(szMiscArray, sizeof(szMiscArray), "%s places their bet and waits for the race to start", GetPlayerNameEx(playerid));
  401. ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  402. SendClientMessage(playerid, COLOR_GREY, "**Announcer** And they're off!.");
  403. }
  404. else return SendClientMessage(playerid, COLOR_GREY,"You don't have enough money to place the bet.");
  405. }
  406. case 6:
  407. {
  408. if(PlayerInfo[playerid][pCash] >= 425000)
  409. {
  410. if(Businesses[InBusiness(playerid)][bSafeBalance] < 935000) return SendClientMessage(playerid, COLOR_GREY, "The casino doesn't have enough money.");
  411. PlayerInfo[playerid][pHorse] = 7;
  412. TogglePlayerControllable(playerid, 0);
  413. GivePlayerCash(playerid, -425000);
  414. format(string, sizeof(string), "%s has bet $425000 on a horse", GetPlayerNameEx(playerid));
  415. Log("logs/horse.log", string);
  416. Businesses[InBusiness(playerid)][bSafeBalance] += 425000; // Adds the money to the biz
  417. SaveBusiness(InBusiness(playerid));
  418. SendClientMessage(playerid, COLOR_GREY, "You have placed a bet on Arthur or Martha for $425000.");
  419. SetTimerEx("HorseTimer", 15000, false, "i", playerid);
  420. PlayerPlaySound(playerid, 1142, 0.0, 0.0, 0.0);
  421. format(szMiscArray, sizeof(szMiscArray), "%s places their bet and waits for the race to start", GetPlayerNameEx(playerid));
  422. ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  423. SendClientMessage(playerid, COLOR_GREY, "**Announcer** And they're off!.");
  424. }
  425. else return SendClientMessage(playerid, COLOR_GREY,"You don't have enough money to place the bet.");
  426. }
  427. case 7:
  428. {
  429. if(PlayerInfo[playerid][pCash] >= 875000)
  430. {
  431. if(Businesses[InBusiness(playerid)][bSafeBalance] < 1900000) return SendClientMessage(playerid, COLOR_GREY, "The casino doesn't have enough money.");
  432. PlayerInfo[playerid][pHorse] = 8;
  433. TogglePlayerControllable(playerid, 0);
  434. GivePlayerCash(playerid, -875000);
  435. format(string, sizeof(string), "%s has bet $875000 on a horse", GetPlayerNameEx(playerid));
  436. Log("logs/horse.log", string);
  437. Businesses[InBusiness(playerid)][bSafeBalance] += 875000; // Adds the money to the biz
  438. SaveBusiness(InBusiness(playerid));
  439. SendClientMessage(playerid, COLOR_GREY, "You have placed a bet on Purple Love for $875000.");
  440. SetTimerEx("HorseTimer", 15000, false, "i", playerid);
  441. PlayerPlaySound(playerid, 3200, 0.0, 0.0, 0.0);
  442. format(szMiscArray, sizeof(szMiscArray), "%s places their bet and waits for the race to start", GetPlayerNameEx(playerid));
  443. ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  444. SendClientMessage(playerid, COLOR_GREY, "**Announcer** And they're off!.");
  445. }
  446. else return SendClientMessage(playerid, COLOR_GREY,"You don't have enough money to place the bet.");
  447. }
  448. case 8:
  449. {
  450. if(PlayerInfo[playerid][pCash] >= 10000000)
  451. {
  452. if(Businesses[InBusiness(playerid)][bSafeBalance] < 22000000) return SendClientMessage(playerid, COLOR_GREY, "The casino doesn't have enough money.");
  453. PlayerInfo[playerid][pHorse] = 9;
  454. TogglePlayerControllable(playerid, 0);
  455. GivePlayerCash(playerid, -10000000);
  456. format(string, sizeof(string), "%s has bet $100000000 on a horse", GetPlayerNameEx(playerid));
  457. Log("logs/horse.log", string);
  458. Businesses[InBusiness(playerid)][bSafeBalance] += 10000000; // Adds the money to the biz
  459. SaveBusiness(InBusiness(playerid));
  460. SendClientMessage(playerid, COLOR_GREY, "You have placed a bet on Billy Sastard for $10000000.");
  461. SetTimerEx("HorseTimer", 15000, false, "i", playerid);
  462. PlayerPlaySound(playerid, 3200, 0.0, 0.0, 0.0);
  463. format(szMiscArray, sizeof(szMiscArray), "%s places their bet and waits for the race to start", GetPlayerNameEx(playerid));
  464. ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  465. SendClientMessage(playerid, COLOR_GREY, "**Announcer** And they're off!.");
  466. }
  467. else return SendClientMessage(playerid, COLOR_GREY,"You don't have enough money to place the bet.");
  468. }
  469. }
  470. }
  471. }
  472. }
  473. return 1;
  474. }*/
  475. forward HorseTimer(playerid);
  476. public HorseTimer(playerid)
  477. {
  478. TogglePlayerControllable(playerid, 1);
  479. new
  480. a = PlayerInfo[playerid][pHorse];
  481. switch (a)
  482. {
  483. case 1: // If the player selected the first horse
  484. {
  485. new Bet1 = random(3); // The chance
  486. if (Bet1 == 1)
  487. {
  488. SendClientMessage(playerid, COLOR_GREY, "Congratulations, Your horse won the race.");
  489. SendClientMessage(playerid, COLOR_GREY, "You won $40000.");
  490. GivePlayerCash(playerid, 40000);
  491. PlayerInfo[playerid][pHorse] = 0;
  492. Businesses[InBusiness(playerid)][bSafeBalance] -= 40000; // Removes the money from the biz
  493. SaveBusiness(InBusiness(playerid));
  494. }
  495. else
  496. {
  497. SendClientMessage(playerid, COLOR_GREY, "Your horse lost the race.");
  498. PlayerInfo[playerid][pHorse] = 0;
  499. }
  500. }
  501. case 2:
  502. {
  503. new Bet1 = random(3); // The chance
  504. if (Bet1 == 1)
  505. {
  506. SendClientMessage(playerid, COLOR_GREY, "Congratulations, Your horse won the race.");
  507. SendClientMessage(playerid, COLOR_GREY, "You won $70000.");
  508. GivePlayerCash(playerid, 70000);
  509. PlayerInfo[playerid][pHorse] = 0;
  510. Businesses[InBusiness(playerid)][bSafeBalance] -= 70000; // Removes the money from the biz
  511. SaveBusiness(InBusiness(playerid));
  512. }
  513. else
  514. {
  515. SendClientMessage(playerid, COLOR_GREY, "Your horse lost the race.");
  516. PlayerInfo[playerid][pHorse] = 0;
  517. }
  518. }
  519. case 3:
  520. {
  521. new Bet1 = random(3); // The chance
  522. if (Bet1 == 1)
  523. {
  524. SendClientMessage(playerid, COLOR_GREY, "Congratulations, Your horse won the race.");
  525. SendClientMessage(playerid, COLOR_GREY, "You won $101000.");
  526. GivePlayerCash(playerid, 101000);
  527. PlayerInfo[playerid][pHorse] = 0;
  528. Businesses[InBusiness(playerid)][bSafeBalance] -= 101000; // Removes the money from the biz
  529. SaveBusiness(InBusiness(playerid));
  530. }
  531. else
  532. {
  533. SendClientMessage(playerid, COLOR_GREY, "Your horse lost the race.");
  534. PlayerInfo[playerid][pHorse] = 0;
  535. }
  536. }
  537. case 4:
  538. {
  539. new Bet1 = random(3); // The chance
  540. if (Bet1 == 1)
  541. {
  542. SendClientMessage(playerid, COLOR_GREY, "Congratulations, Your horse won the race.");
  543. SendClientMessage(playerid, COLOR_GREY, "You won $123000.");
  544. GivePlayerCash(playerid, 123000);
  545. PlayerInfo[playerid][pHorse] = 0;
  546. Businesses[InBusiness(playerid)][bSafeBalance] -= 123000; // Removes the money from the biz
  547. SaveBusiness(InBusiness(playerid));
  548. }
  549. else
  550. {
  551. SendClientMessage(playerid, COLOR_GREY, "Your horse lost the race.");
  552. PlayerInfo[playerid][pHorse] = 0;
  553. }
  554. }
  555. case 5:
  556. {
  557. new Bet1 = random(3); // The chance
  558. if (Bet1 == 1)
  559. {
  560. SendClientMessage(playerid, COLOR_GREY, "Congratulations, Your horse won the race.");
  561. SendClientMessage(playerid, COLOR_GREY, "You won $161000.");
  562. GivePlayerCash(playerid, 161000);
  563. PlayerInfo[playerid][pHorse] = 0;
  564. Businesses[InBusiness(playerid)][bSafeBalance] -= 161000; // Removes the money from the biz
  565. SaveBusiness(InBusiness(playerid));
  566. }
  567. else
  568. {
  569. SendClientMessage(playerid, COLOR_GREY, "Your horse lost the race.");
  570. PlayerInfo[playerid][pHorse] = 0;
  571. }
  572. }
  573. case 6:
  574. {
  575. new Bet1 = random(3); // The chance
  576. if (Bet1 == 1)
  577. {
  578. SendClientMessage(playerid, COLOR_GREY, "Congratulations, Your horse won the race.");
  579. SendClientMessage(playerid, COLOR_GREY, "You won $330000.");
  580. GivePlayerCash(playerid, 330000);
  581. PlayerInfo[playerid][pHorse] = 0;
  582. Businesses[InBusiness(playerid)][bSafeBalance] -= 330000; // Removes the money from the biz
  583. SaveBusiness(InBusiness(playerid));
  584. }
  585. else
  586. {
  587. SendClientMessage(playerid, COLOR_GREY, "Your horse lost the race.");
  588. PlayerInfo[playerid][pHorse] = 0;
  589. }
  590. }
  591. case 7:
  592. {
  593. new Bet1 = random(3); // The chance
  594. if (Bet1 == 1)
  595. {
  596. SendClientMessage(playerid, COLOR_GREY, "Congratulations, Your horse won the race.");
  597. SendClientMessage(playerid, COLOR_GREY, "You won $935000.");
  598. GivePlayerCash(playerid, 935000);
  599. PlayerInfo[playerid][pHorse] = 0;
  600. Businesses[InBusiness(playerid)][bSafeBalance] -= 935000; // Removes the money from the biz
  601. SaveBusiness(InBusiness(playerid));
  602. }
  603. else
  604. {
  605. SendClientMessage(playerid, COLOR_GREY, "Your horse lost the race.");
  606. PlayerInfo[playerid][pHorse] = 0;
  607. }
  608. }
  609. case 8:
  610. {
  611. new Bet1 = random(3); // The chance
  612. if (Bet1 == 1)
  613. {
  614. SendClientMessage(playerid, COLOR_GREY, "Congratulations, Your horse won the race.");
  615. SendClientMessage(playerid, COLOR_GREY, "You won $1900000.");
  616. GivePlayerCash(playerid, 1900000);
  617. PlayerInfo[playerid][pHorse] = 0;
  618. Businesses[InBusiness(playerid)][bSafeBalance] -= 1900000; // Removes the money from the biz
  619. SaveBusiness(InBusiness(playerid));
  620. }
  621. else
  622. {
  623. SendClientMessage(playerid, COLOR_GREY, "Your horse lost the race.");
  624. PlayerInfo[playerid][pHorse] = 0;
  625. }
  626. }
  627. case 9:
  628. {
  629. new Bet1 = random(5); // The chance
  630. if (Bet1 == 1)
  631. {
  632. SendClientMessage(playerid, COLOR_GREY, "Congratulations, Your horse won the race.");
  633. SendClientMessage(playerid, COLOR_GREY, "You won $22000000.");
  634. GivePlayerCash(playerid, 22000000);
  635. PlayerInfo[playerid][pHorse] = 0;
  636. Businesses[InBusiness(playerid)][bSafeBalance] -= 22000000; // Removes the money from the biz
  637. SaveBusiness(InBusiness(playerid));
  638. }
  639. else
  640. {
  641. SendClientMessage(playerid, COLOR_GREY, "Your horse lost the race.");
  642. PlayerInfo[playerid][pHorse] = 0;
  643. }
  644. }
  645. }
  646. return 1;
  647. }