Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- forward UpdateGameDice(s);
- public UpdateGameDice(s)
- {
- new wait_game_dice[10], count_players = 0, count_score = 0;
- format(wait_game_dice,10,"~y~%d",InfoDice[s][dice_game_start_time] - gettime());
- for(new c = 0; c < 5; c++)
- {
- if(InfoDice[s][dice_gamer][c]==INVALID_PLAYER_ID) continue;
- if(InfoDice[s][dice_score][c]) count_score++;
- count_players++;
- GameTextForPlayer(InfoDice[s][dice_gamer][c],wait_game_dice,1200,6);
- }
- GameTextForPlayer(InfoDice[s][dice_crup],wait_game_dice,1200,6);
- if(InfoDice[s][dice_game_start_time]<=gettime() || (count_players == count_score))
- {
- new maxs = 0, ids = -1, str_win_dice[144];
- if ( ids != -1 )
- {
- for(new c = 0; c < 5; c++)
- {
- if(InfoDice[s][dice_score][c]==0) continue;
- if(InfoDice[s][dice_score][c] > maxs)
- {
- maxs = InfoDice[s][dice_score][c];
- ids = InfoDice[s][dice_gamer][c];
- InfoDice[s][dice_score][c]=0;
- }
- }
- }
- if ( ids != -1 )
- {
- format(str_win_dice,144,"Èãðà çàâåðøåíà. Ïîáåäèòåëü: %s.",PLAYER_DATA[ids][data_NAME],ids);
- PLAYER_DATA[ids][data_DONATE] += InfoDice[s][dice_bank];
- }
- for(new c = 0; c < 5; c++)
- {
- if(InfoDice[s][dice_gamer][c]==INVALID_PLAYER_ID) continue;
- Casino_Flag[InfoDice[s][dice_gamer][c]][casino_bet_cash]=0;
- if ( ids != -1 )SendClientMessage(InfoDice[s][dice_gamer][c], COLOR_WARNING, str_win_dice);
- }
- SendClientMessage(InfoDice[s][dice_crup], COLOR_WARNING, str_win_dice);
- UpdateTextCasino(s);
- UpdateScores(s);
- InfoDice[s][dice_bank] = 0;
- InfoDice[s][dice_game_start] = false;
- KillTimer(InfoDice[s][dice_game_start_timer]);
- InfoDice[s][dice_game_start_timer] = -1;
- }
- return 1;
- }
- stock UpdateTableText(c)
- {
- new update_table_text[256];
- format(update_table_text, 256, "%s~n~%s~n~%s~n~%s~n~%s",
- (InfoDice[c][dice_gamer][0]==INVALID_PLAYER_ID)?("-"):(PLAYER_DATA[InfoDice[c][dice_gamer][0]][data_NAME]),
- (InfoDice[c][dice_gamer][1]==INVALID_PLAYER_ID)?("-"):(PLAYER_DATA[InfoDice[c][dice_gamer][1]][data_NAME]),
- (InfoDice[c][dice_gamer][2]==INVALID_PLAYER_ID)?("-"):(PLAYER_DATA[InfoDice[c][dice_gamer][2]][data_NAME]),
- (InfoDice[c][dice_gamer][3]==INVALID_PLAYER_ID)?("-"):(PLAYER_DATA[InfoDice[c][dice_gamer][3]][data_NAME]),
- (InfoDice[c][dice_gamer][4]==INVALID_PLAYER_ID)?("-"):(PLAYER_DATA[InfoDice[c][dice_gamer][4]][data_NAME]));
- TextDrawSetString(Casino_TD_TableNicks[c],update_table_text);
- //print(update_table_text);
- //Casino_TD_TableNicks[c] = TextDrawCreate(480.234466, 190.749984, "-~n~-~n~-~n~-~n~-");
- return 1;
- }
- stock UpdateScores(s)
- {
- new string_set_score[64];
- 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]);
- TextDrawSetString(Casino_TD_TableScore[s],string_set_score);
- return 1;
- }
- stock UpdateTextCasino(c)
- {
- for(new p = 0; p < 5; p++)
- {
- if(InfoDice[c][dice_gamer][p]==INVALID_PLAYER_ID) continue;
- if(Casino_Flag[InfoDice[c][dice_gamer][p]][show_casino_td]==1)
- {
- new ptd_dice_string[24],ptd_dice_string_1[30],ptd_dice_string_2[30];
- format(ptd_dice_string,24,"C¦A‹KA: %d",InfoDice[c][dice_stavka]);
- PlayerTextDrawSetString(InfoDice[c][dice_gamer][p],CASINO_PTD[0][InfoDice[c][dice_gamer][p]],ptd_dice_string);
- format(ptd_dice_string_1,30,"O—Š…†_—A®K: %d",InfoDice[c][dice_bank]);
- PlayerTextDrawSetString(InfoDice[c][dice_gamer][p],CASINO_PTD[1][InfoDice[c][dice_gamer][p]],ptd_dice_string_1);
- format(ptd_dice_string_2,30,"‹AŽ_—A‡A®C: %d",PLAYER_DATA[c][data_DONATE]);
- PlayerTextDrawSetString(InfoDice[c][dice_gamer][p],CASINO_PTD[2][InfoDice[c][dice_gamer][p]],ptd_dice_string_2);
- }
- }
- if(InfoDice[c][dice_crup] != INVALID_PLAYER_ID)
- {
- if(Casino_Flag[InfoDice[c][dice_crup]][show_casino_td]==1)
- {
- new ptd_dice_string[24],ptd_dice_string_1[30],ptd_dice_string_2[30];
- format(ptd_dice_string,24,"C¦A‹KA: %d",InfoDice[c][dice_stavka]);
- PlayerTextDrawSetString(InfoDice[c][dice_gamer],CASINO_PTD[0][InfoDice[c][dice_crup]],ptd_dice_string);
- format(ptd_dice_string_1,30,"O—Š…†_—A®K: %d",InfoDice[c][dice_bank]);
- PlayerTextDrawSetString(InfoDice[c][dice_gamer],CASINO_PTD[1][InfoDice[c][dice_crup]],ptd_dice_string_1);
- format(ptd_dice_string_2,30,"‹AŽ_—A‡A®C: %d",PLAYER_DATA[c][data_DONATE]);
- PlayerTextDrawSetString(InfoDice[c][dice_gamer],CASINO_PTD[2][InfoDice[c][dice_crup]],ptd_dice_string_2);
- }
- }
- UpdateTableText(c);
- UpdateScores(c);
- return 1;
- }
- stock ShowCasino_TD(playerid, select_table, bool:canceled=true)
- {
- if(Casino_Flag[playerid][show_casino_td]==1)
- {
- if(Casino_Flag[playerid][casino_bet_cash]!=0)
- {
- PLAYER_DATA[playerid][data_DONATE] += Casino_Flag[playerid][casino_bet_cash];
- InfoDice[select_table][dice_bank] -= InfoDice[select_table][dice_stavka];
- Casino_Flag[playerid][casino_bet_cash]=0;
- }
- if ( InfoDice[select_table][dice_crup] == playerid )
- {
- for(new i = 0;i<5;i++)
- {
- if(InfoDice[select_table][dice_gamer][i]==INVALID_PLAYER_ID) continue;
- if(!InfoDice[select_table][dice_game_start])
- {
- if(Casino_Flag[InfoDice[select_table][dice_gamer][i]][casino_bet_cash]!=0)
- {
- PLAYER_DATA[InfoDice[select_table][dice_gamer][i]][data_DONATE] += Casino_Flag[InfoDice[select_table][dice_gamer][i]][casino_bet_cash];
- InfoDice[select_table][dice_bank] -= InfoDice[select_table][dice_stavka];
- Casino_Flag[InfoDice[select_table][dice_gamer][i]][casino_bet_cash]=0;
- }
- SendClientMessage(InfoDice[select_table][dice_gamer][i],COLOR_WARNING,"Êðóïüå ïîêèíóë ñòîë. Ñòàâêè îáíóëåíû.");
- }
- else InfoDice[select_table][dice_game_start_time] = gettime();
- }
- InfoDice[select_table][dice_stavka] = 0;
- InfoDice[select_table][dice_crup] = INVALID_PLAYER_ID;
- }
- else
- {
- for(new i = 0;i<5;i++)
- {
- if(InfoDice[select_table][dice_gamer][i]==playerid)
- {
- InfoDice[select_table][dice_score][i] = 0;
- InfoDice[select_table][dice_gamer][i] = INVALID_PLAYER_ID;
- break;
- }
- }
- }
- UpdateScores(select_table);
- UpdateTextCasino(select_table);
- for(new i = 0; i < 18; i++) TextDrawHideForPlayer(playerid,CASINO_TD[i]);
- for(new i = 0; i < 3; i++) PlayerTextDrawHide(playerid,CASINO_PTD[playerid][i]);
- TextDrawHideForPlayer(playerid,Casino_TD_TableNicks[select_table]);
- TextDrawHideForPlayer(playerid,Casino_TD_TableScore[select_table]);
- TextDrawHideForPlayer(playerid,Casino_TD_TableName[select_table]);
- if(canceled) CancelSelectTextDraw(playerid);
- Casino_Flag[playerid][show_casino_td]=0;
- Casino_Flag[playerid][select_casino_table] = -1;
- return 1;
- }
- for(new i = 0; i < 18; i++) TextDrawShowForPlayer(playerid,CASINO_TD[i]);
- for(new i = 0; i < 3; i++) PlayerTextDrawShow(playerid,CASINO_PTD[playerid][i]);
- TextDrawShowForPlayer(playerid,Casino_TD_TableNicks[select_table]);
- TextDrawShowForPlayer(playerid,Casino_TD_TableScore[select_table]);
- TextDrawShowForPlayer(playerid,Casino_TD_TableName[select_table]);
- SelectTextDraw(playerid,COLOR_BLUE);
- Casino_Flag[playerid][show_casino_td]=1;
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement