- 0
ajutor
-
Similar Content
-
Recently Browsing 0 members
- No registered users viewing this page.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.
Question
cr3azy
am si eu un sistem de poker ... dar cand dau compile imi da urmatoarele erori:
si imi da de undeva de aici :#define MIN_BET 1 #define MAX_BET 100 #define POKERLAPS 52 // 4 * 13 laps (2, 3 ... K, A enum { TWO = 2, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, TEN, JACK, QUEEN, KING, ACE }; enum { HIGH_CARD = 0, ONE_PAIR, TWO_PAIR, THREE_OF_A_KIND, STRAIGHT, FLUSH, FULL_HOUSE, FOUR_OF_A_KIND, STRAIGHT_FLUSH, ROYAL_FLUSH }; new LD_POKE[POKERLAPS][] = { { "LD_POKE:cd2c" }, { "LD_POKE:cd3c" }, { "LD_POKE:cd4c" }, { "LD_POKE:cd5c" }, { "LD_POKE:cd6c" }, { "LD_POKE:cd7c" }, { "LD_POKE:cd8c" }, { "LD_POKE:cd9c" }, { "LD_POKE:cd10c" }, { "LD_POKE:cd11c" }, { "LD_POKE:cd12c" }, { "LD_POKE:cd13c" }, { "LD_POKE:cd1c" }, { "LD_POKE:cd2d" }, { "LD_POKE:cd3d" }, { "LD_POKE:cd4d" }, { "LD_POKE:cd5d" }, { "LD_POKE:cd6d" }, { "LD_POKE:cd7d" }, { "LD_POKE:cd8d" }, { "LD_POKE:cd9d" }, { "LD_POKE:cd10d" }, { "LD_POKE:cd11d" }, { "LD_POKE:cd12d" }, { "LD_POKE:cd13d" }, { "LD_POKE:cd1d" }, { "LD_POKE:cd2h" }, { "LD_POKE:cd3h" }, { "LD_POKE:cd4h" }, { "LD_POKE:cd5h" }, { "LD_POKE:cd6h" }, { "LD_POKE:cd7h" }, { "LD_POKE:cd8h" }, { "LD_POKE:cd9h" }, { "LD_POKE:cd10h" }, { "LD_POKE:cd11h" }, { "LD_POKE:cd12h" }, { "LD_POKE:cd13h" }, { "LD_POKE:cd1h" }, { "LD_POKE:cd2s" }, { "LD_POKE:cd3s" }, { "LD_POKE:cd4s" }, { "LD_POKE:cd5s" }, { "LD_POKE:cd6s" }, { "LD_POKE:cd7s" }, { "LD_POKE:cd8s" }, { "LD_POKE:cd9s" }, { "LD_POKE:cd10s" }, { "LD_POKE:cd11s" }, { "LD_POKE:cd12s" }, { "LD_POKE:cd13s" }, { "LD_POKE:cd1s" } }; #define TREFF 0b1 //1 // "clubs" #define KARO 0b10 //2 // “diamonds” #define KOR 0b100 //4 // “hearts” #define PIKK 0b1000 //8 // “spades” or “shields” new Card_Value[POKERLAPS] = { "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN", "EIGHT", "NINE", "TEN", "JACK", "QUEEN", "KING", "ACE", "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN", "EIGHT", "NINE", "TEN", "JACK", "QUEEN", "KING", "ACE", "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN", "EIGHT", "NINE", "TEN", "JACK", "QUEEN", "KING", "ACE", "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN", "EIGHT", "NINE", "TEN", "JACK", "QUEEN", "KING", "ACE" }; new Bynary_Mask[POKERLAPS] = { 1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80, 0x100, 0x200, 0x400, 0x800, 0x1000, 1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80, 0x100, 0x200, 0x400, 0x800, 0x1000, 1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80, 0x100, 0x200, 0x400, 0x800, 0x1000, 1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80, 0x100, 0x200, 0x400, 0x800, 0x1000 }; new Prim_Mask[POKERLAPS] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41 }; new Color_Mask[POKERLAPS] = { TREFF, TREFF, TREFF, TREFF, TREFF, TREFF, TREFF, TREFF, TREFF, TREFF, TREFF, TREFF, TREFF, KARO, KARO, KARO, KARO, KARO, KARO, KARO, KARO, KARO, KARO, KARO, KARO, KARO, KOR, KOR, KOR, KOR, KOR, KOR, KOR, KOR, KOR, KOR, KOR, KOR, KOR, PIKK, PIKK, PIKK, PIKK, PIKK, PIKK, PIKK, PIKK, PIKK, PIKK, PIKK, PIKK, PIKK }; new pot[] = { 0, 0, 2, 3, 4, 5, 7, 20, 100, 250 }; new PlayerText:Start[MAX_PLAYERS]; #define BACKGROUND Start[playerid] #define CARDSTEXT Start[playerid] + PlayerText:1 #define HOLDSTEXT Start[playerid] + PlayerText:6 #define WIN_TEXT Start[playerid] + PlayerText:11 #define WINTEXT Start[playerid] + PlayerText:12 #define BETCREDITTEXT Start[playerid] + PlayerText:13 #define DEALSTEXT Start[playerid] + PlayerText:14 #define ADDCOINSTEXT Start[playerid] + PlayerText:15 #define EXITPOKER Start[playerid] + PlayerText:16 #define BETTEXT Start[playerid] + PlayerText:17 #define CHANGEBACKGROUND Start[playerid] + PlayerText:18 #define FIRST_CLICKDEALTEXT 0 #define SECOND_CLICKDEALTEXT 1 #define WAIT_CLICKDEALTEXT -1 #define HOLDON (false) #define HOLDOFF (true) forward TextDrawDizajn(playerid, index); forward TextDrawDizajn2(playerid, win, rank, first, second); enum Poker_PlayerInfoEnum { fivecards_hand[10], bool:holdstate[5], click_dealbutton, Bet, Credit, LastBackGround }; new PP_Info[MAX_PLAYERS][Poker_PlayerInfoEnum]; new BackGroundData[][] = { { "LOADSUK:loadscuk" }, { "LOADSUK:loadsc9" }, { "LOADSUK:loadsc8" }, { "LOADSUK:loadsc7" }, { "LOADSUK:loadsc6" }, { "LOADSUK:loadsc5" }, { "LOADSUK:loadsc4" }, { "LOADSUK:loadsc3" }, { "LOADSUK:loadsc2" }, { "LOADSUK:loadsc14" }, { "LOADSUK:loadsc13" }, { "LOADSUK:loadsc12" }, { "LOADSUK:loadsc11" }, { "LOADSUK:loadsc10" }, { "LOADSUK:loadsc1" }, { "intro1:intro1" }, { "intro2:intro2" }, { "intro3:intro3" }, { "intro4:intro4" }, { "ld_shtr:bstars" }, { " " } }; stock WinnText(playerid, win = 0, rank = 0) { new t, str[100]; str = "~w~"; for(new i = 9; i > 1; i--) { if(i == win) format(str, sizeof str, "%s~r~$%d(win - %s)~n~~w~", str, PP_Info[playerid][Bet] * pot[i], rankname(rank, t, t)); else format(str, sizeof str, "%s$%d~n~", str, PP_Info[playerid][Bet] * pot[i]); } PlayerTextDrawSetString(playerid, WINTEXT, str); } stock BetCredit(playerid) { new str[128]; format(str, sizeof str, " ~g~Bet: ~w~$%d~g~Credit: ~w~$%d",PP_Info[playerid][Bet], PP_Info[playerid][Credit]); PlayerTextDrawSetString(playerid, BETCREDITTEXT, str); } stock Delete_PokerTextDraw(playerid) { PlayerTextDrawDestroy(playerid, BACKGROUND); for(new i = 0; i < 5; i++) PlayerTextDrawDestroy(playerid, CARDSTEXT + PlayerText:i); for(new i = 0; i < 5; i++) PlayerTextDrawDestroy(playerid, HOLDSTEXT + PlayerText:i); PlayerTextDrawDestroy(playerid, WIN_TEXT); PlayerTextDrawDestroy(playerid, WINTEXT); PlayerTextDrawDestroy(playerid, BETCREDITTEXT); PlayerTextDrawDestroy(playerid, DEALSTEXT); PlayerTextDrawDestroy(playerid, ADDCOINSTEXT); PlayerTextDrawDestroy(playerid, EXITPOKER); PlayerTextDrawDestroy(playerid, BETTEXT); PlayerTextDrawDestroy(playerid, CHANGEBACKGROUND); Start[playerid] = PlayerText:INVALID_TEXT_DRAW; } stock RandomCard(array[], size = sizeof array) { new bool:e[POKERLAPS] = { false, ... }; for(new p = 0; p < size; p++) { do array[p] = random(POKERLAPS); while(e[array[p]]) e[array[p]] = true; } } stock Swap(&a, & { new s; s = a; a = b; b = s; } stock strtok(const string[], &index) { new length = strlen(string); while ((index < length) && (string[index] <= ' ')) { index++; } new offset = index; new result[20]; while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1))) { result[index - offset] = string[index]; index++; } result[index - offset] = EOS; return result; } public OnFilterScriptInit() { print("\nPoker filterscript loaded.\n\t * * * Created by Zsolesszka * * *\n"); return 1; } public OnFilterScriptExit() { for(new i; i < MAX_PLAYERS; i++) { if(Start[i] != PlayerText:INVALID_TEXT_DRAW) { Delete_PokerTextDraw(i); } } return 1; } public OnPlayerConnect(playerid) { PP_Info[playerid][LastBackGround] = 3; Start[playerid] = PlayerText:INVALID_TEXT_DRAW; return 1; } public OnPlayerDisconnect(playerid, reason) { if(Start[playerid] != PlayerText:INVALID_TEXT_DRAW) { Delete_PokerTextDraw(playerid); } return 1; } public OnPlayerCommandText(playerid, cmdtext[]) { new idx, cmd[20]; cmd = strtok(cmdtext, idx); if(strcmp("/poker", cmd, true) == 0) { if(Start[playerid] != PlayerText:INVALID_TEXT_DRAW) return SendClientMessage(playerid, -1, "Already use poker."); cmd = strtok(cmdtext, idx); new credit = strval(cmd); if(credit < 1 || credit > 100000) SendClientMessage(playerid, -1, "{008888}Usage: {ffffff}/poker [1-100000]"); else if(GetPlayerMoney(playerid) < credit) SendClientMessage(playerid, -1, "Not have enough money."); else { // .......................................... BackGround Start[playerid] = CreatePlayerTextDraw(playerid, -0.000, -0.000, "LOADSUK:loadsc7"); PlayerTextDrawFont(playerid, Start[playerid], 4); PlayerTextDrawTextSize(playerid, Start[playerid], 640.000, 450.000); PlayerTextDrawColor(playerid, Start[playerid], -1); PlayerTextDrawShow(playerid, Start[playerid]); // .......................................... new PlayerText:txd = Start[playerid], Float:t_x = 167.500000; for(new i; i < 5; i++) { // .......................................... CardsText txd = CreatePlayerTextDraw(playerid, t_x, 286.500, "LD_TATT:8poker"); PlayerTextDrawFont(playerid, txd, 4); PlayerTextDrawTextSize(playerid, txd, 59.500, 88.000); PlayerTextDrawColor(playerid, txd, -1); PlayerTextDrawSetSelectable(playerid, txd, 1); PlayerTextDrawShow(playerid, txd); t_x += 61.500000; } t_x = 167.500000; for(new i; i < 5; i++) { // .......................................... HoldsText txd = CreatePlayerTextDraw(playerid, t_x, 270.500, "LD_POKE:holdon"); PlayerTextDrawFont(playerid, txd, 4); PlayerTextDrawTextSize(playerid, txd, 59.500, 14.500); PlayerTextDrawColor(playerid, txd, -1); PlayerTextDrawShow(playerid, txd); t_x += 61.500000; } // .......................................... Win_Text txd = CreatePlayerTextDraw(playerid, 167.500000, 154.000000, "Royal Flush~n~Straight Flush~n~4 of a Kind~n~Full House~n~Flush~n~Straight~n~3 of a Kind~n~Two Pair"); PlayerTextDrawFont(playerid, txd, 1); PlayerTextDrawLetterSize(playerid, txd, 0.320000, 1.400000); PlayerTextDrawSetOutline(playerid, txd, 1); PlayerTextDrawSetProportional(playerid, txd, 1); PlayerTextDrawShow(playerid, txd); // .......................................... WinText txd = CreatePlayerTextDraw(playerid, 247.500000, 154.000000, "_"); PlayerTextDrawFont(playerid, txd, 1); PlayerTextDrawLetterSize(playerid, txd, 0.320000, 1.400000); PlayerTextDrawSetOutline(playerid, txd, 1); PlayerTextDrawSetProportional(playerid, txd, 1); PlayerTextDrawShow(playerid, txd); // .......................................... BetCreditText txd = CreatePlayerTextDraw(playerid, 320.000000, 379.000000, "_"); PlayerTextDrawAlignment(playerid, txd, 2); PlayerTextDrawBackgroundColor(playerid, txd, 255); PlayerTextDrawFont(playerid, txd, 3); PlayerTextDrawLetterSize(playerid, txd, 0.300000, 1.600000); PlayerTextDrawColor(playerid, txd, -1); PlayerTextDrawSetOutline(playerid, txd, 0); PlayerTextDrawSetProportional(playerid, txd, 1); PlayerTextDrawSetShadow(playerid, txd, 1); PlayerTextDrawUseBox(playerid, txd, 1); PlayerTextDrawBoxColor(playerid, txd, 335595560); PlayerTextDrawTextSize(playerid, txd, 6.000000, 302.000000); PlayerTextDrawShow(playerid, txd); // .......................................... DealsText txd = CreatePlayerTextDraw(playerid, 229.000, 400.500, "LD_POKE:deal"); PlayerTextDrawFont(playerid, txd, 4); PlayerTextDrawTextSize(playerid, txd, 59.500, 14.500); PlayerTextDrawColor(playerid, txd, -1); PlayerTextDrawSetSelectable(playerid, txd, 1); PlayerTextDrawShow(playerid, txd); // .......................................... AddCoinsText txd = CreatePlayerTextDraw(playerid, 167.500, 400.500, "LD_POKE:addcoin"); PlayerTextDrawFont(playerid, txd, 4); PlayerTextDrawTextSize(playerid, txd, 59.500, 14.500); PlayerTextDrawColor(playerid, txd, -1); PlayerTextDrawSetSelectable(playerid, txd, 1); PlayerTextDrawShow(playerid, txd); // .......................................... ExitPoker txd = CreatePlayerTextDraw(playerid, 457.000, 253.000, "LD_BEAT:cross"); PlayerTextDrawFont(playerid, txd, 4); PlayerTextDrawTextSize(playerid, txd, 16.000, 16.000); PlayerTextDrawColor(playerid, txd, -1); PlayerTextDrawSetSelectable(playerid, txd, 1); PlayerTextDrawShow(playerid, txd); // .......................................... BetText txd = CreatePlayerTextDraw(playerid, 167.500, 377.000, "LD_BEAT:circle"); PlayerTextDrawFont(playerid, txd, 4); PlayerTextDrawTextSize(playerid, txd, 16.000, 16.000); PlayerTextDrawColor(playerid, txd, -1); PlayerTextDrawSetSelectable(playerid, txd, 1); PlayerTextDrawShow(playerid, txd); // .......................................... ChangeBackGround txd = CreatePlayerTextDraw(playerid, 437.000, 253.000, "LD_NONE:warp"); PlayerTextDrawFont(playerid, txd, 4); PlayerTextDrawTextSize(playerid, txd, 16.000, 16.000); PlayerTextDrawColor(playerid, txd, -1); PlayerTextDrawSetSelectable(playerid, txd, 1); PlayerTextDrawShow(playerid, txd); if(txd == CHANGEBACKGROUND) { PP_Info[playerid][Credit] = credit; GivePlayerMoney(playerid, -credit); TogglePlayerControllable(playerid, false); PP_Info[playerid][Bet] = MIN_BET; PP_Info[playerid][click_dealbutton] = FIRST_CLICKDEALTEXT; BetCredit(playerid); WinnText(playerid); for(new i; i < 5; i++) { PP_Info[playerid][fivecards_hand][i] = 0; PP_Info[playerid][fivecards_hand][i + 5] = 0; PP_Info[playerid][holdstate][i] = HOLDOFF; } SelectTextDraw(playerid, 0x787ab3bb); //0x9999BBBB); SendClientMessage(playerid, -1, "Play.."); } else { SendClientMessage(playerid, -1, "Please try again."); Delete_PokerTextDraw(playerid); } } return 1; } return 0; } stock ExitPoker(playerid) { Delete_PokerTextDraw(playerid); TogglePlayerControllable(playerid, true); GivePlayerMoney(playerid, PP_Info[playerid][Credit]); new str[128]; format(str, sizeof str, "Thank you using the {ffffff}¤ [Fs]Poker script by.: Zsolesszka ¤{22a4b5} Add money : {ffffff}$%d", PP_Info[playerid][Credit]); SendClientMessage(playerid, 0x22a4b5AA, str); PP_Info[playerid][Credit] = 0; CancelSelectTextDraw(playerid); } public OnPlayerClickTextDraw(playerid, Text:clickedid) { if(Start[playerid] != PlayerText:INVALID_TEXT_DRAW && clickedid == Text:INVALID_TEXT_DRAW) { ExitPoker(playerid); return 1; } return 1; } public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid) { if(Start[playerid] == PlayerText:INVALID_TEXT_DRAW) return 1; if(DEALSTEXT == playertextid) { if(PP_Info[playerid][click_dealbutton] == WAIT_CLICKDEALTEXT) return 1; if(PP_Info[playerid][click_dealbutton] == FIRST_CLICKDEALTEXT) { if(PP_Info[playerid][Credit] < 1) return SendClientMessage(playerid, -1, "No credit, click addcoin."); if(PP_Info[playerid][Credit] < PP_Info[playerid][Bet]) { PP_Info[playerid][Bet] = PP_Info[playerid][Credit]; } PP_Info[playerid][Credit] -= PP_Info[playerid][Bet]; PP_Info[playerid][click_dealbutton] = WAIT_CLICKDEALTEXT; PlayerTextDrawHide(playerid, ADDCOINSTEXT); PlayerTextDrawHide(playerid, BETTEXT); PlayerPlaySound(playerid, 43000, 0.00, 0.00, 0.00); RandomCard(PP_Info[playerid][fivecards_hand], 10); WinnText(playerid); BetCredit(playerid); TextDrawDizajn(playerid, 0); } else { PP_Info[playerid][click_dealbutton] = FIRST_CLICKDEALTEXT; PlayerTextDrawShow(playerid, ADDCOINSTEXT); PlayerTextDrawShow(playerid, BETTEXT); for(new i; i < 5; i++) { if(PP_Info[playerid][holdstate][i] == HOLDON) { PlayerTextDrawSetString(playerid, HOLDSTEXT + PlayerText:i, " "); PP_Info[playerid][holdstate][i] = HOLDOFF; } else { Swap(PP_Info[playerid][fivecards_hand][i], PP_Info[playerid][fivecards_hand][i + 5]); PlayerTextDrawSetString(playerid, CARDSTEXT + PlayerText:i, LD_POKE[PP_Info[playerid][fivecards_hand][i]]); } } new first, second, rank = get_rank(PP_Info[playerid][fivecards_hand]), win = get_win(rank); rankname(rank, first, second); if(win > ONE_PAIR) { PP_Info[playerid][Credit] += (pot[win] * PP_Info[playerid][Bet]); switch(win) { case STRAIGHT, FLUSH, STRAIGHT_FLUSH, FULL_HOUSE, ROYAL_FLUSH: { for(new i = 0; i < 5; i++) { PlayerTextDrawSetString(playerid, HOLDSTEXT + PlayerText:i, "LD_POKE:holdmid"); } } case TWO_PAIR: { for(new i = 0; i < 5; i++) { if(first == Card_Value[PP_Info[playerid][fivecards_hand][i]] || second == Card_Value[PP_Info[playerid][fivecards_hand][i]]) { PlayerTextDrawSetString(playerid, HOLDSTEXT + PlayerText:i, "LD_POKE:holdmid"); } } } case THREE_OF_A_KIND, FOUR_OF_A_KIND: { for(new i = 0; i < 5; i++) { if(first == Card_Value[PP_Info[playerid][fivecards_hand][i]]) { PlayerTextDrawSetString(playerid, HOLDSTEXT + PlayerText:i, "LD_POKE:holdmid"); } } } } PlayerPlaySound(playerid, 5448, 0.00, 0.00, 0.00); WinnText(playerid, win, rank); BetCredit(playerid); } else { for(new i = 0; i < 5; i++) { PlayerTextDrawSetString(playerid, HOLDSTEXT + PlayerText:i, "_"); } } } } else { if(PP_Info[playerid][click_dealbutton] == SECOND_CLICKDEALTEXT) { for(new i = 0; i < 5; i++) { if(CARDSTEXT + PlayerText:i == playertextid) { PP_Info[playerid][holdstate][i] = HOLDOFF - PP_Info[playerid][holdstate][i]; if(PP_Info[playerid][holdstate][i]) PlayerTextDrawSetString(playerid, HOLDSTEXT + PlayerText:i, "_"); else PlayerTextDrawSetString(playerid, HOLDSTEXT + PlayerText:i, "LD_POKE:holdon"); PlayerPlaySound(playerid, 21000, 0.00, 0.00, 0.00); return 1; } } } else if(ADDCOINSTEXT == playertextid) { if(GetPlayerMoney(playerid) < 100) { SendClientMessage(playerid, -1, "{cc1212}You have no money."); } else { GivePlayerMoney(playerid, -100); PP_Info[playerid][Credit] += 100; BetCredit(playerid); PlayerPlaySound(playerid, 4203, 0.00, 0.00, 0.00); } return 1; } else if(BETTEXT == playertextid) { if(PP_Info[playerid][Bet] < 100) PP_Info[playerid][Bet]++; else PP_Info[playerid][Bet] = MIN_BET; BetCredit(playerid); WinnText(playerid); PlayerPlaySound(playerid, 4202, 0.00, 0.00, 0.00); return 1; } } if(CHANGEBACKGROUND == playertextid) { PP_Info[playerid][LastBackGround]++; if(PP_Info[playerid][LastBackGround] == sizeof BackGroundData) PP_Info[playerid][LastBackGround] = 0; PlayerTextDrawSetString(playerid, BACKGROUND, BackGroundData[PP_Info[playerid][LastBackGround]]); return 1; } if(EXITPOKER == playertextid) { ExitPoker(playerid); return 1; } return 1; } public TextDrawDizajn(playerid, index) { if(index == 5) { new first, second, rank = get_rank(PP_Info[playerid][fivecards_hand]), win = get_win(rank); rankname(rank, first, second); SetTimerEx("TextDrawDizajn2", 200, false, "iiiii", playerid, win, rank, first, second); } else { PlayerPlaySound(playerid, 20800, 0.00, 0.00, 0.00); PlayerTextDrawSetString(playerid, CARDSTEXT + PlayerText:index, "LD_POKE:cdback"); PlayerTextDrawSetString(playerid, HOLDSTEXT + PlayerText:index, " "); SetTimerEx("TextDrawDizajn", 100, false, "ii", playerid, ++index); } return 1; } public TextDrawDizajn2(playerid, win, rank, first, second) { for(new i; i < 5; i++) { PlayerTextDrawSetString(playerid, CARDSTEXT + PlayerText:i, LD_POKE[PP_Info[playerid][fivecards_hand][i]]); } switch(win) { case STRAIGHT, FLUSH, STRAIGHT_FLUSH, FULL_HOUSE, ROYAL_FLUSH: { for(new i = 0; i < 5; i++) { PlayerTextDrawSetString(playerid, HOLDSTEXT + PlayerText:i, "LD_POKE:holdon"); PP_Info[playerid][holdstate][i] = HOLDON; } } case ONE_PAIR: { for(new i = 0; i < 5; i++) { if(first == Card_Value[PP_Info[playerid][fivecards_hand][i]]) { PlayerTextDrawSetString(playerid, HOLDSTEXT + PlayerText:i, "LD_POKE:holdon"); PP_Info[playerid][holdstate][i] = HOLDON; } } } case TWO_PAIR: { for(new i = 0; i < 5; i++) { if(first == Card_Value[PP_Info[playerid][fivecards_hand][i]] || second == Card_Value[PP_Info[playerid][fivecards_hand][i]]) { PlayerTextDrawSetString(playerid, HOLDSTEXT + PlayerText:i, "LD_POKE:holdon"); PP_Info[playerid][holdstate][i] = HOLDON; } } } case THREE_OF_A_KIND, FOUR_OF_A_KIND: { for(new i = 0; i < 5; i++) { if(first == Card_Value[PP_Info[playerid][fivecards_hand][i]]) { PlayerTextDrawSetString(playerid, HOLDSTEXT + PlayerText:i, "LD_POKE:holdon"); PP_Info[playerid][holdstate][i] = HOLDON; } } } } PP_Info[playerid][click_dealbutton] = SECOND_CLICKDEALTEXT; WinnText(playerid, win, rank); return 1; } stock get_win(rank) { if(rank > 6185) return HIGH_CARD; // 1277 high card if(rank > 3325) return ONE_PAIR; // 2860 one pair if(rank > 2467) return TWO_PAIR; // 858 two pair if(rank > 1609) return THREE_OF_A_KIND; // 858 three-kind if(rank > 1599) return STRAIGHT; // 10 straights if(rank > 322) return FLUSH; // 1277 flushes if(rank > 166) return FULL_HOUSE; // 156 full house if(rank > 10) return FOUR_OF_A_KIND; // 156 four-kind if(rank > 2) return STRAIGHT_FLUSH; // 9 straight-flushes return ROYAL_FLUSH; } stock get_rank(const cards[]) // fast five card hand eval { new flushes = 0, getcolor = Color_Mask[cards[0]] | Color_Mask[cards[1]] | Color_Mask[cards[2]] | Color_Mask[cards[3]] | Color_Mask[cards[4]]; if((getcolor & (getcolor - 1)) == 0) { switch(Bynary_Mask[cards[0]] | Bynary_Mask[cards[1]] | Bynary_Mask[cards[2]] | Bynary_Mask[cards[3]] | Bynary_Mask[cards[4]]) { case 7936: { return 1; } // ROYAL_FLUSH; case 4111: { return 2; } // Straight Flush case 3968: { return 3; } // Straight Flush case 1984: { return 4; } // Straight Flush case 992: { return 5; } // Straight Flush case 496: { return 6; } // Straight Flush case 248: { return 7; } // Straight Flush case 124: { return 8; } // Straight Flush case 62: { return 9; } // Straight Flush case 31: { return 10; } // Straight Flush default: flushes = 5863; } }3 answers to this question
Recommended Posts