Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.12 KB | None | 0 0
  1. forward UpdateGameDice(s);
  2. public UpdateGameDice(s)
  3. {
  4. new wait_game_dice[10], count_players = 0, count_score = 0;
  5. format(wait_game_dice,10,"~y~%d",InfoDice[s][dice_game_start_time] - gettime());
  6. for(new c = 0; c < 5; c++)
  7. {
  8. if(InfoDice[s][dice_gamer][c]==INVALID_PLAYER_ID) continue;
  9. if(InfoDice[s][dice_score][c]) count_score++;
  10. count_players++;
  11. GameTextForPlayer(InfoDice[s][dice_gamer][c],wait_game_dice,1200,6);
  12. }
  13. GameTextForPlayer(InfoDice[s][dice_crup],wait_game_dice,1200,6);
  14. if(InfoDice[s][dice_game_start_time]<=gettime() || (count_players == count_score))
  15. {
  16. new maxs = 0, ids = -1, str_win_dice[144];
  17. if ( ids != -1 )
  18. {
  19. for(new c = 0; c < 5; c++)
  20. {
  21. if(InfoDice[s][dice_score][c]==0) continue;
  22. if(InfoDice[s][dice_score][c] > maxs)
  23. {
  24. maxs = InfoDice[s][dice_score][c];
  25. ids = InfoDice[s][dice_gamer][c];
  26. InfoDice[s][dice_score][c]=0;
  27. }
  28. }
  29. }
  30. if ( ids != -1 )
  31. {
  32. format(str_win_dice,144,"Èãðà çàâåðøåíà. Ïîáåäèòåëü: %s.",PLAYER_DATA[ids][data_NAME],ids);
  33. PLAYER_DATA[ids][data_DONATE] += InfoDice[s][dice_bank];
  34. }
  35. for(new c = 0; c < 5; c++)
  36. {
  37. if(InfoDice[s][dice_gamer][c]==INVALID_PLAYER_ID) continue;
  38. Casino_Flag[InfoDice[s][dice_gamer][c]][casino_bet_cash]=0;
  39. if ( ids != -1 )SendClientMessage(InfoDice[s][dice_gamer][c], COLOR_WARNING, str_win_dice);
  40. }
  41. SendClientMessage(InfoDice[s][dice_crup], COLOR_WARNING, str_win_dice);
  42. UpdateTextCasino(s);
  43. UpdateScores(s);
  44. InfoDice[s][dice_bank] = 0;
  45. InfoDice[s][dice_game_start] = false;
  46. KillTimer(InfoDice[s][dice_game_start_timer]);
  47. InfoDice[s][dice_game_start_timer] = -1;
  48. }
  49. return 1;
  50. }
  51.  
  52. stock UpdateTableText(c)
  53. {
  54. new update_table_text[256];
  55. format(update_table_text, 256, "%s~n~%s~n~%s~n~%s~n~%s",
  56. (InfoDice[c][dice_gamer][0]==INVALID_PLAYER_ID)?("-"):(PLAYER_DATA[InfoDice[c][dice_gamer][0]][data_NAME]),
  57. (InfoDice[c][dice_gamer][1]==INVALID_PLAYER_ID)?("-"):(PLAYER_DATA[InfoDice[c][dice_gamer][1]][data_NAME]),
  58. (InfoDice[c][dice_gamer][2]==INVALID_PLAYER_ID)?("-"):(PLAYER_DATA[InfoDice[c][dice_gamer][2]][data_NAME]),
  59. (InfoDice[c][dice_gamer][3]==INVALID_PLAYER_ID)?("-"):(PLAYER_DATA[InfoDice[c][dice_gamer][3]][data_NAME]),
  60. (InfoDice[c][dice_gamer][4]==INVALID_PLAYER_ID)?("-"):(PLAYER_DATA[InfoDice[c][dice_gamer][4]][data_NAME]));
  61. TextDrawSetString(Casino_TD_TableNicks[c],update_table_text);
  62. //print(update_table_text);
  63. //Casino_TD_TableNicks[c] = TextDrawCreate(480.234466, 190.749984, "-~n~-~n~-~n~-~n~-");
  64. return 1;
  65. }
  66. stock UpdateScores(s)
  67. {
  68. new string_set_score[64];
  69. format(string_set_score,64,"%d~n~%d~n~%d~n~%d~n~%d",InfoDice[s][dice_score][0],InfoDice[s][dice_score][1],InfoDice[s][dice_score][2],InfoDice[s][dice_score][3],InfoDice[s][dice_score][4]);
  70. TextDrawSetString(Casino_TD_TableScore[s],string_set_score);
  71. return 1;
  72. }
  73. stock UpdateTextCasino(c)
  74. {
  75. for(new p = 0; p < 5; p++)
  76. {
  77. if(InfoDice[c][dice_gamer][p]==INVALID_PLAYER_ID) continue;
  78. if(Casino_Flag[InfoDice[c][dice_gamer][p]][show_casino_td]==1)
  79. {
  80. new ptd_dice_string[24],ptd_dice_string_1[30],ptd_dice_string_2[30];
  81. format(ptd_dice_string,24,"C¦A‹KA: %d",InfoDice[c][dice_stavka]);
  82. PlayerTextDrawSetString(InfoDice[c][dice_gamer][p],CASINO_PTD[0][InfoDice[c][dice_gamer][p]],ptd_dice_string);
  83. format(ptd_dice_string_1,30,"O—Š…†_—A®K: %d",InfoDice[c][dice_bank]);
  84. PlayerTextDrawSetString(InfoDice[c][dice_gamer][p],CASINO_PTD[1][InfoDice[c][dice_gamer][p]],ptd_dice_string_1);
  85. format(ptd_dice_string_2,30,"‹AŽ_—A‡A®C: %d",PLAYER_DATA[c][data_DONATE]);
  86. PlayerTextDrawSetString(InfoDice[c][dice_gamer][p],CASINO_PTD[2][InfoDice[c][dice_gamer][p]],ptd_dice_string_2);
  87. }
  88. }
  89. if(InfoDice[c][dice_crup] != INVALID_PLAYER_ID)
  90. {
  91. if(Casino_Flag[InfoDice[c][dice_crup]][show_casino_td]==1)
  92. {
  93. new ptd_dice_string[24],ptd_dice_string_1[30],ptd_dice_string_2[30];
  94. format(ptd_dice_string,24,"C¦A‹KA: %d",InfoDice[c][dice_stavka]);
  95. PlayerTextDrawSetString(InfoDice[c][dice_gamer],CASINO_PTD[0][InfoDice[c][dice_crup]],ptd_dice_string);
  96. format(ptd_dice_string_1,30,"O—Š…†_—A®K: %d",InfoDice[c][dice_bank]);
  97. PlayerTextDrawSetString(InfoDice[c][dice_gamer],CASINO_PTD[1][InfoDice[c][dice_crup]],ptd_dice_string_1);
  98. format(ptd_dice_string_2,30,"‹AŽ_—A‡A®C: %d",PLAYER_DATA[c][data_DONATE]);
  99. PlayerTextDrawSetString(InfoDice[c][dice_gamer],CASINO_PTD[2][InfoDice[c][dice_crup]],ptd_dice_string_2);
  100. }
  101. }
  102. UpdateTableText(c);
  103. UpdateScores(c);
  104. return 1;
  105. }
  106. stock ShowCasino_TD(playerid, select_table, bool:canceled=true)
  107. {
  108. if(Casino_Flag[playerid][show_casino_td]==1)
  109. {
  110. if(Casino_Flag[playerid][casino_bet_cash]!=0)
  111. {
  112. PLAYER_DATA[playerid][data_DONATE] += Casino_Flag[playerid][casino_bet_cash];
  113. InfoDice[select_table][dice_bank] -= InfoDice[select_table][dice_stavka];
  114. Casino_Flag[playerid][casino_bet_cash]=0;
  115. }
  116. if ( InfoDice[select_table][dice_crup] == playerid )
  117. {
  118. for(new i = 0;i<5;i++)
  119. {
  120. if(InfoDice[select_table][dice_gamer][i]==INVALID_PLAYER_ID) continue;
  121. if(!InfoDice[select_table][dice_game_start])
  122. {
  123. if(Casino_Flag[InfoDice[select_table][dice_gamer][i]][casino_bet_cash]!=0)
  124. {
  125. PLAYER_DATA[InfoDice[select_table][dice_gamer][i]][data_DONATE] += Casino_Flag[InfoDice[select_table][dice_gamer][i]][casino_bet_cash];
  126. InfoDice[select_table][dice_bank] -= InfoDice[select_table][dice_stavka];
  127. Casino_Flag[InfoDice[select_table][dice_gamer][i]][casino_bet_cash]=0;
  128. }
  129. SendClientMessage(InfoDice[select_table][dice_gamer][i],COLOR_WARNING,"Êðóïüå ïîêèíóë ñòîë. Ñòàâêè îáíóëåíû.");
  130. }
  131. else InfoDice[select_table][dice_game_start_time] = gettime();
  132. }
  133. InfoDice[select_table][dice_stavka] = 0;
  134. InfoDice[select_table][dice_crup] = INVALID_PLAYER_ID;
  135. }
  136. else
  137. {
  138. for(new i = 0;i<5;i++)
  139. {
  140. if(InfoDice[select_table][dice_gamer][i]==playerid)
  141. {
  142. InfoDice[select_table][dice_score][i] = 0;
  143. InfoDice[select_table][dice_gamer][i] = INVALID_PLAYER_ID;
  144. break;
  145. }
  146. }
  147. }
  148. UpdateScores(select_table);
  149. UpdateTextCasino(select_table);
  150. for(new i = 0; i < 18; i++) TextDrawHideForPlayer(playerid,CASINO_TD[i]);
  151. for(new i = 0; i < 3; i++) PlayerTextDrawHide(playerid,CASINO_PTD[playerid][i]);
  152. TextDrawHideForPlayer(playerid,Casino_TD_TableNicks[select_table]);
  153. TextDrawHideForPlayer(playerid,Casino_TD_TableScore[select_table]);
  154. TextDrawHideForPlayer(playerid,Casino_TD_TableName[select_table]);
  155. if(canceled) CancelSelectTextDraw(playerid);
  156. Casino_Flag[playerid][show_casino_td]=0;
  157. Casino_Flag[playerid][select_casino_table] = -1;
  158. return 1;
  159. }
  160. for(new i = 0; i < 18; i++) TextDrawShowForPlayer(playerid,CASINO_TD[i]);
  161. for(new i = 0; i < 3; i++) PlayerTextDrawShow(playerid,CASINO_PTD[playerid][i]);
  162. TextDrawShowForPlayer(playerid,Casino_TD_TableNicks[select_table]);
  163. TextDrawShowForPlayer(playerid,Casino_TD_TableScore[select_table]);
  164. TextDrawShowForPlayer(playerid,Casino_TD_TableName[select_table]);
  165. SelectTextDraw(playerid,COLOR_BLUE);
  166. Casino_Flag[playerid][show_casino_td]=1;
  167. return 1;
  168. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement