Advertisement
Guest User

Untitled

a guest
Mar 14th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.14 KB | None | 0 0
  1. new numberLopped[MAX_TEAMS_FOOTBALL];
  2. timer onMatch[30*1000](id) {
  3. if(numberLopped[id] == 0 || numberLopped[id] == 1 || numberLopped[id] == 2) {
  4. new szMessage[256];
  5. szMessage[0] = EOS;
  6.  
  7. new sansaHome = random(100) - floatround(matchVariables[id][cota1]);
  8. new sansaAway = random(100) - floatround(matchVariables[id][cota2]);
  9. new sansaEqual = random(100) - floatround(matchVariables[id][cotaX]);
  10.  
  11. new cases;
  12. if(sansaHome > sansaAway > sansaEqual) cases = 1;
  13. else if(sansaAway > sansaHome > sansaEqual) cases = 3;
  14. else if((sansaEqual > sansaHome > sansaAway) && numberLopped[id] != 0) cases = 2;
  15. else if(numberLopped[id] != 0) cases = 2;
  16. else cases = 1;
  17.  
  18. switch(cases) {
  19. case 1: {
  20. goalshome[id]++;
  21. foreach(new x : betTeam[id]) {
  22. format(szMessage, 256, "{52d467}[BET UPDATE] %s just scored! The score is now %d - %d (%s). Your bet: %s.", matchVariables[id][home], goalshome[id], goalsaway[id], matchVariables[id][nameplm], getMyBet(x));
  23. SCM(x, -1, szMessage);
  24. }
  25. }
  26. case 2: {
  27. foreach(new x : betTeam[id]) {
  28. format(szMessage, 256, "{52d467}[BET UPDATE] The score is still %d - %d (%s). Your bet: %s.", goalshome[id], goalsaway[id], matchVariables[id][nameplm], getMyBet(x));
  29. SCM(x, -1, szMessage);
  30. }
  31. }
  32. case 3: {
  33. goalsaway[id]++;
  34. foreach(new x : betTeam[id]) {
  35. format(szMessage, 256, "{52d467}[BET UPDATE] %s just scored! The score is now %d - %d (%s). Your bet: %s.", matchVariables[id][away], goalshome[id], goalsaway[id], matchVariables[id][nameplm], getMyBet(x));
  36. SCM(x, -1, szMessage);
  37. }
  38. }
  39. }
  40. }
  41. else if(numberLopped[id] == 3) {
  42.  
  43. new szFinal[256];
  44. new win = -1;
  45.  
  46. szFinal[0] = EOS;
  47.  
  48. if(goalsaway[id] > goalshome[id]) {
  49. win = 2;
  50. format(szFinal, 256, "[MATCH OVER]{dad953} %s won against %s. Final score: %d - %d. ", matchVariables[id][away], matchVariables[id][home], goalshome[id], goalsaway[id]);
  51. }
  52. else if(goalsaway[id] < goalshome[id]) {
  53. win = 0;
  54. format(szFinal, 256, "[MATCH OVER]{dad953} %s won against %s. Final score: %d - %d. ", matchVariables[id][home], matchVariables[id][away], goalshome[id], goalsaway[id]);
  55. }
  56. else {
  57. win = 1;
  58. format(szFinal, 256, "[MATCH OVER]{dad953} %s has ended equally. Final score: %d - %d. ", matchVariables[id][nameplm], goalshome[id], goalsaway[id]);
  59. }
  60.  
  61. foreach(new x : betTeam[id]) {
  62. new szMessage[20];
  63. szMessage[0] = EOS;
  64.  
  65. format(szMessage, 20, "Your bet: %s.", getMyBet(x));
  66. strcat(szFinal, szMessage);
  67.  
  68. SCM(x, COLOR_RED, szFinal);
  69.  
  70. if(win == GetPVarInt(x, "betCota")) {
  71. new payment = floatround(GetPVarFloat(x, "betPossibleWin")*GetPVarInt(x, "betMoney"));
  72. GivePlayerMoney(x, payment);
  73.  
  74. new string[256];
  75. format(string, 256, "(+) You've won $%s.", FormatNumber(floatround(GetPVarFloat(x, "betPossibleWin")*GetPVarInt(x, "betMoney"))));
  76. SCM(x, COLOR_RED, string);
  77. }
  78. else SCM(x, COLOR_RED, "(-) You've lost. Try again next time!");
  79.  
  80. deleteBetPVars(x);
  81. Iter_SafeRemove(betTeam[id], x, x);
  82. }
  83. stop playingMatch[id];
  84. playingMatch[id] = Timer:-1;
  85.  
  86. prepareTeams(id);
  87. }
  88. numberLopped[id]++;
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement