Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Poker filterscript by.: Zsolesszka
- - 2012.03.25
- - A few small things corrected, RandomCard, /poker cmd etc..
- - Press Esc ExitPoker
- - 2012.03.22 0.3eRC5
- - Use script new native function PlayerText:CreatePlayerTextDraw etc..
- - 2012.03.22
- - Add exit textdraw, change background textdraw, bet textdraw, modified hold textdraw
- - 31 global textdraw OnFilterscriptInit, per player textdraw 7 2048 max textdraw (2048 - 31)/7 = ~288 max player slot
- - etc..
- - 2012.03.20 Update Poker [FS] Beta version
- samp 0.3e RC4 use new function
- native TextDrawSetSelectable(Text:text, set); // the default is 0 (non-selectable)
- native SelectTextDraw(playerid, hovercolor); // enables the mouse so the player can select a textdraw
- native CancelSelectTextDraw(playerid); // cancel textdraw selection with the mouse
- forward OnPlayerClickTextDraw(playerid, Text:clickedid);
- - 2012.01.15 - 2012.01.27 (first release Poker script)
- Thank you SA-MP team.
- */
- #include <a_samp>
- #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" }
- };
- 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
- // 2 3 4 5 6 7 8 9 T J Q K A
- };
- #define TREFF 0b1 //1 // "clubs"
- #define KARO 0b10 //2 // “diamonds”
- #define KOR 0b100 //4 // “hearts”
- #define PIKK 0b1000 //8 // “spades” or “shields”
- new
- Color_Mask[POKERLAPS] =
- {
- TREFF, TREFF, TREFF, TREFF, TREFF, TREFF, TREFF, TREFF, TREFF, TREFF, TREFF, TREFF, TREFF, // 1 = 0b10
- KARO, KARO, KARO, KARO, KARO, KARO, KARO, KARO, KARO, KARO, KARO, KARO, KARO, // 2 = 0b100
- KOR, KOR, KOR, KOR, KOR, KOR, KOR, KOR, KOR, KOR, KOR, KOR, KOR, // 4 = 0b1000
- PIKK, PIKK, PIKK, PIKK, PIKK, PIKK, PIKK, PIKK, PIKK, PIKK, PIKK, PIKK, PIKK // 8 = 0b10000
- };
- new
- pot[] = { 0, 0, 2, 3, 4, 5, 7, 20, 50, 250 };
- new
- PlayerText:Start[MAX_PLAYERS];
- #define BACKGROUND Start[playerid]
- #define CARDSTEXT Start[playerid] + PlayerText:1 // 2, 3, 4, 5 [5]
- #define HOLDSTEXT Start[playerid] + PlayerText:6 // 7, 8, 9, 10 [5]
- #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 MIN_BET 5 // $5
- #define MAX_BET 100 // $100
- #define FIRST_CLICKDEALTEXT (false) // enable hold card
- #define SECOND_CLICKDEALTEXT (true) // disable hold card
- #define HOLDON (false)
- #define HOLDOFF (true) // Not modified
- forward TextDrawDizajn(playerid, index);
- forward TextDrawDizajn2(playerid, win, first_pair, second_pair);
- enum
- Poker_PlayerInfoEnum
- {
- fivecards_hand[10],
- bool:holdstate[5],
- bool:hold,
- 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)
- {
- new
- str[100];
- str = "~w~";
- for(new i = 9; i > 1; i--)
- {
- if(i == win)
- format(str, sizeof str, "%s~r~$%d(win)~n~~w~", str, PP_Info[playerid][Bet] * pot[i]);
- 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, &b)
- {
- 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;
- }
- stock
- getwin(const cards[], &One_Pair_Type, &Two_Pair_Type)
- {
- new
- i = 0,
- getcolor,
- straight;
- getcolor = Color_Mask[cards[0]] | Color_Mask[cards[1]] | Color_Mask[cards[2]] | Color_Mask[cards[3]] | Color_Mask[cards[4]];
- getcolor = getcolor & (getcolor - 1);
- straight = (Bynary_Mask[cards[0]] | Bynary_Mask[cards[1]] | Bynary_Mask[cards[2]] | Bynary_Mask[cards[3]] | Bynary_Mask[cards[4]]);
- if(getcolor == 0)
- {
- if(straight == 7936) return ROYAL_FLUSH;
- if(HasStraight(straight)) return STRAIGHT_FLUSH;
- return FLUSH;
- } else {
- new
- two_pair,
- three_of_a_kind,
- match[13];
- for(i = 0; i < 5; i++)
- {
- match[cards[i] % 13]++;
- }
- for(i = 0; i < 13; i++)
- {
- switch(match[i])
- {
- case 2:
- {
- two_pair++;
- if(two_pair == 1)
- One_Pair_Type = i;
- else if(two_pair == 2)
- Two_Pair_Type = i;
- }
- case 3: three_of_a_kind++, One_Pair_Type = i;
- case 4: return One_Pair_Type = i, FOUR_OF_A_KIND;
- }
- }
- if(two_pair == 1 && three_of_a_kind == 1) return FULL_HOUSE;
- if(two_pair == 2) return TWO_PAIR;
- if(two_pair == 1) return ONE_PAIR;
- if(three_of_a_kind == 1) return THREE_OF_A_KIND;
- if(HasStraight(straight)) return STRAIGHT;
- }
- return HIGH_CARD;
- }
- stock
- HasStraight(straight)
- {
- switch(straight)
- {
- case 31, 62, 124, 248, 496, 992, 1984, 3968, 7936, 4111: return true;
- }
- return false;
- }
- 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 < 5 || credit > 100000) SendClientMessage(playerid, -1, "{008888}Usage: {ffffff}/poker [5-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++)
- {
- // .......................................... HoldsText
- 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++)
- {
- // .......................................... CardsText
- 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][hold] = FIRST_CLICKDEALTEXT;
- BetCredit(playerid);
- WinnText(playerid, 0);
- 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, 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)
- {
- if(DEALSTEXT == playertextid)
- {
- if(PP_Info[playerid][hold] == FIRST_CLICKDEALTEXT)
- {
- if(PP_Info[playerid][Credit] < PP_Info[playerid][Bet]) return SendClientMessage(playerid, -1, "No credit");
- PP_Info[playerid][Credit] -= PP_Info[playerid][Bet];
- PP_Info[playerid][hold] = SECOND_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, 0);
- BetCredit(playerid);
- TextDrawDizajn(playerid, 0);
- } else { // else if(PP_Info[playerid][hold] == SECOND_CLICKDEALTEXT)
- PP_Info[playerid][hold] = 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_pair,
- second_pair,
- win = getwin(PP_Info[playerid][fivecards_hand], first_pair, second_pair);
- 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( Card_Value[first_pair] == Card_Value[PP_Info[playerid][fivecards_hand][i]] ||
- Card_Value[second_pair] == Card_Value[PP_Info[playerid][fivecards_hand][i]])
- {
- PlayerTextDrawSetString(playerid, HOLDSTEXT + PlayerText:i, "LD_POKE:holdmid");
- }
- }
- }
- case ONE_PAIR, FOUR_OF_A_KIND, THREE_OF_A_KIND:
- {
- for(new i = 0; i < 5; i++)
- {
- if(Card_Value[first_pair] == 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); //43001); //30800);
- WinnText(playerid, win);
- BetCredit(playerid);
- } else {
- for(new i = 0; i < 5; i++)
- {
- PlayerTextDrawSetString(playerid, HOLDSTEXT + PlayerText:i, "_");
- }
- }
- }
- } else {
- if(PP_Info[playerid][hold] == 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); //43000);
- return 1; // stop for ciklus one textdraw
- }
- }
- }
- 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] += 5;
- else
- PP_Info[playerid][Bet] = 5;
- BetCredit(playerid);
- WinnText(playerid, 0)
- 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
- win,
- first_pair,
- second_pair;
- win = getwin(PP_Info[playerid][fivecards_hand], first_pair, second_pair);
- SetTimerEx("TextDrawDizajn2", 200, false, "iiii", playerid, win, first_pair, second_pair);
- } 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, first_pair, second_pair)
- {
- 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 TWO_PAIR:
- {
- for(new i = 0; i < 5; i++)
- {
- if( Card_Value[first_pair] == Card_Value[PP_Info[playerid][fivecards_hand][i]] ||
- Card_Value[second_pair] == Card_Value[PP_Info[playerid][fivecards_hand][i]])
- {
- PlayerTextDrawSetString(playerid, HOLDSTEXT + PlayerText:i, "LD_POKE:holdon");
- PP_Info[playerid][holdstate][i] = HOLDON;
- }
- }
- }
- case ONE_PAIR, FOUR_OF_A_KIND, THREE_OF_A_KIND:
- {
- for(new i = 0; i < 5; i++)
- {
- if(Card_Value[first_pair] == Card_Value[PP_Info[playerid][fivecards_hand][i]])
- {
- PlayerTextDrawSetString(playerid, HOLDSTEXT + PlayerText:i, "LD_POKE:holdon");
- PP_Info[playerid][holdstate][i] = HOLDON;
- }
- }
- }
- }
- WinnText(playerid, win);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement