[Include] gCasino - Scripted Casino's
#6

Its ok I should have uploaded it as a file anyway

The hardest bit about this was the checking of a players "hand" for poker:

pawn Code:
cPoker_checkGame(playerid) {
   
    new suit_a = cPoker_checkGameContains(playerid, CARD_ACE, CARD_TYPE_NONE, CPOKER_CHECKMODE_CARDSUIT);
    ////printf("suit_a: %i", suit_a);
    new suit_2 = cPoker_checkGameContains(playerid, 2, CARD_TYPE_NONE, CPOKER_CHECKMODE_CARDSUIT);
    ////printf("suit_2: %i", suit_2);
    new suit_3 = cPoker_checkGameContains(playerid, 3, CARD_TYPE_NONE, CPOKER_CHECKMODE_CARDSUIT);
    ////printf("suit_3: %i", suit_3);
    new suit_4 = cPoker_checkGameContains(playerid, 4, CARD_TYPE_NONE, CPOKER_CHECKMODE_CARDSUIT);
    ////printf("suit_4: %i", suit_4);
    new suit_5 = cPoker_checkGameContains(playerid, 5, CARD_TYPE_NONE, CPOKER_CHECKMODE_CARDSUIT);
    ////printf("suit_5: %i", suit_5);

    if (c_suitsEqual(suit_a,suit_2,suit_3,suit_4,suit_5)) {
        ////print("CHECK_ROYALFLUSH");
        return CHECK_ROYALFLUSH;
    }
   
    new suit_10 = cPoker_checkGameContains(playerid, 10, CARD_TYPE_NONE, CPOKER_CHECKMODE_CARDSUIT);
    ////printf("suit_10: %i", suit_10);
    new suit_j = cPoker_checkGameContains(playerid, CARD_JACK, CARD_TYPE_NONE, CPOKER_CHECKMODE_CARDSUIT);
    ////printf("suit_j: %i", suit_j);
    new suit_q = cPoker_checkGameContains(playerid, CARD_QUEEN, CARD_TYPE_NONE, CPOKER_CHECKMODE_CARDSUIT);
    ////printf("suit_q: %i", suit_q);
    new suit_k = cPoker_checkGameContains(playerid, CARD_KING, CARD_TYPE_NONE, CPOKER_CHECKMODE_CARDSUIT);
    ////printf("suit_k: %i", suit_k);
   
    if (c_suitsEqual(suit_10,suit_j,suit_q,suit_k,suit_a)) {
        ////print("CHECK_ROYALFLUSH");
        return CHECK_ROYALFLUSH;
    }
   
    new suit_6 = cPoker_checkGameContains(playerid, 6, CARD_TYPE_NONE, CPOKER_CHECKMODE_CARDSUIT);
    ////printf("suit_6: %i", suit_6);
    new suit_7 = cPoker_checkGameContains(playerid, 7, CARD_TYPE_NONE, CPOKER_CHECKMODE_CARDSUIT);
    ////printf("suit_7: %i", suit_7);
    new suit_8 = cPoker_checkGameContains(playerid, 8, CARD_TYPE_NONE, CPOKER_CHECKMODE_CARDSUIT);
    ////printf("suit_8: %i", suit_8);
    new suit_9 = cPoker_checkGameContains(playerid, 9, CARD_TYPE_NONE, CPOKER_CHECKMODE_CARDSUIT);
    ////printf("suit_9: %i", suit_9);
   
    ////print("CHECK_STRAIGHTFLUSH - START");
    if (c_suitsEqual(suit_2,suit_3,suit_4,suit_5,suit_6)) {
        return CHECK_STRAIGHTFLUSH;
    } else if (c_suitsEqual(suit_3,suit_4,suit_5,suit_6,suit_7)) {
        return CHECK_STRAIGHTFLUSH;
    } else if (c_suitsEqual(suit_4,suit_5,suit_6,suit_7,suit_8)) {
        return CHECK_STRAIGHTFLUSH;
    } else if (c_suitsEqual(suit_5,suit_6,suit_7,suit_8,suit_9)) {
        return CHECK_STRAIGHTFLUSH;
    } else if (c_suitsEqual(suit_6,suit_7,suit_8,suit_9,suit_10)) {
        return CHECK_STRAIGHTFLUSH;
    } else if (c_suitsEqual(suit_7,suit_8,suit_9,suit_10,suit_j)) {
        return CHECK_STRAIGHTFLUSH;
    } else if (c_suitsEqual(suit_8,suit_9,suit_10,suit_j,suit_q)) {
        return CHECK_STRAIGHTFLUSH;
    } else if (c_suitsEqual(suit_9,suit_10,suit_j,suit_q,suit_k)) {
        return CHECK_STRAIGHTFLUSH;
    }
    ////print("CHECK_STRAIGHTFLUSH - END");
   
    new countC[13];
    ////print("CHECK_FOUROFAKIND - START");
    for (new _c=0; _c<5; _c++) {
        new _n = cPokerGame[playerid][_c][1];
        ////printf("_n: %i", _n);
        countC[_n-1]++;
        if (countC[_n-1]==4) {
            ////print("CHECK_FOUROFAKIND");
            return CHECK_FOUROFAKIND;
        }
    }
    ////print("CHECK_FOUROFAKIND - END");
   
    ////print("CHECK_FULLHOUSE - START");
    for (new _card=1; _card<=13; _card++) {
        if (countC[_card-1]==3) {
            for (new _subCard=1; _subCard<=13; _subCard++) {
                if (_subCard != _card) {
                    if (countC[_subCard-1]==2) {
                        //print("CHECK_FULLHOUSE");
                        return CHECK_FULLHOUSE;
                    }
                }
            }
        }
    }
    ////print("CHECK_FULLHOUSE - END");
   
    if (c_Equal(cPokerGame[playerid][0][0],cPokerGame[playerid][1][0],cPokerGame[playerid][2][0],cPokerGame[playerid][3][0],cPokerGame[playerid][4][0])) {
        ////print("CHECK_FLUSH");
        return CHECK_FLUSH;
    }

    ////print("CHECK_STRAIGHT - START");
    if (c_anySuits(suit_a,suit_2,suit_3,suit_4,suit_5)) {
        return CHECK_STRAIGHT;
    } else if (c_anySuits(suit_2,suit_3,suit_4,suit_5,suit_6)) {
        return CHECK_STRAIGHT;
    } else if (c_anySuits(suit_3,suit_4,suit_5,suit_6,suit_7)) {
        return CHECK_STRAIGHT;
    } else if (c_anySuits(suit_4,suit_5,suit_6,suit_7,suit_8)) {
        return CHECK_STRAIGHT;
    } else if (c_anySuits(suit_5,suit_6,suit_7,suit_8,suit_9)) {
        return CHECK_STRAIGHT;
    } else if (c_anySuits(suit_6,suit_7,suit_8,suit_9,suit_10)) {
        return CHECK_STRAIGHT;
    } else if (c_anySuits(suit_7,suit_8,suit_9,suit_10,suit_j)) {
        return CHECK_STRAIGHT;
    } else if (c_anySuits(suit_8,suit_9,suit_10,suit_j,suit_q)) {
        return CHECK_STRAIGHT;
    } else if (c_anySuits(suit_9,suit_10,suit_j,suit_q,suit_k)) {
        return CHECK_STRAIGHT;
    } else if (c_anySuits(suit_10,suit_j,suit_q,suit_k,suit_a)) {
        return CHECK_STRAIGHT;
    }
    ////print("CHECK_STRAIGHT - END");
   
    ////print("CHECK_THREEOFAKIND - START");
    for (new _card=1; _card<=13; _card++) {
        if (countC[_card-1]==3) {
            for (new _subCard=1; _subCard<=13; _subCard++) {
                if (_subCard != _card) {
                    if (countC[_subCard-1]==1) {
                        for (new _subSubCard=1; _subSubCard<=13; _subSubCard++) {
                            if (_subCard != _card && _subSubCard != _card && _subCard != _subSubCard) {
                                if (countC[_subSubCard-1]==1) {
                                    return CHECK_THREEOFAKIND;
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    ////print("CHECK_THREEOFAKIND - END");
   
    ////print("CHECK_TWOPAIRS - START");
    for (new _card=1; _card<=13; _card++) {
        ////printf("_card: %i", _card);
        if (countC[_card-1]==2) {
            ////printf("countC[_card-1]: %i", countC[_card-1]);
            for (new _subCard=1; _subCard<=13; _subCard++) {
                ////printf("_subCard: %i", _subCard);
                if (_subCard != _card) {
                    if (countC[_subCard-1]==2) {
                        ////printf("countC[_subCard-1]: %i", countC[_subCard-1]);
                        return CHECK_TWOPAIRS;
                    }
                }
            }
        }
    }
    ////print("CHECK_TWOPAIRS - END");
   
    ////print("CHECK_JACKORBETTER - START");
    for (new _c=0; _c<5; _c++) {
        new _c_v = cPokerGame[playerid][_c][1];
        if (_c_v >= CARD_JACK || _c_v == CARD_ACE) {
            return CHECK_JACKORBETTER;
        }
    }
    ////print("CHECK_JACKORBETTER - END");
   
    return CHECK_NONE;
}
Reply


Messages In This Thread
gCasino - Scripted Casino's - by Grimrandomer - 09.02.2014, 05:49
Re: gCasino - Scripted Casino's - by Aerotactics - 09.02.2014, 06:40
Re: gCasino - Scripted Casino's - by Lordzy - 09.02.2014, 06:51
Re: gCasino - Scripted Casino's - by Grimrandomer - 09.02.2014, 06:58
Re: gCasino - Scripted Casino's - by Aerotactics - 09.02.2014, 07:02
Re: gCasino - Scripted Casino's - by Grimrandomer - 09.02.2014, 07:04
Re: gCasino - Scripted Casino's - by audriuxxx - 09.02.2014, 07:24
Re: gCasino - Scripted Casino's - by Grimrandomer - 09.02.2014, 07:35
Re: gCasino - Scripted Casino's - by AIped - 09.02.2014, 07:54
Re: gCasino - Scripted Casino's - by zSuYaNw - 09.02.2014, 08:13
Re: gCasino - Scripted Casino's - by Patrick - 09.02.2014, 08:50
Re: gCasino - Scripted Casino's - by Grimrandomer - 09.02.2014, 09:15
Re: gCasino - Scripted Casino's - by Aerotactics - 09.02.2014, 09:34
Re: gCasino - Scripted Casino's - by Grimrandomer - 09.02.2014, 09:58
Re: gCasino - Scripted Casino's - by audriuxxx - 09.02.2014, 11:25
Re: gCasino - Scripted Casino's - by audriuxxx - 09.02.2014, 12:30
Re: gCasino - Scripted Casino's - by PT - 09.02.2014, 12:35
Re: gCasino - Scripted Casino's - by Grimrandomer - 09.02.2014, 14:29
Re: gCasino - Scripted Casino's - by audriuxxx - 09.02.2014, 14:48
Re: gCasino - Scripted Casino's - by Grimrandomer - 09.02.2014, 14:58
Re: gCasino - Scripted Casino's - by Pottus - 09.02.2014, 15:30
Re: gCasino - Scripted Casino's - by audriuxxx - 09.02.2014, 15:58
Re: gCasino - Scripted Casino's - by Aerotactics - 09.02.2014, 21:14
Re: gCasino - Scripted Casino's - by Grimrandomer - 09.02.2014, 21:29
Re: gCasino - Scripted Casino's - by Aerotactics - 09.02.2014, 22:05
Re: gCasino - Scripted Casino's - by Kenshin869 - 10.02.2014, 02:40
Re: gCasino - Scripted Casino's - by Grimrandomer - 10.02.2014, 09:26
Re: gCasino - Scripted Casino's - by audriuxxx - 10.02.2014, 17:16
Re: gCasino - Scripted Casino's - by Aerotactics - 13.02.2014, 07:49
Re: gCasino - Scripted Casino's - by PSYCHOBABYKILLA - 10.04.2015, 04:26
Re : gCasino - Scripted Casino's - by tysanio - 10.08.2015, 04:48
Re: gCasino - Scripted Casino's - by rt-2 - 07.09.2016, 02:59
Re: gCasino - Scripted Casino's - by Spmn - 07.09.2016, 13:12
Re: gCasino - Scripted Casino's - by rt-2 - 07.09.2016, 23:03

Forum Jump:


Users browsing this thread: 1 Guest(s)