Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
10 kB
2
Indexable
Never
#define 		SHOWLIST_BC         (5096)
#define         MAX_BAICAO          50
#define         MAX_PLAYER_BC       4

#define         STATUS_BC_SORT      1
#define         STATUS_BC_TRIBUTE   2
#define			STATUS_BC_WAIT      3

enum BaiCaoInfo {
    bc_Status,
    bc_Count,
    bc_Timer,
    bc_Player,
    bc_Players[4],
    bc_Money,
};
new BCInfo[MAX_BAICAO][BaiCaoInfo];

enum BaiCaoPlayer {
    pBC_Point,
    pBC_Slot,
    pBC_Card[3],
    pBC_ID,
};
new PlayerBC[MAX_PLAYERS][BaiCaoPlayer];

new PlayerText:BAICAO_TDE[MAX_PLAYERS][19];
new PlayerText:MainBaiCao[MAX_PLAYERS][9];

public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid)
{
    if(PlayerBC[playerid][pBC_ID] != -1 || PlayerBC[playerid][pBC_Slot] != -1) {
        if(playertextid == MainBaiCao[playerid][8]) {
            QuitBCForPlayer(playerid, PlayerBC[playerid][pBC_ID]);
		}
	}
    if(PlayerBC[playerid][pBC_ID] != -1 || PlayerBC[playerid][pBC_Slot] != -1) {
        new bcid = PlayerBC[playerid][pBC_ID];
        for(new l = 0; l < MAX_PLAYER_BC; l++) {
            if(BCInfo[bcid][bc_Players][l] != INVALID_PLAYER_ID) {
                if(l == 0) {
                    if(playertextid == BAICAO_TDE[playerid][7]) {
						if(BCInfo[bcid][bc_Status] != STATUS_BC_TRIBUTE) {
						    SendClientMessageEx(playerid, COLOR_GREY, "Hien tai chua den thoi gian kiem tra bai.");
							return 1;
						}
                        if(PlayerBC[playerid][pBC_Card][0] == 0)
				        {
				            new randz = randomEx(1,9),tempstring[255];
				            PlayerBC[playerid][pBC_Card][0] = randz;
				            format(tempstring, sizeof(tempstring), "%s", DeckBCTextDraw(randz));
				            PlayerTextDrawSetString(playerid, BAICAO_TDE[playerid][7], tempstring);
				            BCTextDrawSetString(bcid, 7, tempstring);
				        }
                    }
                    if(playertextid == BAICAO_TDE[playerid][8]) {
                        if(BCInfo[bcid][bc_Status] != STATUS_BC_TRIBUTE) {
						    SendClientMessageEx(playerid, COLOR_GREY, "Hien tai chua den thoi gian kiem tra bai.");
							return 1;
						}
                        if(PlayerBC[playerid][pBC_Card][1] == 0)
				        {
				            new randz = randomEx(1,9),tempstring[255];
				            PlayerBC[playerid][pBC_Card][1] = randz;
				            format(tempstring, sizeof(tempstring), "%s", DeckBCTextDraw(randz));
				            PlayerTextDrawSetString(playerid, BAICAO_TDE[playerid][8], tempstring);
				            BCTextDrawSetString(bcid, 8, tempstring);
				        }
                    }
                    if(playertextid == BAICAO_TDE[playerid][9]) {
                        if(BCInfo[bcid][bc_Status] != STATUS_BC_TRIBUTE) {
						    SendClientMessageEx(playerid, COLOR_GREY, "Hien tai chua den thoi gian kiem tra bai.");
							return 1;
						}
                        if(PlayerBC[playerid][pBC_Card][2] == 0)
				        {
				            new randz = randomEx(1,9),tempstring[255];
				            PlayerBC[playerid][pBC_Card][2] = randz;
				            format(tempstring, sizeof(tempstring), "%s", DeckBCTextDraw(randz));
				            PlayerTextDrawSetString(playerid, BAICAO_TDE[playerid][9], tempstring);
				            BCTextDrawSetString(bcid, 9, tempstring);
				        }
                    }
                }
                //-------------
                if(l == 1) {
                    if(playertextid == BAICAO_TDE[playerid][10]) {
                        if(BCInfo[bcid][bc_Status] != STATUS_BC_TRIBUTE) {
						    SendClientMessageEx(playerid, COLOR_GREY, "Hien tai chua den thoi gian kiem tra bai.");
							return 1;
						}
                        if(PlayerBC[playerid][pBC_Card][0] == 0)
				        {
				            new randz = randomEx(1,9),tempstring[255];
				            PlayerBC[playerid][pBC_Card][0] = randz;
				            format(tempstring, sizeof(tempstring), "%s", DeckBCTextDraw(randz));
				            PlayerTextDrawSetString(playerid, BAICAO_TDE[playerid][10], tempstring);
				            BCTextDrawSetString(bcid, 10, tempstring);
				        }
                    }
                    if(playertextid == BAICAO_TDE[playerid][11]) {
                        if(BCInfo[bcid][bc_Status] != STATUS_BC_TRIBUTE) {
						    SendClientMessageEx(playerid, COLOR_GREY, "Hien tai chua den thoi gian kiem tra bai.");
							return 1;
						}
                        if(PlayerBC[playerid][pBC_Card][1] == 0)
				        {
				            new randz = randomEx(1,9),tempstring[255];
				            PlayerBC[playerid][pBC_Card][1] = randz;
				            format(tempstring, sizeof(tempstring), "%s", DeckBCTextDraw(randz));
				            PlayerTextDrawSetString(playerid, BAICAO_TDE[playerid][11], tempstring);
				            BCTextDrawSetString(bcid, 11, tempstring);
				        }
                    }
                    if(playertextid == BAICAO_TDE[playerid][12]) {
                        if(BCInfo[bcid][bc_Status] != STATUS_BC_TRIBUTE) {
						    SendClientMessageEx(playerid, COLOR_GREY, "Hien tai chua den thoi gian kiem tra bai.");
							return 1;
						}
                        if(PlayerBC[playerid][pBC_Card][2] == 0)
				        {
				            new randz = randomEx(1,9),tempstring[255];
				            PlayerBC[playerid][pBC_Card][2] = randz;
				            format(tempstring, sizeof(tempstring), "%s", DeckBCTextDraw(randz));
				            PlayerTextDrawSetString(playerid, BAICAO_TDE[playerid][12], tempstring);
				            BCTextDrawSetString(bcid, 12, tempstring);
				        }
                    }
                }
                //-------------
                if(l == 2) {
                    if(playertextid == BAICAO_TDE[playerid][13]) {
                        if(BCInfo[bcid][bc_Status] != STATUS_BC_TRIBUTE) {
						    SendClientMessageEx(playerid, COLOR_GREY, "Hien tai chua den thoi gian kiem tra bai.");
							return 1;
						}
                        if(PlayerBC[playerid][pBC_Card][0] == 0)
				        {
				            new randz = randomEx(1,9),tempstring[255];
				            PlayerBC[playerid][pBC_Card][0] = randz;
				            format(tempstring, sizeof(tempstring), "%s", DeckBCTextDraw(randz));
				            PlayerTextDrawSetString(playerid, BAICAO_TDE[playerid][13], tempstring);
				            BCTextDrawSetString(bcid, 13, tempstring);
				        }
                    }
                    if(playertextid == BAICAO_TDE[playerid][14]) {
                        if(BCInfo[bcid][bc_Status] != STATUS_BC_TRIBUTE) {
						    SendClientMessageEx(playerid, COLOR_GREY, "Hien tai chua den thoi gian kiem tra bai.");
							return 1;
						}
                        if(PlayerBC[playerid][pBC_Card][1] == 0)
				        {
				            new randz = randomEx(1,9),tempstring[255];
				            PlayerBC[playerid][pBC_Card][1] = randz;
				            format(tempstring, sizeof(tempstring), "%s", DeckBCTextDraw(randz));
				            PlayerTextDrawSetString(playerid, BAICAO_TDE[playerid][14], tempstring);
				            BCTextDrawSetString(bcid, 14, tempstring);
				        }
                    }
                    if(playertextid == BAICAO_TDE[playerid][15]) {
                        if(BCInfo[bcid][bc_Status] != STATUS_BC_TRIBUTE) {
						    SendClientMessageEx(playerid, COLOR_GREY, "Hien tai chua den thoi gian kiem tra bai.");
							return 1;
						}
                        if(PlayerBC[playerid][pBC_Card][2] == 0)
				        {
				            new randz = randomEx(1,9),tempstring[255];
				            PlayerBC[playerid][pBC_Card][2] = randz;
				            format(tempstring, sizeof(tempstring), "%s", DeckBCTextDraw(randz));
				            PlayerTextDrawSetString(playerid, BAICAO_TDE[playerid][15], tempstring);
				            BCTextDrawSetString(bcid, 15, tempstring);
				        }
                    }
                }
                //-------------
                if(l == 3) {
                    if(playertextid == BAICAO_TDE[playerid][16]) {
                        if(BCInfo[bcid][bc_Status] != STATUS_BC_TRIBUTE) {
						    SendClientMessageEx(playerid, COLOR_GREY, "Hien tai chua den thoi gian kiem tra bai.");
							return 1;
						}
                        if(PlayerBC[playerid][pBC_Card][0] == 0)
				        {
				            new randz = randomEx(1,9),tempstring[255];
				            PlayerBC[playerid][pBC_Card][0] = randz;
				            format(tempstring, sizeof(tempstring), "%s", DeckBCTextDraw(randz));
				            PlayerTextDrawSetString(playerid, BAICAO_TDE[playerid][16], tempstring);
				            BCTextDrawSetString(bcid, 16, tempstring);
				        }
                    }
                    if(playertextid == BAICAO_TDE[playerid][17]) {
                        if(BCInfo[bcid][bc_Status] != STATUS_BC_TRIBUTE) {
						    SendClientMessageEx(playerid, COLOR_GREY, "Hien tai chua den thoi gian kiem tra bai.");
							return 1;
						}
                        if(PlayerBC[playerid][pBC_Card][1] == 0)
				        {
				            new randz = randomEx(1,9),tempstring[255];
				            PlayerBC[playerid][pBC_Card][1] = randz;
				            format(tempstring, sizeof(tempstring), "%s", DeckBCTextDraw(randz));
				            PlayerTextDrawSetString(playerid, BAICAO_TDE[playerid][17], tempstring);
				            BCTextDrawSetString(bcid, 17, tempstring);
				        }
                    }
                    if(playertextid == BAICAO_TDE[playerid][18]) {
                        if(BCInfo[bcid][bc_Status] != STATUS_BC_TRIBUTE) {
						    SendClientMessageEx(playerid, COLOR_GREY, "Hien tai chua den thoi gian kiem tra bai.");
							return 1;
						}
                        if(PlayerBC[playerid][pBC_Card][2] == 0)
				        {
				            new randz = randomEx(1,9),tempstring[255];
				            PlayerBC[playerid][pBC_Card][2] = randz;
				            format(tempstring, sizeof(tempstring), "%s", DeckBCTextDraw(randz));
				            PlayerTextDrawSetString(playerid, BAICAO_TDE[playerid][18], tempstring);
				            BCTextDrawSetString(bcid, 18, tempstring);
				        }
                    }
                }
            }
        }
    }
    return 1;
}