Advertisement
Guest User

g_casinogames.pwn (By GhoulSlayeR)

a guest
Feb 27th, 2013
8,226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 120.19 KB | None | 0 0
  1. /*
  2.        
  3.         _________               .__              
  4.         \_   ___ \_____    _____|__| ____   ____  
  5.         /    \  \/\__  \  /  ___/  |/    \ /  _ \
  6.         \     \____/ __ \_\___ \|  |   |  (  <_> )
  7.          \______  (____  /____  >__|___|  /\____/
  8.                 \/     \/     \/        \/        
  9.           ________                              
  10.          /  _____/_____    _____   ____   ______
  11.         /   \  ___\__  \  /     \_/ __ \ /  ___/
  12.         \    \_\  \/ __ \|  Y Y  \  ___/ \___ \
  13.          \______  (____  /__|_|  /\___  >____  >
  14.                 \/     \/      \/     \/     \/
  15.                
  16.           Developed By Dan 'GhoulSlayeR' Reed
  17.                  mrdanreed@gmail.com
  18.          
  19. ===========================================================
  20. This software was written for the sole purpose to not be
  21. destributed without written permission from the software
  22. developer.
  23.  
  24. Changelog:
  25.  
  26. 1.0.0 - Inital Release
  27. ===========================================================
  28.  
  29.  
  30. */
  31.  
  32. #include <a_samp>
  33. #include <zcmd>
  34. #include <sscanf2>
  35.  
  36. #define STR_VERSION "v1.0 Beta Version"
  37.  
  38. // Colors
  39. #define COLOR_WHITE                         0xFFFFFFAA
  40. #define COLOR_GOLD                          0xFFCC00AA
  41.  
  42. // Dialogs
  43. #define DIALOG_CGAMESADMINMENU              32100
  44. #define DIALOG_CGAMESSELECTPOKER            32101
  45. #define DIALOG_CGAMESSETUPPOKER             32102
  46. #define DIALOG_CGAMESCREDITS                32103
  47. #define DIALOG_CGAMESSETUPPGAME             32104
  48. #define DIALOG_CGAMESSETUPPGAME2            32105
  49. #define DIALOG_CGAMESSETUPPGAME3            32106
  50. #define DIALOG_CGAMESSETUPPGAME4            32107
  51. #define DIALOG_CGAMESSETUPPGAME5            32108
  52. #define DIALOG_CGAMESSETUPPGAME6            32109
  53. #define DIALOG_CGAMESSETUPPGAME7            32110
  54. #define DIALOG_CGAMESBUYINPOKER             32111
  55. #define DIALOG_CGAMESCALLPOKER              32112
  56. #define DIALOG_CGAMESRAISEPOKER             32113
  57.  
  58.  
  59. // Objects
  60. #define OBJ_POKER_TABLE                     19474
  61.  
  62. // GUI
  63. #define GUI_POKER_TABLE                     0
  64.  
  65. // Poker Misc
  66. #define MAX_POKERTABLES                     100
  67. #define MAX_POKERTABLEMISCOBJS              6
  68. #define MAX_PLAYERPOKERUI                   48
  69. #define DRAWDISTANCE_POKER_TABLE            150.0
  70. #define DRAWDISTANCE_POKER_MISC             50.0
  71. #define CAMERA_POKER_INTERPOLATE_SPEED      5000 // ms (longer = slower)
  72.  
  73. #define IsNull(%1) \
  74. ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
  75.  
  76. new PlayerText:PlayerPokerUI[MAX_PLAYERS][MAX_PLAYERPOKERUI];
  77.  
  78. enum pkrInfo
  79. {
  80.     pkrActive,
  81.     pkrPlaced,
  82.     pkrObjectID,
  83.     pkrMiscObjectID[MAX_POKERTABLEMISCOBJS],
  84.     Text3D:pkrText3DID,
  85.     Float:pkrX,
  86.     Float:pkrY,
  87.     Float:pkrZ,
  88.     Float:pkrRX,
  89.     Float:pkrRY,
  90.     Float:pkrRZ,
  91.     pkrVW,
  92.     pkrInt,
  93.     pkrPlayers,
  94.     pkrActivePlayers,
  95.     pkrActiveHands,
  96.     pkrSlot[6],
  97.     pkrPass[32],
  98.     pkrLimit,
  99.     pkrPulseTimer,
  100.     pkrBuyInMax,
  101.     pkrBuyInMin,
  102.     pkrBlind,
  103.     pkrTinkerLiveTime,
  104.     pkrDelay,
  105.     pkrSetDelay,
  106.     pkrPos,
  107.     pkrRotations,
  108.     pkrSlotRotations,
  109.     pkrActivePlayerID,
  110.     pkrActivePlayerSlot,
  111.     pkrRound,
  112.     pkrStage,
  113.     pkrActiveBet,
  114.     pkrDeck[52],
  115.     pkrCCards[5],
  116.     pkrPot,
  117.     pkrWinners,
  118.     pkrWinnerID,
  119. };
  120. new PokerTable[MAX_POKERTABLES][pkrInfo];
  121.  
  122. /*new Float:PokerTableMiscObjOffsets[MAX_POKERTABLEMISCOBJS][6] = {
  123. {-1.25, 0.470, 0.1, 0.0, 0.0, 180.0}, // (Slot 1)
  124. {-1.25, -0.470, 0.1, 0.0, 0.0, 180.0}, // (Slot 2)
  125. {-0.01, -1.85, 0.1, 0.0, 0.0, -90.0}, // (Slot 3)
  126. {1.25, -0.470, 0.1, 0.0, 0.0, 0.0}, // (Slot 4)
  127. {1.25, 0.470, 0.1, 0.0, 0.0, 0.0}, // (Slot 5)
  128. {0.01, 1.85, 0.1, 0.0, 0.0, 90.0}  // (Slot 6)
  129. };*/
  130.  
  131. new Float:PokerTableMiscObjOffsets[MAX_POKERTABLEMISCOBJS][6] = {
  132. {-1.25, -0.470, 0.1, 0.0, 0.0, 180.0}, // (Slot 2)
  133. {-1.25, 0.470, 0.1, 0.0, 0.0, 180.0}, // (Slot 1)
  134. {0.01, 1.85, 0.1, 0.0, 0.0, 90.0},  // (Slot 6)
  135. {1.25, 0.470, 0.1, 0.0, 0.0, 0.0}, // (Slot 5)
  136. {1.25, -0.470, 0.1, 0.0, 0.0, 0.0}, // (Slot 4)
  137. {-0.01, -1.85, 0.1, 0.0, 0.0, -90.0} // (Slot 3)
  138. };
  139.  
  140. new DeckTextdrw[53][] = {
  141. "LD_CARD:cdback", // CARD BACK
  142. "LD_CARD:cd1c", // A Clubs - 0
  143. "LD_CARD:cd2c", // 2 Clubs - 1
  144. "LD_CARD:cd3c", // 3 Clubs - 2
  145. "LD_CARD:cd4c", // 4 Clubs - 3
  146. "LD_CARD:cd5c", // 5 Clubs - 4
  147. "LD_CARD:cd6c", // 6 Clubs - 5
  148. "LD_CARD:cd7c", // 7 Clubs - 6
  149. "LD_CARD:cd8c", // 8 Clubs - 7
  150. "LD_CARD:cd9c", // 9 Clubs - 8
  151. "LD_CARD:cd10c", // 10 Clubs - 9
  152. "LD_CARD:cd11c", // J Clubs - 10
  153. "LD_CARD:cd12c", // Q Clubs - 11
  154. "LD_CARD:cd13c", // K Clubs - 12
  155. "LD_CARD:cd1d", // A Diamonds - 13
  156. "LD_CARD:cd2d", // 2 Diamonds - 14
  157. "LD_CARD:cd3d", // 3 Diamonds - 15
  158. "LD_CARD:cd4d", // 4 Diamonds - 16
  159. "LD_CARD:cd5d", // 5 Diamonds - 17
  160. "LD_CARD:cd6d", // 6 Diamonds - 18
  161. "LD_CARD:cd7d", // 7 Diamonds - 19
  162. "LD_CARD:cd8d", // 8 Diamonds - 20
  163. "LD_CARD:cd9d", // 9 Diamonds - 21
  164. "LD_CARD:cd10d", // 10 Diamonds - 22
  165. "LD_CARD:cd11d", // J Diamonds - 23
  166. "LD_CARD:cd12d", // Q Diamonds - 24
  167. "LD_CARD:cd13d", // K Diamonds - 25
  168. "LD_CARD:cd1h", // A Heats - 26
  169. "LD_CARD:cd2h", // 2 Heats - 27
  170. "LD_CARD:cd3h", // 3 Heats - 28
  171. "LD_CARD:cd4h", // 4 Heats - 29
  172. "LD_CARD:cd5h", // 5 Heats - 30
  173. "LD_CARD:cd6h", // 6 Heats - 31
  174. "LD_CARD:cd7h", // 7 Heats - 32
  175. "LD_CARD:cd8h", // 8 Heats - 33
  176. "LD_CARD:cd9h", // 9 Heats - 34
  177. "LD_CARD:cd10h", // 10 Heats - 35
  178. "LD_CARD:cd11h", // J Heats - 36
  179. "LD_CARD:cd12h", // Q Heats - 37
  180. "LD_CARD:cd13h", // K Heats - 38
  181. "LD_CARD:cd1s", // A Spades - 39
  182. "LD_CARD:cd2s", // 2 Spades - 40
  183. "LD_CARD:cd3s", // 3 Spades - 41
  184. "LD_CARD:cd4s", // 4 Spades - 42
  185. "LD_CARD:cd5s", // 5 Spades - 43
  186. "LD_CARD:cd6s", // 6 Spades - 44
  187. "LD_CARD:cd7s", // 7 Spades - 45
  188. "LD_CARD:cd8s", // 8 Spades - 46
  189. "LD_CARD:cd9s", // 9 Spades - 47
  190. "LD_CARD:cd10s", // 10 Spades - 48
  191. "LD_CARD:cd11s", // J Spades - 49
  192. "LD_CARD:cd12s", // Q Spades - 50
  193. "LD_CARD:cd13s" // K Spades - 51
  194. };
  195.  
  196. //------------------------------------------------
  197.  
  198. public OnFilterScriptInit()
  199. {
  200.     print("\n");
  201.     print("========================================");
  202.     printf("gCasino Games %s", STR_VERSION);
  203.     print("Developed By: Dan 'GhoulSlayeR' Reed");
  204.     print("========================================");
  205.     print("\n");
  206.  
  207.     InitPokerTables();
  208.     return 1;
  209. }
  210.  
  211. //------------------------------------------------
  212.  
  213. // Note: 0, 1 should be the hand, the rest are community cards.
  214. AnaylzePokerHand(playerid, Hand[])
  215. {
  216.     new pokerArray[7];
  217.     for(new i = 0; i < sizeof(pokerArray); i++) {
  218.         pokerArray[i] = Hand[i];
  219.     }
  220.  
  221.     new suitArray[4][13];
  222.     new tmp = 0;
  223.     new pairs = 0;
  224.     new bool:isRoyalFlush = false;
  225.     new bool:isFlush = false;
  226.     new bool:isStraight = false;
  227.     new bool:isFour = false;
  228.     new bool:isThree = false;
  229.     new bool:isTwoPair = false;
  230.     new bool:isPair = false;
  231.    
  232.     // Convert Hand[] (AKA pokerArray) to suitArray[]
  233.     for(new i = 0; i < sizeof(pokerArray); i++) {
  234.         if(pokerArray[i] <= 12) { // Clubs (0 - 12)
  235.             suitArray[0][pokerArray[i]] = 1;
  236.         }
  237.         if(pokerArray[i] <= 25 && pokerArray[i] >= 13) { // Diamonds (13 - 25)
  238.             suitArray[1][pokerArray[i]-13] = 1;
  239.         }
  240.         if(pokerArray[i] <= 38 && pokerArray[i] >= 26) { // Hearts (26 - 38)
  241.             suitArray[2][pokerArray[i]-26] = 1;
  242.         }
  243.         if(pokerArray[i] <= 51 && pokerArray[i] >= 39) { // Spades (39 - 51)
  244.             suitArray[3][pokerArray[i]-39] = 1;
  245.         }
  246.     }
  247.    
  248.     // Royal Check
  249.     for(new i = 0; i < 4; i++) {
  250.         if(suitArray[i][0] == 1) {
  251.             if(suitArray[i][9] == 1) {
  252.                 if(suitArray[i][10] == 1) {
  253.                     if(suitArray[i][11] == 1) {
  254.                         if(suitArray[i][12] == 1) {
  255.                             isRoyalFlush = true;
  256.                             break;
  257.                         }
  258.                     }
  259.                 }
  260.             }
  261.         }
  262.     }
  263.     tmp = 0;
  264.    
  265.     // Flush Check
  266.     for(new i = 0; i < 4; i++) {
  267.         for(new j = 0; j < 13; j++) {
  268.             if(suitArray[i][j] == 1) {
  269.                 tmp++;
  270.             }
  271.         }
  272.        
  273.         if(tmp > 4) {
  274.             isFlush = true;
  275.             break;
  276.         } else {
  277.             tmp = 0;
  278.         }
  279.     }
  280.     tmp = 0;
  281.    
  282.     // Four of a Kind Check
  283.     // Three of a Kind Check
  284.     for(new i = 0; i < 4; i++) {
  285.         for(new j = 0; j < 13; j++) {
  286.             if(suitArray[i][j] == 1) {
  287.                 for(new c = 0; c < 4; c++) {
  288.                     if(suitArray[c][j] == 1) {
  289.                         tmp++;
  290.                     }
  291.                 }
  292.                 if(tmp == 4) {
  293.                     isFour = true;
  294.                 }
  295.                 else if(tmp >= 3) {
  296.                     isThree = true;
  297.                 } else {
  298.                     tmp = 0;
  299.                 }
  300.             }
  301.         }
  302.     }
  303.     tmp = 0;
  304.    
  305.     // Two Pair & Pair Check
  306.     for(new j = 0; j < 13; j++) {
  307.         tmp = 0;
  308.         for(new i = 0; i < 4; i++) {
  309.             if(suitArray[i][j] == 1) {
  310.                 tmp++;
  311.                
  312.                 if(tmp >= 2) {
  313.                     isPair = true;
  314.                     pairs++;
  315.                    
  316.                     if(pairs >= 2) {
  317.                         isTwoPair = true;
  318.                     }
  319.                 }
  320.             }
  321.         }
  322.     }
  323.     tmp = 0;
  324.    
  325.     // Straight Check
  326.     for(new j = 0; j < 13; j++) {
  327.         for(new i = 0; i < 4; i++) {
  328.             if(suitArray[i][j] == 1) {
  329.                 for(new s = 0; s < 5; s++) {
  330.                     for(new c = 0; c < 4; c++) {
  331.                         if(j+s == 13)
  332.                         {
  333.                             if(suitArray[c][0] == 1) {
  334.                                 tmp++;
  335.                                 break;
  336.                             }
  337.                         }
  338.                         else if (j+s >= 14)
  339.                         {
  340.                             break;
  341.                         }
  342.                         else
  343.                         {
  344.                             if(suitArray[c][j+s] == 1) {
  345.                                 tmp++;
  346.                                 break;
  347.                             }
  348.                         }
  349.                     }
  350.                 }
  351.             }
  352.             if(tmp >= 5) {
  353.                 isStraight = true;
  354.             }
  355.             tmp = 0;
  356.         }
  357.     }
  358.     tmp = 0;
  359.    
  360.     // Convert Hand to Singles
  361.    
  362.     // Card 1
  363.     if(pokerArray[0] > 12 && pokerArray[0] < 26) pokerArray[0] -= 13;
  364.     if(pokerArray[0] > 25 && pokerArray[0] < 39) pokerArray[0] -= 26;
  365.     if(pokerArray[0] > 38 && pokerArray[0] < 52) pokerArray[0] -= 39;
  366.     if(pokerArray[0] == 0) pokerArray[0] = 13; // Convert Aces to worth 13.
  367.    
  368.     // Card 2
  369.     if(pokerArray[1] > 12 && pokerArray[1] < 26) pokerArray[1] -= 13;
  370.     if(pokerArray[1] > 25 && pokerArray[1] < 39) pokerArray[1] -= 26;
  371.     if(pokerArray[1] > 38 && pokerArray[1] < 52) pokerArray[1] -= 39;
  372.     if(pokerArray[1] == 0) pokerArray[1] = 13; // Convert Aces to worth 13.
  373.    
  374.     // 10) POKER_RESULT_ROYAL_FLUSH - A, K, Q, J, 10 (SAME SUIT) * ROYAL + FLUSH *
  375.     if(isRoyalFlush) {
  376.         SetPVarString(playerid, "pkrResultString", "Royal Flush");
  377.         return 1000 + pokerArray[0] + pokerArray[1];
  378.     }
  379.  
  380.     // 9) POKER_RESULT_STRAIGHT_FLUSH - Any five card squence. (SAME SUIT) * STRAIGHT + FLUSH *
  381.     if(isStraight && isFlush) {
  382.         SetPVarString(playerid, "pkrResultString", "Straight Flush");
  383.         return 900 + pokerArray[0] + pokerArray[1];
  384.     }
  385.    
  386.     // 8) POKER_RESULT_FOUR_KIND - All four cards of the same rank. * FOUR KIND *
  387.     if(isFour) {
  388.         SetPVarString(playerid, "pkrResultString", "Four of a Kind");
  389.         return 800 + pokerArray[0] + pokerArray[1];
  390.     }
  391.    
  392.     // 7) POKER_RESULT_FULL_HOUSE - Three of a kind combined with a pair. * THREE KIND + PAIR *
  393.     if(isThree && isTwoPair) {
  394.         SetPVarString(playerid, "pkrResultString", "Full House");
  395.         return 700 + pokerArray[0] + pokerArray[1];
  396.     }
  397.    
  398.     // 6) POKER_RESULT_FLUSH - Any five cards of the same suit, no sequence. * FLUSH *
  399.     if(isFlush) {
  400.         SetPVarString(playerid, "pkrResultString", "Flush");
  401.         return 600 + pokerArray[0] + pokerArray[1];
  402.     }
  403.    
  404.     // 5) POKER_RESULT_STRAIGHT - Five cards in sequence, but not in the same suit. * STRAIGHT *
  405.     if(isStraight) {
  406.         SetPVarString(playerid, "pkrResultString", "Straight");
  407.         return 500 + pokerArray[0] + pokerArray[1];
  408.     }
  409.    
  410.     // 4) POKER_RESULT_THREE_KIND - Three cards of the same rank. * THREE KIND *
  411.     if(isThree) {
  412.         SetPVarString(playerid, "pkrResultString", "Three of a Kind");
  413.         return 400 + pokerArray[0] + pokerArray[1];
  414.     }
  415.    
  416.     // 3) POKER_RESULT_TWO_PAIR - Two seperate pair. * TWO PAIR *
  417.     if(isTwoPair) {
  418.         SetPVarString(playerid, "pkrResultString", "Two Pair");
  419.         return 300 + pokerArray[0] + pokerArray[1];
  420.     }
  421.    
  422.     // 2) POKER_RESULT_PAIR - Two cards of the same rank. * PAIR *
  423.     if(isPair) {
  424.         SetPVarString(playerid, "pkrResultString", "Pair");
  425.         return 200 + pokerArray[0] + pokerArray[1];
  426.     }
  427.    
  428.     // 1) POKER_RESULT_HIGH_CARD - Highest card.
  429.     SetPVarString(playerid, "pkrResultString", "High Card");
  430.     return pokerArray[0] + pokerArray[1];
  431. }
  432.  
  433. SetPlayerPosObjectOffset(objectid, playerid, Float:offset_x, Float:offset_y, Float:offset_z)
  434. {
  435.     new Float:object_px,
  436.         Float:object_py,
  437.         Float:object_pz,
  438.         Float:object_rx,
  439.         Float:object_ry,
  440.         Float:object_rz;
  441.        
  442.     GetObjectPos(objectid, object_px, object_py, object_pz);
  443.     GetObjectRot(objectid, object_rx, object_ry, object_rz);
  444.    
  445.     new Float:cos_x = floatcos(object_rx, degrees),
  446.         Float:cos_y = floatcos(object_ry, degrees),
  447.         Float:cos_z = floatcos(object_rz, degrees),
  448.         Float:sin_x = floatsin(object_rx, degrees),
  449.         Float:sin_y = floatsin(object_ry, degrees),
  450.         Float:sin_z = floatsin(object_rz, degrees);
  451.        
  452.     new Float:x, Float:y, Float:z;
  453.     x = object_px + offset_x * cos_y * cos_z - offset_x * sin_x * sin_y * sin_z - offset_y * cos_x * sin_z + offset_z * sin_y * cos_z + offset_z * sin_x * cos_y * sin_z;
  454.     y = object_py + offset_x * cos_y * sin_z + offset_x * sin_x * sin_y * cos_z + offset_y * cos_x * cos_z + offset_z * sin_y * sin_z - offset_z * sin_x * cos_y * cos_z;
  455.     z = object_pz - offset_x * cos_x * sin_y + offset_y * sin_x + offset_z * cos_x * cos_y;
  456.    
  457.     SetPlayerPos(playerid, x, y, z);
  458. }
  459.  
  460. stock BubbleSort(a[], size)
  461. {
  462.     new tmp=0, bool:swapped;
  463.    
  464.     do
  465.     {
  466.         swapped = false;
  467.         for(new i=1; i < size; i++) {
  468.             if(a[i-1] > a[i]) {
  469.                 tmp = a[i];
  470.                 a[i] = a[i-1];
  471.                 a[i-1] = tmp;
  472.                 swapped = true;
  473.             }
  474.         }
  475.     } while(swapped);
  476. }
  477.  
  478. forward PokerExit(playerid);
  479. public PokerExit(playerid)
  480. {
  481.     SetCameraBehindPlayer(playerid);
  482.     TogglePlayerControllable(playerid, 1);
  483.     ClearAnimations(playerid);
  484.     CancelSelectTextDraw(playerid);
  485. }
  486.  
  487. forward PokerPulse(tableid);
  488. public PokerPulse(tableid)
  489. {
  490.     // Idle Animation Loop & Re-seater
  491.     for(new i = 0; i < 6; i++) {
  492.         new playerid = PokerTable[tableid][pkrSlot][i];
  493.        
  494.         if(playerid != -1) {
  495.        
  496.             // Disable Weapons
  497.             SetPlayerArmedWeapon(playerid,0);
  498.        
  499.             new idleRandom = random(100);
  500.             if(idleRandom >= 90) {
  501.                 SetPlayerPosObjectOffset(PokerTable[tableid][pkrObjectID], playerid, PokerTableMiscObjOffsets[i][0], PokerTableMiscObjOffsets[i][1], PokerTableMiscObjOffsets[i][2]);
  502.                 SetPlayerFacingAngle(playerid, PokerTableMiscObjOffsets[i][5]+90.0);
  503.                
  504.                 // Animation
  505.                 if(GetPVarInt(playerid, "pkrActiveHand")) {
  506.                     ApplyAnimation(playerid, "CASINO", "cards_loop", 4.1, 0, 1, 1, 1, 1, 1);
  507.                 }
  508.             }
  509.         }
  510.     }
  511.  
  512.     // 3D Text Label
  513.     Update3DTextLabelText(PokerTable[tableid][pkrText3DID], COLOR_GOLD, " ");
  514.    
  515.     if(PokerTable[tableid][pkrActivePlayers] >= 2 && PokerTable[tableid][pkrActive] == 2) {
  516.        
  517.         // Count the number of active players with more than $0, activate the round if more than 1 gets counted.
  518.         new tmpCount = 0;
  519.         for(new i = 0; i < 6; i++) {
  520.             new playerid = PokerTable[tableid][pkrSlot][i];
  521.            
  522.             if(playerid != -1) {
  523.                 if(GetPVarInt(playerid, "pkrChips") > 0) {
  524.                     tmpCount++;
  525.                 }
  526.             }
  527.         }
  528.        
  529.         if(tmpCount > 1) {
  530.             PokerTable[tableid][pkrActive] = 3;
  531.             PokerTable[tableid][pkrDelay] = PokerTable[tableid][pkrSetDelay];
  532.         }
  533.     }
  534.    
  535.     if(PokerTable[tableid][pkrPlayers] < 2 && PokerTable[tableid][pkrActive] == 3) {
  536.         // Pseudo Code (Move Pot towards last player's chip count)
  537.        
  538.         for(new i = 0; i < 6; i++) {
  539.             new playerid = PokerTable[tableid][pkrSlot][i];
  540.            
  541.             if(playerid != -1) {
  542.                 SetPVarInt(playerid, "pkrChips", GetPVarInt(playerid, "pkrChips")+PokerTable[tableid][pkrPot]);
  543.            
  544.                 LeavePokerTable(playerid);
  545.                 ResetPokerTable(tableid);
  546.                 JoinPokerTable(playerid, tableid);
  547.             }  
  548.         }
  549.     }
  550.    
  551.     // Winner Loop
  552.     if(PokerTable[tableid][pkrActive] == 4)
  553.     {
  554.         if(PokerTable[tableid][pkrDelay] == 20) {
  555.             new endBetsSoundID[] = {5826, 5827};
  556.             new randomEndBetsSoundID = random(sizeof(endBetsSoundID));
  557.             GlobalPlaySound(endBetsSoundID[randomEndBetsSoundID], PokerTable[tableid][pkrX], PokerTable[tableid][pkrY], PokerTable[tableid][pkrZ]);
  558.            
  559.             for(new i = 0; i < 6; i++) {
  560.                 new playerid = PokerTable[tableid][pkrSlot][i];
  561.                
  562.                 if(playerid != -1) {
  563.                     PokerOptions(playerid, 0);
  564.                 }
  565.             }
  566.         }
  567.    
  568.         if(PokerTable[tableid][pkrDelay] > 0) {
  569.             PokerTable[tableid][pkrDelay]--;
  570.             if(PokerTable[tableid][pkrDelay] <= 5 && PokerTable[tableid][pkrDelay] > 0) {
  571.                 for(new i = 0; i < 6; i++) {
  572.                     new playerid = PokerTable[tableid][pkrSlot][i];
  573.                    
  574.                     if(playerid != -1) PlayerPlaySound(playerid, 1139, 0.0, 0.0, 0.0);
  575.                 }
  576.             }
  577.         }
  578.    
  579.         if(PokerTable[tableid][pkrDelay] == 0) {
  580.             return ResetPokerRound(tableid);
  581.         }
  582.        
  583.         if(PokerTable[tableid][pkrDelay] == 19) {
  584.             // Anaylze Cards
  585.             new resultArray[6];
  586.             for(new i = 0; i < 6; i++) {
  587.                 new playerid = PokerTable[tableid][pkrSlot][i];
  588.                 new cards[7];
  589.                
  590.                 if(playerid != -1) {
  591.                     if(GetPVarInt(playerid, "pkrActiveHand")) {
  592.                         cards[0] = GetPVarInt(playerid, "pkrCard1");
  593.                         cards[1] = GetPVarInt(playerid, "pkrCard2");
  594.                        
  595.                         new tmp = 0;
  596.                         for(new c = 2; c < 7; c++) {
  597.                             cards[c] = PokerTable[tableid][pkrCCards][tmp];
  598.                             tmp++;
  599.                         }
  600.                        
  601.                         SetPVarInt(playerid, "pkrResult", AnaylzePokerHand(playerid, cards));
  602.                     }
  603.                 }
  604.             }
  605.            
  606.             // Sorting Results (Highest to Lowest)
  607.             for(new i = 0; i < 6; i++) {
  608.                 new playerid = PokerTable[tableid][pkrSlot][i];
  609.                
  610.                 if(playerid != -1) {
  611.                     if(GetPVarInt(playerid, "pkrActiveHand")) {
  612.                         resultArray[i] = GetPVarInt(playerid, "pkrResult");
  613.                     }
  614.                 }
  615.             }
  616.             BubbleSort(resultArray, sizeof(resultArray));
  617.            
  618.             // Determine Winner(s)
  619.             for(new i = 0; i < 6; i++) {
  620.                 if(resultArray[5] == resultArray[i])
  621.                     PokerTable[tableid][pkrWinners]++;
  622.             }
  623.            
  624.             // Notify Table of Winner & Give Rewards
  625.             for(new i = 0; i < 6; i++) {
  626.                 new playerid = PokerTable[tableid][pkrSlot][i];
  627.                
  628.                 if(playerid != -1) {
  629.                     if(PokerTable[tableid][pkrWinners] > 1) {
  630.                         // Split
  631.                         if(resultArray[5] == GetPVarInt(playerid, "pkrResult")) {
  632.                             new splitPot = PokerTable[tableid][pkrPot]/PokerTable[tableid][pkrWinners];
  633.                            
  634.                             SetPVarInt(playerid, "pkrWinner", 1);
  635.                             SetPVarInt(playerid, "pkrChips", GetPVarInt(playerid, "pkrChips")+splitPot);
  636.                            
  637.                             PlayerPlaySound(playerid, 5821, 0.0, 0.0, 0.0);
  638.                         } else {
  639.                             PlayerPlaySound(playerid, 31202, 0.0, 0.0, 0.0);
  640.                         }
  641.                     } else {
  642.                         // Single Winner
  643.                         if(resultArray[5] == GetPVarInt(playerid, "pkrResult")) {
  644.                             SetPVarInt(playerid, "pkrWinner", 1);
  645.                             SetPVarInt(playerid, "pkrChips", GetPVarInt(playerid, "pkrChips")+PokerTable[tableid][pkrPot]);
  646.                             PokerTable[tableid][pkrWinnerID] = playerid;
  647.                            
  648.                             new winnerSoundID[] = {5847, 5848, 5849, 5854, 5855, 5856};
  649.                             new randomWinnerSoundID = random(sizeof(winnerSoundID));
  650.                             PlayerPlaySound(playerid, winnerSoundID[randomWinnerSoundID], 0.0, 0.0, 0.0);
  651.                         } else {
  652.                             PlayerPlaySound(playerid, 31202, 0.0, 0.0, 0.0);
  653.                         }
  654.                     }
  655.                 }
  656.             }
  657.         }
  658.     }
  659.    
  660.     // Game Loop
  661.     if(PokerTable[tableid][pkrActive] == 3)
  662.     {
  663.         if(PokerTable[tableid][pkrActiveHands] == 1 && PokerTable[tableid][pkrRound] == 1) {
  664.             PokerTable[tableid][pkrStage] = 0;
  665.             PokerTable[tableid][pkrActive] = 4;
  666.             PokerTable[tableid][pkrDelay] = 20+1;
  667.            
  668.             for(new i = 0; i < 6; i++) {
  669.                 new playerid = PokerTable[tableid][pkrSlot][i];
  670.                
  671.                 if(playerid != -1) {
  672.                     if(GetPVarInt(playerid, "pkrActiveHand")) {
  673.                         SetPVarInt(playerid, "pkrHide", 1);
  674.                     }
  675.                 }
  676.             }
  677.         }
  678.    
  679.         // Delay Time Controller
  680.         if(PokerTable[tableid][pkrDelay] > 0) {
  681.             PokerTable[tableid][pkrDelay]--;
  682.             if(PokerTable[tableid][pkrDelay] <= 5 && PokerTable[tableid][pkrDelay] > 0) {
  683.                 for(new i = 0; i < 6; i++) {
  684.                     new playerid = PokerTable[tableid][pkrSlot][i];
  685.                    
  686.                     if(playerid != -1) PlayerPlaySound(playerid, 1139, 0.0, 0.0, 0.0);
  687.                 }
  688.             }
  689.         }
  690.        
  691.         // Assign Blinds & Active Player
  692.         if(PokerTable[tableid][pkrRound] == 0 && PokerTable[tableid][pkrDelay] == 5)
  693.         {
  694.             for(new i = 0; i < 6; i++) {
  695.                 new playerid = PokerTable[tableid][pkrSlot][i];
  696.                
  697.                 if(playerid != -1) {
  698.                     SetPVarInt(playerid, "pkrStatus", 1);
  699.                 }
  700.             }
  701.        
  702.             PokerAssignBlinds(tableid);
  703.         }
  704.    
  705.         // If no round active, start it.
  706.         if(PokerTable[tableid][pkrRound] == 0 && PokerTable[tableid][pkrDelay] == 0)
  707.         {
  708.             PokerTable[tableid][pkrRound] = 1;
  709.            
  710.             for(new i = 0; i < 6; i++) {
  711.                 new playerid = PokerTable[tableid][pkrSlot][i];
  712.                
  713.                 if(playerid != -1) {
  714.                     SetPVarString(playerid, "pkrStatusString", " ");
  715.                 }
  716.             }
  717.            
  718.             // Shuffle Deck & Deal Cards & Allocate Community Cards
  719.             PokerShuffleDeck(tableid);
  720.             PokerDealHands(tableid);
  721.             PokerRotateActivePlayer(tableid);
  722.         }
  723.        
  724.         // Round Logic
  725.        
  726.         // Time Controller
  727.         for(new i = 0; i < 6; i++) {
  728.             new playerid = PokerTable[tableid][pkrSlot][i];
  729.            
  730.             if(playerid != -1) {
  731.                 if(GetPVarInt(playerid, "pkrActivePlayer")) {
  732.                     SetPVarInt(playerid, "pkrTime", GetPVarInt(playerid, "pkrTime")-1);
  733.                     if(GetPVarInt(playerid, "pkrTime") == 0) {
  734.                         new name[24];
  735.                         GetPlayerName(playerid, name, sizeof(name));
  736.                        
  737.                         if(GetPVarInt(playerid, "pkrActionChoice")) {
  738.                             DeletePVar(playerid, "pkrActionChoice");
  739.                            
  740.                             ShowPlayerDialog(playerid, -1, DIALOG_STYLE_LIST, "Close", "Close", "Close", "Close");
  741.                         }
  742.                        
  743.                         PokerFoldHand(playerid);
  744.                         PokerRotateActivePlayer(tableid);
  745.                     }
  746.                 }  
  747.             }
  748.         }
  749.     }
  750.    
  751.     // Update GUI
  752.     for(new i = 0; i < 6; i++) {
  753.         new playerid = PokerTable[tableid][pkrSlot][i];
  754.         new tmp, tmpString[128];
  755.        
  756.         // Set Textdraw Offset
  757.         switch(i)
  758.         {
  759.             case 0: { tmp = 0; }
  760.             case 1: { tmp = 5; }
  761.             case 2: { tmp = 10; }
  762.             case 3: { tmp = 15; }
  763.             case 4: { tmp = 20; }
  764.             case 5: { tmp = 25; }
  765.         }
  766.        
  767.         if(playerid != -1) {       
  768.             // Debug
  769.             new string[512];
  770.             format(string, sizeof(string), "Debug:~n~pkrActive: %d~n~pkrPlayers: %d~n~pkrActivePlayers: %d~n~pkrActiveHands: %d~n~pkrPos: %d~n~pkrDelay: %d~n~pkrRound: %d~n~pkrStage: %d~n~pkrActiveBet: %d~n~pkrRotations: %d",
  771.                 PokerTable[tableid][pkrActive],
  772.                 PokerTable[tableid][pkrPlayers],
  773.                 PokerTable[tableid][pkrActivePlayers],
  774.                 PokerTable[tableid][pkrActiveHands],
  775.                 PokerTable[tableid][pkrPos],
  776.                 PokerTable[tableid][pkrDelay],
  777.                 PokerTable[tableid][pkrRound],
  778.                 PokerTable[tableid][pkrStage],
  779.                 PokerTable[tableid][pkrActiveBet],
  780.                 PokerTable[tableid][pkrRotations]
  781.             );
  782.             format(string, sizeof(string), "%s~n~----------~n~", string);
  783.            
  784.             new sstring[128];
  785.             GetPVarString(playerid, "pkrStatusString", sstring, 128);
  786.             format(string, sizeof(string), "%spkrTableID: %d~n~pkrCurrentBet: %d~n~pkrStatus: %d~n~pkrRoomLeader: %d~n~pkrRoomBigBlind: %d~n~pkrRoomSmallBlind: %d~n~pkrRoomDealer: %d~n~pkrActivePlayer: %d~n~pkrActiveHand: %d~n~pkrStatusString: %s",
  787.                 string,
  788.                 GetPVarInt(playerid, "pkrTableID")-1,
  789.                 GetPVarInt(playerid, "pkrCurrentBet"),
  790.                 GetPVarInt(playerid, "pkrStatus"),
  791.                 GetPVarInt(playerid, "pkrRoomLeader"),
  792.                 GetPVarInt(playerid, "pkrRoomBigBlind"),
  793.                 GetPVarInt(playerid, "pkrRoomSmallBlind"),
  794.                 GetPVarInt(playerid, "pkrRoomDealer"),
  795.                 GetPVarInt(playerid, "pkrActivePlayer"),
  796.                 GetPVarInt(playerid, "pkrActiveHand"),
  797.                 sstring
  798.             );
  799.            
  800.             PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][45], string);
  801.        
  802.             // Name
  803.             new name[MAX_PLAYER_NAME+1];
  804.             GetPlayerName(playerid, name, sizeof(name));
  805.             for(new td = 0; td < 6; td++) {
  806.                 new pid = PokerTable[tableid][pkrSlot][td];
  807.                
  808.                 if(pid != -1) PlayerTextDrawSetString(pid, PlayerPokerUI[pid][0+tmp], name);
  809.             }
  810.            
  811.             // Chips
  812.             if(GetPVarInt(playerid, "pkrChips") > 0) {
  813.                 format(tmpString, sizeof(tmpString), "$%d", GetPVarInt(playerid, "pkrChips"));
  814.             } else {
  815.                 format(tmpString, sizeof(tmpString), "~r~$%d", GetPVarInt(playerid, "pkrChips"));
  816.             }
  817.             for(new td = 0; td < 6; td++) {
  818.                 new pid = PokerTable[tableid][pkrSlot][td];
  819.                
  820.                 if(pid != -1) PlayerTextDrawSetString(pid, PlayerPokerUI[pid][1+tmp], tmpString);
  821.             }
  822.            
  823.             // Cards
  824.             for(new td = 0; td < 6; td++) {
  825.                 new pid = PokerTable[tableid][pkrSlot][td];
  826.                
  827.                 if(pid != -1) {
  828.                     if(GetPVarInt(playerid, "pkrActiveHand")) {
  829.                         if(playerid != pid) {
  830.                             if(PokerTable[tableid][pkrActive] == 4 && PokerTable[tableid][pkrDelay] <= 19 && GetPVarInt(playerid, "pkrHide") != 1) {
  831.                                 format(tmpString, sizeof(tmpString), "%s", DeckTextdrw[GetPVarInt(playerid, "pkrCard1")+1]);
  832.                                 PlayerTextDrawSetString(pid, PlayerPokerUI[pid][2+tmp], tmpString);
  833.                                 format(tmpString, sizeof(tmpString), "%s", DeckTextdrw[GetPVarInt(playerid, "pkrCard2")+1]);
  834.                                 PlayerTextDrawSetString(pid, PlayerPokerUI[pid][3+tmp], tmpString);
  835.                             } else {
  836.                                 PlayerTextDrawSetString(pid, PlayerPokerUI[pid][2+tmp], DeckTextdrw[0]);
  837.                                 PlayerTextDrawSetString(pid, PlayerPokerUI[pid][3+tmp], DeckTextdrw[0]);
  838.                             }
  839.                         } else {
  840.                             format(tmpString, sizeof(tmpString), "%s", DeckTextdrw[GetPVarInt(playerid, "pkrCard1")+1]);
  841.                             PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][2+tmp], tmpString);
  842.                                
  843.                             format(tmpString, sizeof(tmpString), "%s", DeckTextdrw[GetPVarInt(playerid, "pkrCard2")+1]);
  844.                             PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][3+tmp], tmpString);
  845.                         }
  846.                     } else {
  847.                         PlayerTextDrawSetString(pid, PlayerPokerUI[pid][2+tmp], " ");
  848.                         PlayerTextDrawSetString(pid, PlayerPokerUI[pid][3+tmp], " ");
  849.                     }
  850.                 }
  851.             }
  852.            
  853.             // Status
  854.             if(PokerTable[tableid][pkrActive] < 3) {
  855.                 format(tmpString, sizeof(tmpString), " ");
  856.             } else if(GetPVarInt(playerid, "pkrActivePlayer") && PokerTable[tableid][pkrActive] == 3) {
  857.                 format(tmpString, sizeof(tmpString), "0:%d", GetPVarInt(playerid, "pkrTime"));
  858.             } else {
  859.                 if(PokerTable[tableid][pkrActive] == 3 && PokerTable[tableid][pkrDelay] > 5) {
  860.                     SetPVarString(playerid, "pkrStatusString", " ");
  861.                 }
  862.                
  863.                 if(PokerTable[tableid][pkrActive] == 4 && PokerTable[tableid][pkrDelay] == 19) {
  864.                     if(PokerTable[tableid][pkrWinners] == 1) {
  865.                         if(GetPVarInt(playerid, "pkrWinner")) {
  866.                             format(tmpString, sizeof(tmpString), "+$%d", PokerTable[tableid][pkrPot]);
  867.                             SetPVarString(playerid, "pkrStatusString", tmpString);
  868.                         } else {
  869.                             format(tmpString, sizeof(tmpString), "-$%d", GetPVarInt(playerid, "pkrCurrentBet"));
  870.                             SetPVarString(playerid, "pkrStatusString", tmpString);
  871.                         }
  872.                     } else {
  873.                         if(GetPVarInt(playerid, "pkrWinner")) {
  874.                             new splitPot = PokerTable[tableid][pkrPot]/PokerTable[tableid][pkrWinners];
  875.                             format(tmpString, sizeof(tmpString), "+$%d", splitPot);
  876.                             SetPVarString(playerid, "pkrStatusString", tmpString);
  877.                         } else {
  878.                             format(tmpString, sizeof(tmpString), "-$%d", GetPVarInt(playerid, "pkrCurrentBet"));
  879.                             SetPVarString(playerid, "pkrStatusString", tmpString);
  880.                         }
  881.                     }
  882.                 }
  883.                
  884.                 if(PokerTable[tableid][pkrActive] == 4 && PokerTable[tableid][pkrDelay] == 19) {
  885.                     if(GetPVarInt(playerid, "pkrActiveHand") && GetPVarInt(playerid, "pkrHide") != 1) {
  886.                         new resultString[64];
  887.                         GetPVarString(playerid, "pkrResultString", resultString, 64);
  888.                         format(tmpString, sizeof(tmpString), "%s", resultString);
  889.                         SetPVarString(playerid, "pkrStatusString", resultString);
  890.                     }
  891.                 }
  892.                
  893.                 if(PokerTable[tableid][pkrActive] == 4 && PokerTable[tableid][pkrDelay] == 10) {
  894.                     if(PokerTable[tableid][pkrWinners] == 1) {
  895.                         if(GetPVarInt(playerid, "pkrWinner")) {
  896.                             format(tmpString, sizeof(tmpString), "+$%d", PokerTable[tableid][pkrPot]);
  897.                             SetPVarString(playerid, "pkrStatusString", tmpString);
  898.                         } else {
  899.                             format(tmpString, sizeof(tmpString), "-$%d", GetPVarInt(playerid, "pkrCurrentBet"));
  900.                             SetPVarString(playerid, "pkrStatusString", tmpString);
  901.                         }
  902.                     } else {
  903.                         if(GetPVarInt(playerid, "pkrWinner")) {
  904.                             new splitPot = PokerTable[tableid][pkrPot]/PokerTable[tableid][pkrWinners];
  905.                             format(tmpString, sizeof(tmpString), "+$%d", splitPot);
  906.                             SetPVarString(playerid, "pkrStatusString", tmpString);
  907.                         } else {
  908.                             format(tmpString, sizeof(tmpString), "-$%d", GetPVarInt(playerid, "pkrCurrentBet"));
  909.                             SetPVarString(playerid, "pkrStatusString", tmpString);
  910.                         }
  911.                     }
  912.                 }
  913.            
  914.                 GetPVarString(playerid, "pkrStatusString", tmpString, 128);
  915.             }
  916.            
  917.             for(new td = 0; td < 6; td++) {
  918.                 new pid = PokerTable[tableid][pkrSlot][td];
  919.                
  920.                 if(pid != -1) PlayerTextDrawSetString(pid, PlayerPokerUI[pid][4+tmp], tmpString);
  921.             }
  922.            
  923.             // Pot
  924.             if(PokerTable[tableid][pkrDelay] > 0 && PokerTable[tableid][pkrActive] == 3) {
  925.                 if(playerid != -1) PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][37], "Texas Holdem Poker");
  926.             } else if(PokerTable[tableid][pkrActive] == 2) {
  927.                 if(playerid != -1) PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][37], "Texas Holdem Poker");
  928.             } else if(PokerTable[tableid][pkrActive] == 3) {
  929.                 format(tmpString, sizeof(tmpString), "Pot: $%d", PokerTable[tableid][pkrPot]);
  930.                 if(playerid != -1) PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][37], tmpString);
  931.             } else if(PokerTable[tableid][pkrActive] == 4 && PokerTable[tableid][pkrDelay] < 19) {
  932.                 if(PokerTable[tableid][pkrWinnerID] != -1) {
  933.                     new winnerName[24];
  934.                     GetPlayerName(PokerTable[tableid][pkrWinnerID], winnerName, sizeof(winnerName));
  935.                     format(tmpString, sizeof(tmpString), "%s Won $%d", winnerName, PokerTable[tableid][pkrPot]);
  936.                     if(playerid != -1) PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][37], tmpString);
  937.                 } else if(PokerTable[tableid][pkrWinners] > 1) {
  938.                     new splitPot = PokerTable[tableid][pkrPot]/PokerTable[tableid][pkrWinners];
  939.                     format(tmpString, sizeof(tmpString), "%d Winners Won $%d", PokerTable[tableid][pkrWinners], splitPot);
  940.                     if(playerid != -1) PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][37], tmpString);
  941.                 }
  942.             } else {
  943.                 if(playerid != -1) PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][37], "Texas Holdem Poker");
  944.             }
  945.            
  946.             // Bet
  947.             if(PokerTable[tableid][pkrDelay] > 0 && PokerTable[tableid][pkrActive] == 3) {
  948.                 format(tmpString, sizeof(tmpString), "Round Begins in ~r~%d~w~...", PokerTable[tableid][pkrDelay]);
  949.                 if(playerid != -1) PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][46], tmpString);
  950.             } else if(PokerTable[tableid][pkrActive] == 2) {
  951.                 format(tmpString, sizeof(tmpString), "Waiting for players...", PokerTable[tableid][pkrPot]);
  952.                 if(playerid != -1) PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][46], tmpString);
  953.             } else if(PokerTable[tableid][pkrActive] == 3) {
  954.                 format(tmpString, sizeof(tmpString), "Bet: $%d", PokerTable[tableid][pkrActiveBet]);
  955.                 if(playerid != -1) PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][46], tmpString);
  956.             } else if(PokerTable[tableid][pkrActive] == 4) {
  957.                 format(tmpString, sizeof(tmpString), "Round Ends in ~r~%d~w~...", PokerTable[tableid][pkrDelay]);
  958.                 if(playerid != -1) PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][46], tmpString);
  959.             } else {
  960.                 if(playerid != -1) PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][46], "Texas Holdem Poker");
  961.             }
  962.            
  963.             // Community Cards
  964.             switch(PokerTable[tableid][pkrStage]) {
  965.                 case 0: // Opening
  966.                 {
  967.                     PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][31], "LD_CARD:cdback");
  968.                     PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][32], "LD_CARD:cdback");
  969.                     PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][33], "LD_CARD:cdback");
  970.                     PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][34], "LD_CARD:cdback");
  971.                     PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][35], "LD_CARD:cdback");
  972.                 }
  973.                 case 1: // Flop
  974.                 {
  975.                     PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][31], DeckTextdrw[PokerTable[tableid][pkrCCards][0]+1]);
  976.                     PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][32], DeckTextdrw[PokerTable[tableid][pkrCCards][1]+1]);
  977.                     PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][33], DeckTextdrw[PokerTable[tableid][pkrCCards][2]+1]);
  978.                     PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][34], "LD_CARD:cdback");
  979.                     PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][35], "LD_CARD:cdback");
  980.                 }
  981.                 case 2: // Turn
  982.                 {
  983.                     PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][31], DeckTextdrw[PokerTable[tableid][pkrCCards][0]+1]);
  984.                     PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][32], DeckTextdrw[PokerTable[tableid][pkrCCards][1]+1]);
  985.                     PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][33], DeckTextdrw[PokerTable[tableid][pkrCCards][2]+1]);
  986.                     PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][34], DeckTextdrw[PokerTable[tableid][pkrCCards][3]+1]);
  987.                     PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][35], "LD_CARD:cdback");
  988.                 }
  989.                 case 3: // River
  990.                 {
  991.                     PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][31], DeckTextdrw[PokerTable[tableid][pkrCCards][0]+1]);
  992.                     PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][32], DeckTextdrw[PokerTable[tableid][pkrCCards][1]+1]);
  993.                     PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][33], DeckTextdrw[PokerTable[tableid][pkrCCards][2]+1]);
  994.                     PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][34], DeckTextdrw[PokerTable[tableid][pkrCCards][3]+1]);
  995.                     PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][35], DeckTextdrw[PokerTable[tableid][pkrCCards][4]+1]);
  996.                 }
  997.                 case 4: // Win
  998.                 {
  999.                     PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][31], DeckTextdrw[PokerTable[tableid][pkrCCards][0]+1]);
  1000.                     PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][32], DeckTextdrw[PokerTable[tableid][pkrCCards][1]+1]);
  1001.                     PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][33], DeckTextdrw[PokerTable[tableid][pkrCCards][2]+1]);
  1002.                     PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][34], DeckTextdrw[PokerTable[tableid][pkrCCards][3]+1]);
  1003.                     PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][35], DeckTextdrw[PokerTable[tableid][pkrCCards][4]+1]);
  1004.                 }
  1005.             }
  1006.         } else {
  1007.             for(new td = 0; td < 6; td++) {
  1008.                 new pid = PokerTable[tableid][pkrSlot][td];
  1009.                
  1010.                 if(pid != -1) {
  1011.                     PlayerTextDrawSetString(pid, PlayerPokerUI[pid][0+tmp], " ");
  1012.                     PlayerTextDrawSetString(pid, PlayerPokerUI[pid][1+tmp], " ");
  1013.                     PlayerTextDrawSetString(pid, PlayerPokerUI[pid][2+tmp], " ");
  1014.                     PlayerTextDrawSetString(pid, PlayerPokerUI[pid][3+tmp], " ");
  1015.                     PlayerTextDrawSetString(pid, PlayerPokerUI[pid][4+tmp], " ");
  1016.                 }
  1017.             }
  1018.         }
  1019.     }
  1020.     return 1;
  1021. }
  1022.  
  1023. CameraRadiusSetPos(playerid, Float:x, Float:y, Float:z, Float:degree = 0.0, Float:height = 3.0, Float:radius = 8.0)
  1024. {
  1025.     new Float:deltaToX = x + radius * floatsin(-degree, degrees);
  1026.     new Float:deltaToY = y + radius * floatcos(-degree, degrees);
  1027.     new Float:deltaToZ = z + height;
  1028.    
  1029.     SetPlayerCameraPos(playerid, deltaToX, deltaToY, deltaToZ);
  1030.     SetPlayerCameraLookAt(playerid, x, y, z);
  1031. }
  1032.  
  1033. GlobalPlaySound(soundid, Float:x, Float:y, Float:z)
  1034. {
  1035.     for(new i = 0; i < GetMaxPlayers(); i++) {
  1036.         if(IsPlayerInRangeOfPoint(i, 25.0, x, y, z)) {
  1037.             PlayerPlaySound(i, soundid, x, y, z);
  1038.         }
  1039.     }
  1040. }
  1041.  
  1042. forward split(const strsrc[], strdest[][], delimiter);
  1043. public split(const strsrc[], strdest[][], delimiter)
  1044. {
  1045.     new i, li;
  1046.     new aNum;
  1047.     new len;
  1048.     while(i <= strlen(strsrc)){
  1049.         if(strsrc[i]==delimiter || i==strlen(strsrc)){
  1050.             len = strmid(strdest[aNum], strsrc, li, i, 128);
  1051.             strdest[aNum][len] = 0;
  1052.             li = i+1;
  1053.             aNum++;
  1054.         }
  1055.         i++;
  1056.     }
  1057.     return 1;
  1058. }
  1059.  
  1060. PokerOptions(playerid, option)
  1061. {
  1062.     switch(option)
  1063.     {
  1064.         case 0:
  1065.         {
  1066.             DeletePVar(playerid, "pkrActionOptions");
  1067.             PlayerTextDrawHide(playerid, PlayerPokerUI[playerid][38]);
  1068.             PlayerTextDrawHide(playerid, PlayerPokerUI[playerid][39]);
  1069.             PlayerTextDrawHide(playerid, PlayerPokerUI[playerid][40]);
  1070.         }
  1071.         case 1: // if(CurrentBet >= ActiveBet)
  1072.         {
  1073.             SetPVarInt(playerid, "pkrActionOptions", 1);
  1074.             PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][38], "RAISE");
  1075.             PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][39], "CHECK");
  1076.             PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][40], "FOLD");
  1077.            
  1078.             PlayerTextDrawShow(playerid, PlayerPokerUI[playerid][38]);
  1079.             PlayerTextDrawShow(playerid, PlayerPokerUI[playerid][39]);
  1080.             PlayerTextDrawShow(playerid, PlayerPokerUI[playerid][40]);
  1081.         }
  1082.         case 2: // if(CurrentBet < ActiveBet)
  1083.         {
  1084.             SetPVarInt(playerid, "pkrActionOptions", 2);
  1085.             PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][38], "CALL");
  1086.             PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][39], "RAISE");
  1087.             PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][40], "FOLD");
  1088.  
  1089.             PlayerTextDrawShow(playerid, PlayerPokerUI[playerid][38]);
  1090.             PlayerTextDrawShow(playerid, PlayerPokerUI[playerid][39]);
  1091.             PlayerTextDrawShow(playerid, PlayerPokerUI[playerid][40]);
  1092.         }
  1093.         case 3: // if(pkrChips < 1)
  1094.         {
  1095.             SetPVarInt(playerid, "pkrActionOptions", 3);
  1096.        
  1097.             PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][38], "CHECK");
  1098.             PlayerTextDrawSetString(playerid, PlayerPokerUI[playerid][39], "FOLD");
  1099.  
  1100.             PlayerTextDrawShow(playerid, PlayerPokerUI[playerid][38]);
  1101.             PlayerTextDrawShow(playerid, PlayerPokerUI[playerid][39]);
  1102.         }
  1103.     }
  1104. }
  1105.  
  1106. PokerCallHand(playerid)
  1107. {
  1108.     ShowCasinoGamesMenu(playerid, DIALOG_CGAMESCALLPOKER);
  1109. }
  1110.  
  1111. PokerRaiseHand(playerid)
  1112. {
  1113.     ShowCasinoGamesMenu(playerid, DIALOG_CGAMESRAISEPOKER);
  1114. }
  1115.  
  1116. PokerCheckHand(playerid)
  1117. {
  1118.     if(GetPVarInt(playerid, "pkrActiveHand")) {
  1119.         SetPVarString(playerid, "pkrStatusString", "Check");
  1120.     }
  1121.    
  1122.     // Animation
  1123.     ApplyAnimation(playerid, "CASINO", "cards_raise", 4.1, 0, 1, 1, 1, 1, 1);
  1124. }
  1125.  
  1126. PokerFoldHand(playerid)
  1127. {
  1128.     if(GetPVarInt(playerid, "pkrActiveHand")) {
  1129.         DeletePVar(playerid, "pkrCard1");
  1130.         DeletePVar(playerid, "pkrCard2");
  1131.         DeletePVar(playerid, "pkrActiveHand");
  1132.         DeletePVar(playerid, "pkrStatus");
  1133.        
  1134.         PokerTable[GetPVarInt(playerid, "pkrTableID")-1][pkrActiveHands]--;
  1135.        
  1136.         SetPVarString(playerid, "pkrStatusString", "Fold");
  1137.        
  1138.         // SFX
  1139.         GlobalPlaySound(5602, PokerTable[GetPVarInt(playerid, "pkrTableID")-1][pkrX], PokerTable[GetPVarInt(playerid, "pkrTableID")-1][pkrY], PokerTable[GetPVarInt(playerid, "pkrTableID")-1][pkrZ]);
  1140.        
  1141.         // Animation
  1142.         ApplyAnimation(playerid, "CASINO", "cards_out", 4.1, 0, 1, 1, 1, 1, 1);
  1143.     }
  1144. }
  1145.  
  1146. PokerDealHands(tableid)
  1147. {
  1148.     new tmp = 0;
  1149.  
  1150.     // Loop through active players.
  1151.     for(new i = 0; i < 6; i++) {
  1152.         new playerid = PokerTable[tableid][pkrSlot][i];
  1153.        
  1154.         if(playerid != -1) {
  1155.        
  1156.             if(GetPVarInt(playerid, "pkrStatus") && GetPVarInt(playerid, "pkrChips") > 0) {
  1157.                 SetPVarInt(playerid, "pkrCard1", PokerTable[tableid][pkrDeck][tmp]);
  1158.                 SetPVarInt(playerid, "pkrCard2", PokerTable[tableid][pkrDeck][tmp+1]);
  1159.                
  1160.                 SetPVarInt(playerid, "pkrActiveHand", 1);
  1161.                
  1162.                 PokerTable[tableid][pkrActiveHands]++;
  1163.                
  1164.                 // SFX
  1165.                 PlayerPlaySound(playerid, 5602, 0.0, 0.0, 0.0);
  1166.                
  1167.                 // Animation
  1168.                 ApplyAnimation(playerid, "CASINO", "cards_in", 4.1, 0, 1, 1, 1, 1, 1);
  1169.                
  1170.                 tmp += 2;
  1171.             }
  1172.         }
  1173.     }
  1174.    
  1175.     // Loop through community cards.
  1176.     for(new i = 0; i < 5; i++) {
  1177.    
  1178.         PokerTable[tableid][pkrCCards][i] = PokerTable[tableid][pkrDeck][tmp];
  1179.         tmp++;
  1180.     }
  1181. }
  1182.  
  1183. PokerShuffleDeck(tableid)
  1184. {
  1185.     // SFX
  1186.     GlobalPlaySound(5600, PokerTable[tableid][pkrX], PokerTable[tableid][pkrY], PokerTable[tableid][pkrZ]);
  1187.  
  1188.     // Order the deck
  1189.     for(new i = 0; i < 52; i++) {
  1190.         PokerTable[tableid][pkrDeck][i] = i;
  1191.     }
  1192.    
  1193.     // Randomize the array (AKA Shuffle Algorithm)
  1194.     new rand, tmp, i;
  1195.     for(i = 52; i > 1; i--) {
  1196.         rand = random(52) % i;
  1197.         tmp = PokerTable[tableid][pkrDeck][rand];
  1198.         PokerTable[tableid][pkrDeck][rand] = PokerTable[tableid][pkrDeck][i-1];
  1199.         PokerTable[tableid][pkrDeck][i-1] = tmp;
  1200.     }
  1201. }
  1202.  
  1203. PokerFindPlayerOrder(tableid, index)
  1204. {
  1205.     new tmpIndex = -1;
  1206.     for(new i = 0; i < 6; i++) {
  1207.         new playerid = PokerTable[tableid][pkrSlot][i];
  1208.        
  1209.         if(playerid != -1) {
  1210.             tmpIndex++;
  1211.            
  1212.             if(tmpIndex == index) {
  1213.                 if(GetPVarInt(playerid, "pkrStatus") == 1)
  1214.                     return playerid;
  1215.             }
  1216.         }
  1217.     }
  1218.     return -1;
  1219. }
  1220.  
  1221. PokerAssignBlinds(tableid)
  1222. {
  1223.     if(PokerTable[tableid][pkrPos] == 6) {
  1224.         PokerTable[tableid][pkrPos] = 0;
  1225.     }
  1226.  
  1227.     // Find where to start & distubute blinds.
  1228.     new bool:roomDealer = false, bool:roomBigBlind = false, bool:roomSmallBlind = false;
  1229.            
  1230.     // Find the Dealer.
  1231.     new tmpPos = PokerTable[tableid][pkrPos];
  1232.     while(roomDealer == false) {
  1233.         if(tmpPos == 6) {
  1234.             tmpPos = 0;
  1235.         }
  1236.        
  1237.         new playerid = PokerFindPlayerOrder(tableid, tmpPos);
  1238.                
  1239.         if(playerid != -1) {
  1240.             SetPVarInt(playerid, "pkrRoomDealer", 1);
  1241.             SetPVarString(playerid, "pkrStatusString", "Dealer");
  1242.             roomDealer = true;
  1243.         } else {
  1244.             tmpPos++;
  1245.         }
  1246.     }
  1247.            
  1248.     // Find the player after the Dealer.
  1249.     tmpPos = PokerTable[tableid][pkrPos];
  1250.     while(roomBigBlind == false) { 
  1251.         if(tmpPos == 6) {
  1252.             tmpPos = 0;
  1253.         }
  1254.                
  1255.         new playerid = PokerFindPlayerOrder(tableid, tmpPos);
  1256.                
  1257.         if(playerid != -1) {
  1258.             if(GetPVarInt(playerid, "pkrRoomDealer") != 1 && GetPVarInt(playerid, "pkrRoomBigBlind") != 1 && GetPVarInt(playerid, "pkrRoomSmallBlind") != 1) {
  1259.                 SetPVarInt(playerid, "pkrRoomBigBlind", 1);
  1260.                 new tmpString[128];
  1261.                 format(tmpString, sizeof(tmpString), "~r~BB -$%d", PokerTable[tableid][pkrBlind]);
  1262.                 SetPVarString(playerid, "pkrStatusString", tmpString);
  1263.                 roomBigBlind = true;
  1264.                
  1265.                 if(GetPVarInt(playerid, "pkrChips") < PokerTable[tableid][pkrBlind]) {
  1266.                     PokerTable[tableid][pkrPot] += GetPVarInt(playerid, "pkrChips");
  1267.                     SetPVarInt(playerid, "pkrChips", 0);
  1268.                 } else {
  1269.                     PokerTable[tableid][pkrPot] += PokerTable[tableid][pkrBlind];
  1270.                     SetPVarInt(playerid, "pkrChips", GetPVarInt(playerid, "pkrChips")-PokerTable[tableid][pkrBlind]);
  1271.                 }
  1272.                
  1273.                 SetPVarInt(playerid, "pkrCurrentBet", PokerTable[tableid][pkrBlind]);
  1274.                 PokerTable[tableid][pkrActiveBet] = PokerTable[tableid][pkrBlind];
  1275.                
  1276.             } else {
  1277.                 tmpPos++;
  1278.             }
  1279.         } else {
  1280.             tmpPos++;
  1281.         }
  1282.     }
  1283.            
  1284.     // Small Blinds are active only if there are more than 2 players.
  1285.     if(PokerTable[tableid][pkrActivePlayers] > 2) {
  1286.                
  1287.         // Find the player after the Big Blind.
  1288.         tmpPos = PokerTable[tableid][pkrPos];
  1289.         while(roomSmallBlind == false) {
  1290.             if(tmpPos == 6) {
  1291.                 tmpPos = 0;
  1292.             }
  1293.                    
  1294.             new playerid = PokerFindPlayerOrder(tableid, tmpPos);
  1295.                
  1296.             if(playerid != -1) {
  1297.                 if(GetPVarInt(playerid, "pkrRoomDealer") != 1 && GetPVarInt(playerid, "pkrRoomBigBlind") != 1 && GetPVarInt(playerid, "pkrRoomSmallBlind") != 1) {
  1298.                     SetPVarInt(playerid, "pkrRoomSmallBlind", 1);
  1299.                     new tmpString[128];
  1300.                     format(tmpString, sizeof(tmpString), "~r~SB -$%d", PokerTable[tableid][pkrBlind]/2);
  1301.                     SetPVarString(playerid, "pkrStatusString", tmpString);
  1302.                     roomSmallBlind = true;
  1303.                    
  1304.                     if(GetPVarInt(playerid, "pkrChips") < (PokerTable[tableid][pkrBlind]/2)) {
  1305.                         PokerTable[tableid][pkrPot] += GetPVarInt(playerid, "pkrChips");
  1306.                         SetPVarInt(playerid, "pkrChips", 0);
  1307.                     } else {
  1308.                         PokerTable[tableid][pkrPot] += (PokerTable[tableid][pkrBlind]/2);
  1309.                         SetPVarInt(playerid, "pkrChips", GetPVarInt(playerid, "pkrChips")-(PokerTable[tableid][pkrBlind]/2));
  1310.                     }
  1311.                    
  1312.                     SetPVarInt(playerid, "pkrCurrentBet", PokerTable[tableid][pkrBlind]/2);
  1313.                     PokerTable[tableid][pkrActiveBet] = PokerTable[tableid][pkrBlind]/2;
  1314.                 } else {
  1315.                     tmpPos++;
  1316.                 }
  1317.             } else {
  1318.                 tmpPos++;
  1319.             }
  1320.         }
  1321.     }
  1322.     PokerTable[tableid][pkrPos]++;
  1323. }
  1324.  
  1325. PokerRotateActivePlayer(tableid)
  1326. {  
  1327.     new nextactiveid = -1, lastapid = -1, lastapslot = -1;
  1328.     if(PokerTable[tableid][pkrActivePlayerID] != -1) {
  1329.         lastapid = PokerTable[tableid][pkrActivePlayerID];
  1330.        
  1331.         for(new i = 0; i < 6; i++) {
  1332.             if(PokerTable[tableid][pkrSlot][i] == lastapid) {
  1333.                 lastapslot = i;
  1334.             }
  1335.         }
  1336.        
  1337.         DeletePVar(lastapid, "pkrActivePlayer");
  1338.         DeletePVar(lastapid, "pkrTime");
  1339.        
  1340.         PokerOptions(lastapid, 0);
  1341.     }
  1342.    
  1343.     // New Round Init Block
  1344.     if(PokerTable[tableid][pkrRotations] == 0 && lastapid == -1 && lastapslot == -1) {
  1345.    
  1346.         // Find & Assign ActivePlayer to Dealer
  1347.         for(new i = 0; i < 6; i++) {
  1348.             new playerid = PokerTable[tableid][pkrSlot][i];
  1349.            
  1350.             if(GetPVarInt(playerid, "pkrRoomDealer") == 1) {
  1351.                 nextactiveid = playerid;
  1352.                 PokerTable[tableid][pkrActivePlayerID] = playerid;
  1353.                 PokerTable[tableid][pkrActivePlayerSlot] = i;
  1354.                 PokerTable[tableid][pkrRotations]++;
  1355.                 PokerTable[tableid][pkrSlotRotations] = i;
  1356.             }
  1357.         }
  1358.     }
  1359.     else if(PokerTable[tableid][pkrRotations] >= 6)
  1360.     {  
  1361.         PokerTable[tableid][pkrRotations] = 0;
  1362.         PokerTable[tableid][pkrStage]++;
  1363.        
  1364.         if(PokerTable[tableid][pkrStage] > 3) {
  1365.             PokerTable[tableid][pkrActive] = 4;
  1366.             PokerTable[tableid][pkrDelay] = 20+1;
  1367.             return 1;
  1368.         }
  1369.        
  1370.         PokerTable[tableid][pkrSlotRotations]++;
  1371.         if(PokerTable[tableid][pkrSlotRotations] >= 6) {
  1372.             PokerTable[tableid][pkrSlotRotations] -= 6;
  1373.         }
  1374.        
  1375.         new playerid = PokerFindPlayerOrder(tableid, PokerTable[tableid][pkrSlotRotations]);
  1376.        
  1377.         if(playerid != -1) {
  1378.             nextactiveid = playerid;
  1379.             PokerTable[tableid][pkrActivePlayerID] = playerid;
  1380.             PokerTable[tableid][pkrActivePlayerSlot] = PokerTable[tableid][pkrSlotRotations];
  1381.             PokerTable[tableid][pkrRotations]++;
  1382.         } else {
  1383.             PokerTable[tableid][pkrRotations]++;
  1384.             PokerRotateActivePlayer(tableid);
  1385.         }
  1386.     }
  1387.     else
  1388.     {
  1389.         PokerTable[tableid][pkrSlotRotations]++;
  1390.         if(PokerTable[tableid][pkrSlotRotations] >= 6) {
  1391.             PokerTable[tableid][pkrSlotRotations] -= 6;
  1392.         }
  1393.    
  1394.         new playerid = PokerFindPlayerOrder(tableid, PokerTable[tableid][pkrSlotRotations]);
  1395.        
  1396.         if(playerid != -1) {
  1397.             nextactiveid = playerid;
  1398.             PokerTable[tableid][pkrActivePlayerID] = playerid;
  1399.             PokerTable[tableid][pkrActivePlayerSlot] = PokerTable[tableid][pkrSlotRotations];
  1400.             PokerTable[tableid][pkrRotations]++;
  1401.         } else {
  1402.             PokerTable[tableid][pkrRotations]++;
  1403.             PokerRotateActivePlayer(tableid);
  1404.         }
  1405.     }
  1406.    
  1407.     if(nextactiveid != -1) {
  1408.         if(GetPVarInt(nextactiveid, "pkrActiveHand")) {
  1409.             new currentBet = GetPVarInt(nextactiveid, "pkrCurrentBet");
  1410.             new activeBet = PokerTable[tableid][pkrActiveBet];
  1411.            
  1412.             new apSoundID[] = {5809, 5810};
  1413.             new randomApSoundID = random(sizeof(apSoundID));
  1414.             PlayerPlaySound(nextactiveid, apSoundID[randomApSoundID], 0.0, 0.0, 0.0);
  1415.            
  1416.             if(GetPVarInt(nextactiveid, "pkrChips") < 1) {
  1417.                 PokerOptions(nextactiveid, 3);
  1418.             } else if(currentBet >= activeBet) {
  1419.                 PokerOptions(nextactiveid, 1);
  1420.             } else if (currentBet < activeBet) {
  1421.                 PokerOptions(nextactiveid, 2);
  1422.             } else {
  1423.                 PokerOptions(nextactiveid, 0);
  1424.             }
  1425.            
  1426.             SetPVarInt(nextactiveid, "pkrTime", 60);
  1427.             SetPVarInt(nextactiveid, "pkrActivePlayer", 1);
  1428.         }
  1429.     }
  1430.     return 1;
  1431. }
  1432.  
  1433. InitPokerTables()
  1434. {
  1435.     for(new i = 0; i < MAX_POKERTABLES; i++) {
  1436.         PokerTable[i][pkrActive] = 0;
  1437.         PokerTable[i][pkrPlaced] = 0;
  1438.         PokerTable[i][pkrObjectID] = 0;
  1439.        
  1440.         for(new c = 0; c < MAX_POKERTABLEMISCOBJS; c++) {
  1441.             PokerTable[i][pkrMiscObjectID][c] = 0;
  1442.         }
  1443.        
  1444.         for(new s = 0; s < 6; s++) {
  1445.             PokerTable[i][pkrSlot][s] = -1;
  1446.         }
  1447.        
  1448.         PokerTable[i][pkrX] = 0.0;
  1449.         PokerTable[i][pkrY] = 0.0;
  1450.         PokerTable[i][pkrZ] = 0.0;
  1451.         PokerTable[i][pkrRX] = 0.0;
  1452.         PokerTable[i][pkrRY] = 0.0;
  1453.         PokerTable[i][pkrRZ] = 0.0;
  1454.         PokerTable[i][pkrVW] = 0;
  1455.         PokerTable[i][pkrInt] = 0;
  1456.         PokerTable[i][pkrPlayers] = 0;
  1457.         PokerTable[i][pkrLimit] = 6;
  1458.         PokerTable[i][pkrBuyInMax] = 1000;
  1459.         PokerTable[i][pkrBuyInMin] = 500;
  1460.         PokerTable[i][pkrBlind] = 100;
  1461.         PokerTable[i][pkrPos] = 0;
  1462.         PokerTable[i][pkrRound] = 0;
  1463.         PokerTable[i][pkrStage] = 0;
  1464.         PokerTable[i][pkrActiveBet] = 0;
  1465.         PokerTable[i][pkrSetDelay] = 15;
  1466.         PokerTable[i][pkrActivePlayerID] = -1;
  1467.         PokerTable[i][pkrActivePlayerSlot] = -1;
  1468.         PokerTable[i][pkrRotations] = 0;
  1469.         PokerTable[i][pkrSlotRotations] = 0;
  1470.         PokerTable[i][pkrWinnerID] = -1;
  1471.         PokerTable[i][pkrWinners] = 0;
  1472.     }
  1473.    
  1474.     LoadPokerTables();
  1475. }
  1476.  
  1477. LoadPokerTables()
  1478. {
  1479.     new tmpArray[8][64];
  1480.     new tmpString[512];
  1481.     new File: file = fopen("pokertables.cfg", io_read);
  1482.     if (file)
  1483.     {
  1484.         new idx;
  1485.         while (idx < sizeof(PokerTable))
  1486.         {
  1487.             fread(file, tmpString);
  1488.             split(tmpString, tmpArray, '|');
  1489.             PokerTable[idx][pkrX] = floatstr(tmpArray[0]);
  1490.             PokerTable[idx][pkrY] = floatstr(tmpArray[1]);
  1491.             PokerTable[idx][pkrZ] = floatstr(tmpArray[2]);
  1492.             PokerTable[idx][pkrRX] = floatstr(tmpArray[3]);
  1493.             PokerTable[idx][pkrRY] = floatstr(tmpArray[4]);
  1494.             PokerTable[idx][pkrRZ] = floatstr(tmpArray[5]);
  1495.             PokerTable[idx][pkrVW] = strval(tmpArray[6]);
  1496.             PokerTable[idx][pkrInt] = strval(tmpArray[7]);
  1497.            
  1498.             if(PokerTable[idx][pkrX] != 0.0) {
  1499.                 PlacePokerTable(idx, 1,
  1500.                     PokerTable[idx][pkrX],
  1501.                     PokerTable[idx][pkrY],
  1502.                     PokerTable[idx][pkrZ],
  1503.                     PokerTable[idx][pkrRX],
  1504.                     PokerTable[idx][pkrRY],
  1505.                     PokerTable[idx][pkrRZ],
  1506.                     PokerTable[idx][pkrVW],
  1507.                     PokerTable[idx][pkrInt]
  1508.                 );
  1509.             }
  1510.             idx++;
  1511.         }
  1512.         fclose(file);
  1513.     }
  1514.     return 1;
  1515. }
  1516.  
  1517. SavePokerTables()
  1518. {
  1519.     new idx;
  1520.     new File: file;
  1521.     while (idx < sizeof(PokerTable))
  1522.     {
  1523.         new tmpString[512];
  1524.         format(tmpString, sizeof(tmpString), "%f|%f|%f|%f|%f|%f|%d|%d\n",
  1525.             PokerTable[idx][pkrX],
  1526.             PokerTable[idx][pkrY],
  1527.             PokerTable[idx][pkrZ],
  1528.             PokerTable[idx][pkrRX],
  1529.             PokerTable[idx][pkrRY],
  1530.             PokerTable[idx][pkrRZ],
  1531.             PokerTable[idx][pkrVW],
  1532.             PokerTable[idx][pkrInt]
  1533.         );
  1534.        
  1535.         if(idx == 0) {
  1536.             file = fopen("pokertables.cfg", io_write);
  1537.         } else {
  1538.             file = fopen("pokertables.cfg", io_append);
  1539.         }
  1540.        
  1541.         fwrite(file, tmpString);
  1542.         idx++;
  1543.         fclose(file);
  1544.     }
  1545.     return 1;
  1546. }
  1547.  
  1548. ResetPokerRound(tableid)
  1549. {
  1550.     PokerTable[tableid][pkrRound] = 0;
  1551.     PokerTable[tableid][pkrStage] = 0;
  1552.     PokerTable[tableid][pkrActiveBet] = 0;
  1553.     PokerTable[tableid][pkrActive] = 2;
  1554.     PokerTable[tableid][pkrDelay] = PokerTable[tableid][pkrSetDelay];
  1555.     PokerTable[tableid][pkrPot] = 0;
  1556.     PokerTable[tableid][pkrRotations] = 0;
  1557.     PokerTable[tableid][pkrSlotRotations] = 0;
  1558.     PokerTable[tableid][pkrWinnerID] = -1;
  1559.     PokerTable[tableid][pkrWinners] = 0;
  1560.    
  1561.     // Reset Player Variables
  1562.     for(new i = 0; i < 6; i++) {
  1563.         new playerid = PokerTable[tableid][pkrSlot][i];
  1564.        
  1565.         if(playerid != -1) {
  1566.             DeletePVar(playerid, "pkrWinner");
  1567.             DeletePVar(playerid, "pkrRoomBigBlind");
  1568.             DeletePVar(playerid, "pkrRoomSmallBlind");
  1569.             DeletePVar(playerid, "pkrRoomDealer");
  1570.             DeletePVar(playerid, "pkrCard1");
  1571.             DeletePVar(playerid, "pkrCard2");
  1572.             DeletePVar(playerid, "pkrActivePlayer");
  1573.             DeletePVar(playerid, "pkrTime");
  1574.            
  1575.             if(GetPVarInt(playerid, "pkrActiveHand")) {
  1576.                 PokerTable[tableid][pkrActiveHands]--;
  1577.                
  1578.                 // Animation
  1579.                 ApplyAnimation(playerid, "CASINO", "cards_out", 4.1, 0, 1, 1, 1, 1, 1);
  1580.             }
  1581.            
  1582.             DeletePVar(playerid, "pkrActiveHand");
  1583.             DeletePVar(playerid, "pkrCurrentBet");
  1584.             DeletePVar(playerid, "pkrResultString");
  1585.             DeletePVar(playerid, "pkrHide");
  1586.         }
  1587.     }
  1588.    
  1589.     return 1;
  1590. }
  1591.  
  1592. ResetPokerTable(tableid)
  1593. {
  1594.     new szString[32];
  1595.     format(szString, sizeof(szString), "");
  1596.     strmid(PokerTable[tableid][pkrPass], szString, 0, strlen(szString), 64);
  1597.  
  1598.     PokerTable[tableid][pkrActive] = 0;
  1599.     PokerTable[tableid][pkrLimit] = 6;
  1600.     PokerTable[tableid][pkrBuyInMax] = 1000;
  1601.     PokerTable[tableid][pkrBuyInMin] = 500;
  1602.     PokerTable[tableid][pkrBlind] = 100;
  1603.     PokerTable[tableid][pkrPos] = 0;
  1604.     PokerTable[tableid][pkrRound] = 0;
  1605.     PokerTable[tableid][pkrStage] = 0;
  1606.     PokerTable[tableid][pkrActiveBet] = 0;
  1607.     PokerTable[tableid][pkrDelay] = 0;
  1608.     PokerTable[tableid][pkrPot] = 0;
  1609.     PokerTable[tableid][pkrSetDelay] = 15;
  1610.     PokerTable[tableid][pkrRotations] = 0;
  1611.     PokerTable[tableid][pkrSlotRotations] = 0;
  1612.     PokerTable[tableid][pkrWinnerID] = -1;
  1613.     PokerTable[tableid][pkrWinners] = 0;
  1614. }
  1615.  
  1616. CreatePokerGUI(playerid)
  1617. {
  1618.     PlayerPokerUI[playerid][0] = CreatePlayerTextDraw(playerid, 390.000000, 263.000000, " "); // Seat 2 (SEAT 1)
  1619.     PlayerTextDrawAlignment(playerid, PlayerPokerUI[playerid][0], 2);
  1620.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][0], 100);
  1621.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][0], 2);
  1622.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][0], 0.159998, 1.200001);
  1623.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][0], -1);
  1624.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][0], 0);
  1625.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][0], 1);
  1626.     PlayerTextDrawSetShadow(playerid, PlayerPokerUI[playerid][0], 0);
  1627.  
  1628.     PlayerPokerUI[playerid][1] = CreatePlayerTextDraw(playerid, 389.000000, 273.000000, " ");
  1629.     PlayerTextDrawAlignment(playerid, PlayerPokerUI[playerid][1], 2);
  1630.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][1], 255);
  1631.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][1], 2);
  1632.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][1], 0.159998, 1.200001);
  1633.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][1], 16711935);
  1634.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][1], 0);
  1635.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][1], 1);
  1636.     PlayerTextDrawSetShadow(playerid, PlayerPokerUI[playerid][1], 0);
  1637.  
  1638.     PlayerPokerUI[playerid][2] = CreatePlayerTextDraw(playerid, 369.000000, 286.000000, " ");
  1639.     PlayerTextDrawAlignment(playerid, PlayerPokerUI[playerid][2], 2);
  1640.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][2], 255);
  1641.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][2], 4);
  1642.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][2], 0.500000, 1.000000);
  1643.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][2], -1);
  1644.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][2], 0);
  1645.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][2], 1);
  1646.     PlayerTextDrawSetShadow(playerid, PlayerPokerUI[playerid][2], 1);
  1647.     PlayerTextDrawUseBox(playerid, PlayerPokerUI[playerid][2], 1);
  1648.     PlayerTextDrawBoxColor(playerid, PlayerPokerUI[playerid][2], 255);
  1649.     PlayerTextDrawTextSize(playerid, PlayerPokerUI[playerid][2], 20.000000, 33.000000);
  1650.  
  1651.     PlayerPokerUI[playerid][3] = CreatePlayerTextDraw(playerid, 392.000000, 286.000000, " ");
  1652.     PlayerTextDrawAlignment(playerid, PlayerPokerUI[playerid][3], 2);
  1653.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][3], 255);
  1654.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][3], 4);
  1655.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][3], 0.500000, 1.000000);
  1656.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][3], -1);
  1657.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][3], 0);
  1658.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][3], 1);
  1659.     PlayerTextDrawSetShadow(playerid, PlayerPokerUI[playerid][3], 1);
  1660.     PlayerTextDrawUseBox(playerid, PlayerPokerUI[playerid][3], 1);
  1661.     PlayerTextDrawBoxColor(playerid, PlayerPokerUI[playerid][3], 255);
  1662.     PlayerTextDrawTextSize(playerid, PlayerPokerUI[playerid][3], 20.000000, 33.000000);
  1663.  
  1664.     PlayerPokerUI[playerid][4] = CreatePlayerTextDraw(playerid, 391.000000, 319.000000, " ");
  1665.     PlayerTextDrawAlignment(playerid, PlayerPokerUI[playerid][4], 2);
  1666.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][4], 100);
  1667.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][4], 2);
  1668.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][4], 0.180000, 1.000000);
  1669.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][4], -1);
  1670.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][4], 0);
  1671.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][4], 1);
  1672.     PlayerTextDrawSetShadow(playerid, PlayerPokerUI[playerid][4], 0);
  1673.  
  1674.     PlayerPokerUI[playerid][5] = CreatePlayerTextDraw(playerid, 250.000000, 263.000000, " "); // Seat 1 (SEAT 2)
  1675.     PlayerTextDrawAlignment(playerid, PlayerPokerUI[playerid][5], 2);
  1676.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][5], 100);
  1677.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][5], 2);
  1678.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][5], 0.159999, 1.200001);
  1679.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][5], -1);
  1680.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][5], 0);
  1681.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][5], 1);
  1682.     PlayerTextDrawSetShadow(playerid, PlayerPokerUI[playerid][5], 0);
  1683.    
  1684.     PlayerPokerUI[playerid][6] = CreatePlayerTextDraw(playerid, 250.000000, 273.000000, " ");
  1685.     PlayerTextDrawAlignment(playerid, PlayerPokerUI[playerid][6], 2);
  1686.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][6], 255);
  1687.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][6], 2);
  1688.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][6], 0.159999, 1.200001);
  1689.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][6], 16711935);
  1690.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][6], 0);
  1691.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][6], 1);
  1692.     PlayerTextDrawSetShadow(playerid, PlayerPokerUI[playerid][6], 0);
  1693.  
  1694.     PlayerPokerUI[playerid][7] = CreatePlayerTextDraw(playerid, 229.000000, 286.000000, " ");
  1695.     PlayerTextDrawAlignment(playerid, PlayerPokerUI[playerid][7], 2);
  1696.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][7], 255);
  1697.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][7], 4);
  1698.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][7], 0.500000, 1.000000);
  1699.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][7], -1);
  1700.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][7], 0);
  1701.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][7], 1);
  1702.     PlayerTextDrawSetShadow(playerid, PlayerPokerUI[playerid][7], 1);
  1703.     PlayerTextDrawUseBox(playerid, PlayerPokerUI[playerid][7], 1);
  1704.     PlayerTextDrawBoxColor(playerid, PlayerPokerUI[playerid][7], 255);
  1705.     PlayerTextDrawTextSize(playerid, PlayerPokerUI[playerid][7], 20.000000, 33.000000);
  1706.  
  1707.     PlayerPokerUI[playerid][8] = CreatePlayerTextDraw(playerid, 252.000000, 286.000000, " ");
  1708.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][8], 255);
  1709.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][8], 4);
  1710.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][8], 0.500000, 1.000000);
  1711.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][8], -1);
  1712.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][8], 0);
  1713.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][8], 1);
  1714.     PlayerTextDrawSetShadow(playerid, PlayerPokerUI[playerid][8], 1);
  1715.     PlayerTextDrawUseBox(playerid, PlayerPokerUI[playerid][8], 1);
  1716.     PlayerTextDrawBoxColor(playerid, PlayerPokerUI[playerid][8], 255);
  1717.     PlayerTextDrawTextSize(playerid, PlayerPokerUI[playerid][8], 20.000000, 33.000000);
  1718.  
  1719.     PlayerPokerUI[playerid][9] = CreatePlayerTextDraw(playerid, 250.000000, 319.000000, " ");
  1720.     PlayerTextDrawAlignment(playerid, PlayerPokerUI[playerid][9], 2);
  1721.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][9], 100);
  1722.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][9], 2);
  1723.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][9], 0.180000, 1.000000);
  1724.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][9], -1);
  1725.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][9], 0);
  1726.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][9], 1);
  1727.     PlayerTextDrawSetShadow(playerid, PlayerPokerUI[playerid][9], 0);
  1728.    
  1729.     PlayerPokerUI[playerid][10] = CreatePlayerTextDraw(playerid, 199.000000, 190.000000, " "); // Seat 6 (SEAT 3)
  1730.     PlayerTextDrawAlignment(playerid, PlayerPokerUI[playerid][10], 2);
  1731.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][10], 100);
  1732.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][10], 2);
  1733.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][10], 0.159998, 1.200001);
  1734.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][10], -1);
  1735.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][10], 0);
  1736.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][10], 1);
  1737.     PlayerTextDrawSetShadow(playerid, PlayerPokerUI[playerid][10], 0);
  1738.    
  1739.     PlayerPokerUI[playerid][11] = CreatePlayerTextDraw(playerid, 199.000000, 199.000000, " ");
  1740.     PlayerTextDrawAlignment(playerid, PlayerPokerUI[playerid][11], 2);
  1741.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][11], 255);
  1742.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][11], 2);
  1743.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][11], 0.159998, 1.200001);
  1744.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][11], 16711935);
  1745.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][11], 0);
  1746.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][11], 1);
  1747.     PlayerTextDrawSetShadow(playerid, PlayerPokerUI[playerid][11], 0);
  1748.  
  1749.     PlayerPokerUI[playerid][12] = CreatePlayerTextDraw(playerid, 179.000000, 212.000000, " ");
  1750.     PlayerTextDrawAlignment(playerid, PlayerPokerUI[playerid][12], 2);
  1751.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][12], 255);
  1752.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][12], 4);
  1753.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][12], 0.500000, 1.000000);
  1754.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][12], -1);
  1755.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][12], 0);
  1756.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][12], 1);
  1757.     PlayerTextDrawSetShadow(playerid, PlayerPokerUI[playerid][12], 1);
  1758.     PlayerTextDrawUseBox(playerid, PlayerPokerUI[playerid][12], 1);
  1759.     PlayerTextDrawBoxColor(playerid, PlayerPokerUI[playerid][12], 255);
  1760.     PlayerTextDrawTextSize(playerid, PlayerPokerUI[playerid][12], 20.000000, 33.000000);
  1761.  
  1762.     PlayerPokerUI[playerid][13] = CreatePlayerTextDraw(playerid, 202.000000, 212.000000, " ");
  1763.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][13], 255);
  1764.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][13], 4);
  1765.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][13], 0.500000, 1.000000);
  1766.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][13], -1);
  1767.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][13], 0);
  1768.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][13], 1);
  1769.     PlayerTextDrawSetShadow(playerid, PlayerPokerUI[playerid][13], 1);
  1770.     PlayerTextDrawUseBox(playerid, PlayerPokerUI[playerid][13], 1);
  1771.     PlayerTextDrawBoxColor(playerid, PlayerPokerUI[playerid][13], 255);
  1772.     PlayerTextDrawTextSize(playerid, PlayerPokerUI[playerid][13], 20.000000, 33.000000);
  1773.  
  1774.     PlayerPokerUI[playerid][14] = CreatePlayerTextDraw(playerid, 200.000000, 245.000000, " ");
  1775.     PlayerTextDrawAlignment(playerid, PlayerPokerUI[playerid][14], 2);
  1776.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][14], 100);
  1777.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][14], 2);
  1778.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][14], 0.180000, 1.000000);
  1779.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][14], -1);
  1780.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][14], 0);
  1781.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][14], 1);
  1782.     PlayerTextDrawSetShadow(playerid, PlayerPokerUI[playerid][14], 0);
  1783.    
  1784.     PlayerPokerUI[playerid][15] = CreatePlayerTextDraw(playerid, 250.000000, 116.000000, " ");  // Seat 5 (SEAT 4)
  1785.     PlayerTextDrawAlignment(playerid, PlayerPokerUI[playerid][15], 2);
  1786.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][15], 100);
  1787.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][15], 2);
  1788.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][15], 0.159998, 1.200001);
  1789.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][15], -1);
  1790.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][15], 0);
  1791.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][15], 1);
  1792.     PlayerTextDrawSetShadow(playerid, PlayerPokerUI[playerid][15], 0);
  1793.  
  1794.     PlayerPokerUI[playerid][16] = CreatePlayerTextDraw(playerid, 250.000000, 126.000000, " ");
  1795.     PlayerTextDrawAlignment(playerid, PlayerPokerUI[playerid][16], 2);
  1796.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][16], 255);
  1797.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][16], 2);
  1798.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][16], 0.159998, 1.200001);
  1799.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][16], 16711935);
  1800.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][16], 0);
  1801.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][16], 1);
  1802.     PlayerTextDrawSetShadow(playerid, PlayerPokerUI[playerid][16], 0);
  1803.  
  1804.     PlayerPokerUI[playerid][17] = CreatePlayerTextDraw(playerid, 229.000000, 139.000000, " ");
  1805.     PlayerTextDrawAlignment(playerid, PlayerPokerUI[playerid][17], 2);
  1806.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][17], 255);
  1807.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][17], 4);
  1808.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][17], 0.500000, 1.000000);
  1809.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][17], -1);
  1810.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][17], 0);
  1811.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][17], 1);
  1812.     PlayerTextDrawSetShadow(playerid, PlayerPokerUI[playerid][17], 1);
  1813.     PlayerTextDrawUseBox(playerid, PlayerPokerUI[playerid][17], 1);
  1814.     PlayerTextDrawBoxColor(playerid, PlayerPokerUI[playerid][17], 255);
  1815.     PlayerTextDrawTextSize(playerid, PlayerPokerUI[playerid][17], 20.000000, 33.000000);
  1816.  
  1817.     PlayerPokerUI[playerid][18] = CreatePlayerTextDraw(playerid, 252.000000, 139.000000, " ");
  1818.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][18], 255);
  1819.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][18], 4);
  1820.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][18], 0.500000, 1.000000);
  1821.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][18], -1);
  1822.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][18], 0);
  1823.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][18], 1);
  1824.     PlayerTextDrawSetShadow(playerid, PlayerPokerUI[playerid][18], 1);
  1825.     PlayerTextDrawUseBox(playerid, PlayerPokerUI[playerid][18], 1);
  1826.     PlayerTextDrawBoxColor(playerid, PlayerPokerUI[playerid][18], 255);
  1827.     PlayerTextDrawTextSize(playerid, PlayerPokerUI[playerid][18], 20.000000, 33.000000);
  1828.  
  1829.     PlayerPokerUI[playerid][19] = CreatePlayerTextDraw(playerid, 250.000000, 172.000000, " ");
  1830.     PlayerTextDrawAlignment(playerid, PlayerPokerUI[playerid][19], 2);
  1831.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][19], 100);
  1832.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][19], 2);
  1833.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][19], 0.180000, 1.000000);
  1834.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][19], -1);
  1835.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][19], 0);
  1836.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][19], 1);
  1837.     PlayerTextDrawSetShadow(playerid, PlayerPokerUI[playerid][19], 0);
  1838.    
  1839.     PlayerPokerUI[playerid][20] = CreatePlayerTextDraw(playerid, 390.000000, 116.000000, " "); // Seat 4 (SEAT 5)
  1840.     PlayerTextDrawAlignment(playerid, PlayerPokerUI[playerid][20], 2);
  1841.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][20], 100);
  1842.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][20], 2);
  1843.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][20], 0.159997, 1.200001);
  1844.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][20], -1);
  1845.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][20], 0);
  1846.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][20], 1);
  1847.     PlayerTextDrawSetShadow(playerid, PlayerPokerUI[playerid][20], 0);
  1848.  
  1849.     PlayerPokerUI[playerid][21] = CreatePlayerTextDraw(playerid, 389.000000, 126.000000, " ");
  1850.     PlayerTextDrawAlignment(playerid, PlayerPokerUI[playerid][21], 2);
  1851.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][21], 255);
  1852.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][21], 2);
  1853.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][21], 0.159997, 1.200001);
  1854.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][21], 16711935);
  1855.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][21], 0);
  1856.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][21], 1);
  1857.     PlayerTextDrawSetShadow(playerid, PlayerPokerUI[playerid][21], 0);
  1858.  
  1859.     PlayerPokerUI[playerid][22] = CreatePlayerTextDraw(playerid, 369.000000, 139.000000, " ");
  1860.     PlayerTextDrawAlignment(playerid, PlayerPokerUI[playerid][22], 2);
  1861.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][22], 255);
  1862.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][22], 4);
  1863.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][22], 0.500000, 1.000000);
  1864.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][22], -1);
  1865.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][22], 0);
  1866.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][22], 1);
  1867.     PlayerTextDrawSetShadow(playerid, PlayerPokerUI[playerid][22], 1);
  1868.     PlayerTextDrawUseBox(playerid, PlayerPokerUI[playerid][22], 1);
  1869.     PlayerTextDrawBoxColor(playerid, PlayerPokerUI[playerid][22], 255);
  1870.     PlayerTextDrawTextSize(playerid, PlayerPokerUI[playerid][22], 20.000000, 33.000000);
  1871.  
  1872.     PlayerPokerUI[playerid][23] = CreatePlayerTextDraw(playerid, 392.000000, 139.000000, " ");
  1873.     PlayerTextDrawAlignment(playerid, PlayerPokerUI[playerid][23], 2);
  1874.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][23], 255);
  1875.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][23], 4);
  1876.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][23], 0.500000, 1.000000);
  1877.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][23], -1);
  1878.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][23], 0);
  1879.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][23], 1);
  1880.     PlayerTextDrawSetShadow(playerid, PlayerPokerUI[playerid][23], 1);
  1881.     PlayerTextDrawUseBox(playerid, PlayerPokerUI[playerid][23], 1);
  1882.     PlayerTextDrawBoxColor(playerid, PlayerPokerUI[playerid][23], 255);
  1883.     PlayerTextDrawTextSize(playerid, PlayerPokerUI[playerid][23], 20.000000, 33.000000);
  1884.  
  1885.     PlayerPokerUI[playerid][24] = CreatePlayerTextDraw(playerid, 391.000000, 172.000000, " ");
  1886.     PlayerTextDrawAlignment(playerid, PlayerPokerUI[playerid][24], 2);
  1887.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][24], 100);
  1888.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][24], 2);
  1889.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][24], 0.180000, 1.000000);
  1890.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][24], -1);
  1891.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][24], 0);
  1892.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][24], 1);
  1893.     PlayerTextDrawSetShadow(playerid, PlayerPokerUI[playerid][24], 0);
  1894.    
  1895.     PlayerPokerUI[playerid][25] = CreatePlayerTextDraw(playerid, 443.000000, 190.000000, " "); // Seat 3 (SEAT 6)
  1896.     PlayerTextDrawAlignment(playerid, PlayerPokerUI[playerid][25], 2);
  1897.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][25], 100);
  1898.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][25], 2);
  1899.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][25], 0.159998, 1.200001);
  1900.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][25], -1);
  1901.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][25], 0);
  1902.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][25], 1);
  1903.     PlayerTextDrawSetShadow(playerid, PlayerPokerUI[playerid][25], 0);
  1904.  
  1905.     PlayerPokerUI[playerid][26] = CreatePlayerTextDraw(playerid, 442.000000, 199.000000, " ");
  1906.     PlayerTextDrawAlignment(playerid, PlayerPokerUI[playerid][26], 2);
  1907.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][26], 255);
  1908.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][26], 2);
  1909.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][26], 0.159998, 1.200001);
  1910.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][26], 16711935);
  1911.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][26], 0);
  1912.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][26], 1);
  1913.     PlayerTextDrawSetShadow(playerid, PlayerPokerUI[playerid][26], 0);
  1914.  
  1915.     PlayerPokerUI[playerid][27] = CreatePlayerTextDraw(playerid, 422.000000, 212.000000, " ");
  1916.     PlayerTextDrawAlignment(playerid, PlayerPokerUI[playerid][27], 2);
  1917.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][27], 255);
  1918.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][27], 4);
  1919.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][27], 0.500000, 1.000000);
  1920.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][27], -1);
  1921.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][27], 0);
  1922.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][27], 1);
  1923.     PlayerTextDrawSetShadow(playerid, PlayerPokerUI[playerid][27], 1);
  1924.     PlayerTextDrawUseBox(playerid, PlayerPokerUI[playerid][27], 1);
  1925.     PlayerTextDrawBoxColor(playerid, PlayerPokerUI[playerid][27], 255);
  1926.     PlayerTextDrawTextSize(playerid, PlayerPokerUI[playerid][27], 20.000000, 33.000000);
  1927.  
  1928.     PlayerPokerUI[playerid][28] = CreatePlayerTextDraw(playerid, 445.000000, 212.000000, " ");
  1929.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][28], 255);
  1930.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][28], 4);
  1931.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][28], 0.500000, 1.000000);
  1932.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][28], -1);
  1933.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][28], 0);
  1934.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][28], 1);
  1935.     PlayerTextDrawSetShadow(playerid, PlayerPokerUI[playerid][28], 1);
  1936.     PlayerTextDrawUseBox(playerid, PlayerPokerUI[playerid][28], 1);
  1937.     PlayerTextDrawBoxColor(playerid, PlayerPokerUI[playerid][28], 255);
  1938.     PlayerTextDrawTextSize(playerid, PlayerPokerUI[playerid][28], 20.000000, 33.000000);
  1939.  
  1940.     PlayerPokerUI[playerid][29] = CreatePlayerTextDraw(playerid, 444.000000, 245.000000, " ");
  1941.     PlayerTextDrawAlignment(playerid, PlayerPokerUI[playerid][29], 2);
  1942.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][29], 100);
  1943.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][29], 2);
  1944.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][29], 0.180000, 1.000000);
  1945.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][29], -1);
  1946.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][29], 0);
  1947.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][29], 1);
  1948.     PlayerTextDrawSetShadow(playerid, PlayerPokerUI[playerid][29], 0);
  1949.    
  1950.     PlayerPokerUI[playerid][30] = CreatePlayerTextDraw(playerid, 265.000000, 205.000000, "New Textdraw"); // Community Card Box
  1951.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][30], 0);
  1952.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][30], 1);
  1953.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][30], 0.539999, 2.099998);
  1954.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][30], 0);
  1955.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][30], 1);
  1956.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][30], 1);
  1957.     PlayerTextDrawUseBox(playerid, PlayerPokerUI[playerid][30], 1);
  1958.     PlayerTextDrawBoxColor(playerid, PlayerPokerUI[playerid][30], 100);
  1959.     PlayerTextDrawTextSize(playerid, PlayerPokerUI[playerid][30], 375.000000, 71.000000);
  1960.  
  1961.     PlayerPokerUI[playerid][31] = CreatePlayerTextDraw(playerid, 266.000000, 208.000000, "LD_CARD:cdback");
  1962.     PlayerTextDrawAlignment(playerid, PlayerPokerUI[playerid][31], 2);
  1963.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][31], 255);
  1964.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][31], 4);
  1965.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][31], 0.500000, 1.000000);
  1966.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][31], -1);
  1967.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][31], 0);
  1968.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][31], 1);
  1969.     PlayerTextDrawSetShadow(playerid, PlayerPokerUI[playerid][31], 1);
  1970.     PlayerTextDrawUseBox(playerid, PlayerPokerUI[playerid][31], 1);
  1971.     PlayerTextDrawBoxColor(playerid, PlayerPokerUI[playerid][31], 255);
  1972.     PlayerTextDrawTextSize(playerid, PlayerPokerUI[playerid][31], 20.000000, 33.000000);
  1973.  
  1974.     PlayerPokerUI[playerid][32] = CreatePlayerTextDraw(playerid, 288.000000, 208.000000, "LD_CARD:cdback");
  1975.     PlayerTextDrawAlignment(playerid, PlayerPokerUI[playerid][32], 2);
  1976.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][32], 255);
  1977.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][32], 4);
  1978.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][32], 0.500000, 1.000000);
  1979.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][32], -1);
  1980.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][32], 0);
  1981.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][32], 1);
  1982.     PlayerTextDrawSetShadow(playerid, PlayerPokerUI[playerid][32], 1);
  1983.     PlayerTextDrawUseBox(playerid, PlayerPokerUI[playerid][32], 1);
  1984.     PlayerTextDrawBoxColor(playerid, PlayerPokerUI[playerid][32], 255);
  1985.     PlayerTextDrawTextSize(playerid, PlayerPokerUI[playerid][32], 20.000000, 33.000000);
  1986.  
  1987.     PlayerPokerUI[playerid][33] = CreatePlayerTextDraw(playerid, 310.000000, 208.000000, "LD_CARD:cdback");
  1988.     PlayerTextDrawAlignment(playerid, PlayerPokerUI[playerid][33], 2);
  1989.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][33], 255);
  1990.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][33], 4);
  1991.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][33], 0.500000, 1.000000);
  1992.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][33], -1);
  1993.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][33], 0);
  1994.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][33], 1);
  1995.     PlayerTextDrawSetShadow(playerid, PlayerPokerUI[playerid][33], 1);
  1996.     PlayerTextDrawUseBox(playerid, PlayerPokerUI[playerid][33], 1);
  1997.     PlayerTextDrawBoxColor(playerid, PlayerPokerUI[playerid][33], 255);
  1998.     PlayerTextDrawTextSize(playerid, PlayerPokerUI[playerid][33], 20.000000, 33.000000);
  1999.  
  2000.     PlayerPokerUI[playerid][34] = CreatePlayerTextDraw(playerid, 332.000000, 208.000000, "LD_CARD:cdback");
  2001.     PlayerTextDrawAlignment(playerid, PlayerPokerUI[playerid][34], 2);
  2002.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][34], 255);
  2003.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][34], 4);
  2004.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][34], 0.500000, 1.000000);
  2005.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][34], -1);
  2006.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][34], 0);
  2007.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][34], 1);
  2008.     PlayerTextDrawSetShadow(playerid, PlayerPokerUI[playerid][34], 1);
  2009.     PlayerTextDrawUseBox(playerid, PlayerPokerUI[playerid][34], 1);
  2010.     PlayerTextDrawBoxColor(playerid, PlayerPokerUI[playerid][34], 255);
  2011.     PlayerTextDrawTextSize(playerid, PlayerPokerUI[playerid][34], 20.000000, 33.000000);
  2012.  
  2013.     PlayerPokerUI[playerid][35] = CreatePlayerTextDraw(playerid, 354.000000, 208.000000, "LD_CARD:cdback");
  2014.     PlayerTextDrawAlignment(playerid, PlayerPokerUI[playerid][35], 2);
  2015.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][35], 255);
  2016.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][35], 4);
  2017.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][35], 0.500000, 1.000000);
  2018.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][35], -1);
  2019.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][35], 0);
  2020.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][35], 1);
  2021.     PlayerTextDrawSetShadow(playerid, PlayerPokerUI[playerid][35], 1);
  2022.     PlayerTextDrawUseBox(playerid, PlayerPokerUI[playerid][35], 1);
  2023.     PlayerTextDrawBoxColor(playerid, PlayerPokerUI[playerid][35], 255);
  2024.     PlayerTextDrawTextSize(playerid, PlayerPokerUI[playerid][35], 20.000000, 33.000000);
  2025.    
  2026.     PlayerPokerUI[playerid][36] = CreatePlayerTextDraw(playerid, 320.000000, 193.000000, "New Textdraw");
  2027.     PlayerTextDrawAlignment(playerid, PlayerPokerUI[playerid][36], 2);
  2028.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][36], 0);
  2029.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][36], 1);
  2030.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][36], 0.500000, 0.399999);
  2031.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][36], 0);
  2032.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][36], 0);
  2033.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][36], 1);
  2034.     PlayerTextDrawSetShadow(playerid, PlayerPokerUI[playerid][36], 1);
  2035.     PlayerTextDrawUseBox(playerid, PlayerPokerUI[playerid][36], 1);
  2036.     PlayerTextDrawBoxColor(playerid, PlayerPokerUI[playerid][36], 50);
  2037.     PlayerTextDrawTextSize(playerid, PlayerPokerUI[playerid][36], 390.000000, 110.000000);
  2038.  
  2039.     PlayerPokerUI[playerid][37] = CreatePlayerTextDraw(playerid, 318.000000, 191.000000, "Texas Holdem Poker");
  2040.     PlayerTextDrawAlignment(playerid, PlayerPokerUI[playerid][37], 2);
  2041.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][37], -1);
  2042.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][37], 2);
  2043.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][37], 0.199999, 1.200000);
  2044.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][37], -1);
  2045.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][37], 0);
  2046.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][37], 1);
  2047.     PlayerTextDrawSetShadow(playerid, PlayerPokerUI[playerid][37], 0);
  2048.    
  2049.     PlayerPokerUI[playerid][38] = CreatePlayerTextDraw(playerid, 321.000000, 268.000000, " ");
  2050.     PlayerTextDrawAlignment(playerid, PlayerPokerUI[playerid][38], 2);
  2051.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][38], 255);
  2052.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][38], 2);
  2053.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][38], 0.189999, 1.200000);
  2054.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][38], -1);
  2055.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][38], 1);
  2056.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][38], 1);
  2057.     PlayerTextDrawUseBox(playerid, PlayerPokerUI[playerid][38], 1);
  2058.     PlayerTextDrawBoxColor(playerid, PlayerPokerUI[playerid][38], 45);
  2059.     PlayerTextDrawTextSize(playerid, PlayerPokerUI[playerid][38], 10.000000, 26.000000);
  2060.     PlayerTextDrawSetSelectable(playerid, PlayerPokerUI[playerid][38], 1);
  2061.  
  2062.     PlayerPokerUI[playerid][39] = CreatePlayerTextDraw(playerid, 321.000000, 284.000000, " ");
  2063.     PlayerTextDrawAlignment(playerid, PlayerPokerUI[playerid][39], 2);
  2064.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][39], 255);
  2065.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][39], 2);
  2066.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][39], 0.189999, 1.200000);
  2067.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][39], -1);
  2068.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][39], 1);
  2069.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][39], 1);
  2070.     PlayerTextDrawUseBox(playerid, PlayerPokerUI[playerid][39], 1);
  2071.     PlayerTextDrawBoxColor(playerid, PlayerPokerUI[playerid][39], 45);
  2072.     PlayerTextDrawTextSize(playerid, PlayerPokerUI[playerid][39], 10.000000, 26.000000);
  2073.     PlayerTextDrawSetSelectable(playerid, PlayerPokerUI[playerid][39], 1);
  2074.  
  2075.     PlayerPokerUI[playerid][40] = CreatePlayerTextDraw(playerid, 321.000000, 300.000000, " ");
  2076.     PlayerTextDrawAlignment(playerid, PlayerPokerUI[playerid][40], 2);
  2077.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][40], 255);
  2078.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][40], 2);
  2079.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][40], 0.189999, 1.200000);
  2080.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][40], -1);
  2081.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][40], 1);
  2082.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][40], 1);
  2083.     PlayerTextDrawUseBox(playerid, PlayerPokerUI[playerid][40], 1);
  2084.     PlayerTextDrawBoxColor(playerid, PlayerPokerUI[playerid][40], 45);
  2085.     PlayerTextDrawTextSize(playerid, PlayerPokerUI[playerid][40], 10.000000, 26.000000);
  2086.     PlayerTextDrawSetSelectable(playerid, PlayerPokerUI[playerid][40], 1);
  2087.  
  2088.     PlayerPokerUI[playerid][41] = CreatePlayerTextDraw(playerid, 318.000000, 120.000000, "LEAVE");
  2089.     PlayerTextDrawAlignment(playerid, PlayerPokerUI[playerid][41], 2);
  2090.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][41], 255);
  2091.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][41], 2);
  2092.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][41], 0.189999, 1.200000);
  2093.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][41], -1);
  2094.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][41], 1);
  2095.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][41], 1);
  2096.     PlayerTextDrawUseBox(playerid, PlayerPokerUI[playerid][41], 1);
  2097.     PlayerTextDrawBoxColor(playerid, PlayerPokerUI[playerid][41], 45);
  2098.     PlayerTextDrawTextSize(playerid, PlayerPokerUI[playerid][41], 10.000000, 36.000000);
  2099.     PlayerTextDrawSetSelectable(playerid, PlayerPokerUI[playerid][41], 1);
  2100.  
  2101.     PlayerPokerUI[playerid][42] = CreatePlayerTextDraw(playerid, 590.000000, 400.000000, "Casino~n~Games");
  2102.     PlayerTextDrawAlignment(playerid, PlayerPokerUI[playerid][42], 2);
  2103.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][42], 255);
  2104.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][42], 2);
  2105.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][42], 0.500000, 2.000000);
  2106.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][42], -1);
  2107.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][42], 1);
  2108.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][42], 1);
  2109.  
  2110.     PlayerPokerUI[playerid][43] = CreatePlayerTextDraw(playerid, 589.000000, 396.000000, "GhoulSlayeR's");
  2111.     PlayerTextDrawAlignment(playerid, PlayerPokerUI[playerid][43], 2);
  2112.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][43], 255);
  2113.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][43], 2);
  2114.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][43], 0.180000, 0.800000);
  2115.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][43], 200);
  2116.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][43], 0);
  2117.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][43], 1);
  2118.     PlayerTextDrawSetShadow(playerid, PlayerPokerUI[playerid][43], 0);
  2119.  
  2120.     PlayerPokerUI[playerid][44] = CreatePlayerTextDraw(playerid, 588.000000, 437.000000, "v1.0 Beta Version");
  2121.     PlayerTextDrawAlignment(playerid, PlayerPokerUI[playerid][44], 2);
  2122.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][44], 255);
  2123.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][44], 2);
  2124.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][44], 0.180000, 0.800000);
  2125.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][44], 200);
  2126.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][44], 0);
  2127.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][44], 1);
  2128.     PlayerTextDrawSetShadow(playerid, PlayerPokerUI[playerid][44], 0);
  2129.    
  2130.     PlayerPokerUI[playerid][45] = CreatePlayerTextDraw(playerid, 5.000000, 100.000000, "Debug:");
  2131.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][45], 0);
  2132.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][45], 2);
  2133.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][45], 0.159999, 1.099999);
  2134.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][45], 200);
  2135.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][45], 0);
  2136.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][45], 1);
  2137.     PlayerTextDrawSetShadow(playerid, PlayerPokerUI[playerid][45], 1);
  2138.    
  2139.     PlayerPokerUI[playerid][46] = CreatePlayerTextDraw(playerid, 318.000000, 245.000000, "Texas Holdem Poker");
  2140.     PlayerTextDrawAlignment(playerid, PlayerPokerUI[playerid][46], 2);
  2141.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][46], -1);
  2142.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][46], 2);
  2143.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][46], 0.199999, 1.200000);
  2144.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][46], -1);
  2145.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][46], 0);
  2146.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][46], 1);
  2147.     PlayerTextDrawSetShadow(playerid, PlayerPokerUI[playerid][46], 0);
  2148.    
  2149.     PlayerPokerUI[playerid][47] = CreatePlayerTextDraw(playerid, 320.000000, 248.000000, "New Textdraw");
  2150.     PlayerTextDrawAlignment(playerid, PlayerPokerUI[playerid][47], 2);
  2151.     PlayerTextDrawBackgroundColor(playerid, PlayerPokerUI[playerid][47], 0);
  2152.     PlayerTextDrawFont(playerid, PlayerPokerUI[playerid][47], 1);
  2153.     PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][47], 0.500000, 0.399998);
  2154.     PlayerTextDrawColor(playerid, PlayerPokerUI[playerid][47], 0);
  2155.     PlayerTextDrawSetOutline(playerid, PlayerPokerUI[playerid][47], 0);
  2156.     PlayerTextDrawSetProportional(playerid, PlayerPokerUI[playerid][47], 1);
  2157.     PlayerTextDrawSetShadow(playerid, PlayerPokerUI[playerid][47], 1);
  2158.     PlayerTextDrawUseBox(playerid, PlayerPokerUI[playerid][47], 1);
  2159.     PlayerTextDrawBoxColor(playerid, PlayerPokerUI[playerid][47], 50);
  2160.     PlayerTextDrawTextSize(playerid, PlayerPokerUI[playerid][47], 390.000000, 110.000000);
  2161. }
  2162.  
  2163. ShowPokerGUI(playerid, guitype)
  2164. {
  2165.     switch(guitype)
  2166.     {
  2167.         case GUI_POKER_TABLE:
  2168.         {
  2169.             SetPVarInt(playerid, "pkrTableGUI", 1);
  2170.             for(new i = 0; i < MAX_PLAYERPOKERUI; i++) {
  2171.                 PlayerTextDrawShow(playerid, PlayerPokerUI[playerid][i]);
  2172.             }
  2173.         }
  2174.     }
  2175. }
  2176.  
  2177. DestroyPokerGUI(playerid)
  2178. {
  2179.     for(new i = 0; i < MAX_PLAYERPOKERUI; i++) {
  2180.         PlayerTextDrawDestroy(playerid, PlayerPokerUI[playerid][i]);
  2181.     }
  2182. }
  2183.  
  2184. PlacePokerTable(tableid, skipmisc, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, virtualworld, interior)
  2185. {
  2186.     PokerTable[tableid][pkrPlaced] = 1;
  2187.     PokerTable[tableid][pkrX] = x;
  2188.     PokerTable[tableid][pkrY] = y;
  2189.     PokerTable[tableid][pkrZ] = z;
  2190.     PokerTable[tableid][pkrRX] = rx;
  2191.     PokerTable[tableid][pkrRY] = ry;
  2192.     PokerTable[tableid][pkrRZ] = rz;
  2193.     PokerTable[tableid][pkrVW] = virtualworld;
  2194.     PokerTable[tableid][pkrInt] = interior;
  2195.    
  2196.     // Create Table
  2197.     PokerTable[tableid][pkrObjectID] = CreateObject(OBJ_POKER_TABLE, x, y, z, rx, ry, rz, DRAWDISTANCE_POKER_TABLE);
  2198.    
  2199.     if(skipmisc != 0) {
  2200.     }
  2201.    
  2202.     // Create 3D Text Label
  2203.     new szString[64];
  2204.     format(szString, sizeof(szString), "Poker Table %d", tableid);
  2205.     PokerTable[tableid][pkrText3DID] = Create3DTextLabel(szString, COLOR_GOLD, x, y, z+1.3, DRAWDISTANCE_POKER_MISC, virtualworld, 0);
  2206.    
  2207.     SavePokerTables();
  2208.    
  2209.     return tableid;
  2210. }
  2211.  
  2212. DestroyPokerTable(tableid)
  2213. {
  2214.     PokerTable[tableid][pkrX] = 0.0;
  2215.     PokerTable[tableid][pkrY] = 0.0;
  2216.     PokerTable[tableid][pkrZ] = 0.0;
  2217.     PokerTable[tableid][pkrRX] = 0.0;
  2218.     PokerTable[tableid][pkrRY] = 0.0;
  2219.     PokerTable[tableid][pkrRZ] = 0.0;
  2220.     PokerTable[tableid][pkrVW] = 0;
  2221.     PokerTable[tableid][pkrInt] = 0;
  2222.    
  2223.     if(PokerTable[tableid][pkrPlaced] == 1) {
  2224.    
  2225.         // Delete Table
  2226.         if(IsValidObject(PokerTable[tableid][pkrObjectID])) DestroyObject(PokerTable[tableid][pkrObjectID]);
  2227.        
  2228.         // Delete 3D Text Label
  2229.         Delete3DTextLabel(PokerTable[tableid][pkrText3DID]);
  2230.        
  2231.         // Delete Misc Obj
  2232.         for(new c = 0; c < MAX_POKERTABLEMISCOBJS; c++) {
  2233.             if(IsValidObject(PokerTable[tableid][pkrMiscObjectID][c])) DestroyObject(PokerTable[tableid][pkrMiscObjectID][c]);
  2234.         }
  2235.     }
  2236.    
  2237.     PokerTable[tableid][pkrPlayers] = 0;
  2238.     PokerTable[tableid][pkrLimit] = 6;
  2239.     PokerTable[tableid][pkrPlaced] = 0;
  2240.    
  2241.     SavePokerTables();
  2242.    
  2243.     return tableid;
  2244. }
  2245.  
  2246. JoinPokerTable(playerid, tableid)
  2247. {
  2248.     // Check if there is room for the player
  2249.     if(PokerTable[tableid][pkrPlayers] < PokerTable[tableid][pkrLimit])
  2250.     {
  2251.         // Check if table is not joinable.
  2252.         if(PokerTable[tableid][pkrActive] == 1) {
  2253.             SendClientMessage(playerid, COLOR_WHITE, "Someone is setting up this table, try again later.");
  2254.             return 1;
  2255.         }
  2256.        
  2257.         // Find an open seat
  2258.         for(new s; s < 6; s++) {
  2259.             if(PokerTable[tableid][pkrSlot][s] == -1) {
  2260.            
  2261.                 SetPVarInt(playerid, "pkrTableID", tableid+1);
  2262.                 SetPVarInt(playerid, "pkrSlot", s);
  2263.                
  2264.                 // Occuply Slot
  2265.                 PokerTable[tableid][pkrPlayers] += 1;
  2266.                 PokerTable[tableid][pkrSlot][s] = playerid;
  2267.                
  2268.                 // Check & Start Game Loop if Not Active
  2269.                 if(PokerTable[tableid][pkrPlayers] == 1) {
  2270.                    
  2271.                     // Player is Room Creator
  2272.                     SetPVarInt(playerid, "pkrRoomLeader", 1);
  2273.                     ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME);
  2274.                    
  2275.                     PokerTable[tableid][pkrActive] = 1; // Warmup Phase
  2276.                     PokerTable[tableid][pkrPulseTimer] = SetTimerEx("PokerPulse", 1000, true, "i", tableid);
  2277.            
  2278.                     //PokerPulse(tableid);
  2279.                 } else { // Execute code for Non-Room Creators
  2280.                     ShowCasinoGamesMenu(playerid, DIALOG_CGAMESBUYINPOKER);
  2281.                     SelectTextDraw(playerid, COLOR_GOLD);
  2282.                 }  
  2283.                
  2284.                 CameraRadiusSetPos(playerid, PokerTable[tableid][pkrX], PokerTable[tableid][pkrY], PokerTable[tableid][pkrZ], 90.0, 4.7, 0.1);
  2285.                
  2286.                 new Float:tmpPos[3];
  2287.                 GetPlayerPos(playerid, tmpPos[0], tmpPos[1], tmpPos[2]);
  2288.                
  2289.                 SetPVarFloat(playerid, "pkrTableJoinX", tmpPos[0]);
  2290.                 SetPVarFloat(playerid, "pkrTableJoinY", tmpPos[1]);
  2291.                 SetPVarFloat(playerid, "pkrTableJoinZ", tmpPos[2]);
  2292.                
  2293.                 ApplyAnimation(playerid, "CASINO", "cards_out", 4.1, 0, 1, 1, 1, 1, 1);
  2294.                 TogglePlayerControllable(playerid, 0);
  2295.                 SetPlayerPosObjectOffset(PokerTable[tableid][pkrObjectID], playerid, PokerTableMiscObjOffsets[s][0], PokerTableMiscObjOffsets[s][1], PokerTableMiscObjOffsets[s][2]);
  2296.                 SetPlayerFacingAngle(playerid, PokerTableMiscObjOffsets[s][5]+90.0);
  2297.                 ApplyAnimation(playerid, "CASINO", "cards_out", 4.1, 0, 1, 1, 1, 1, 1);
  2298.                
  2299.                 // Create GUI
  2300.                 CreatePokerGUI(playerid);
  2301.                 ShowPokerGUI(playerid, GUI_POKER_TABLE);
  2302.                
  2303.                 // Hide Action Bar
  2304.                 PokerOptions(playerid, 0);
  2305.                
  2306.                 return 1;
  2307.             }
  2308.         }
  2309.     }
  2310.     return 1;
  2311. }
  2312.  
  2313. LeavePokerTable(playerid)
  2314. {
  2315.     new tableid = GetPVarInt(playerid, "pkrTableID")-1;
  2316.    
  2317.     // SFX
  2318.     new leaveSoundID[2] = {5852, 5853};
  2319.     new randomLeaveSoundID = random(sizeof(leaveSoundID));
  2320.     PlayerPlaySound(playerid, leaveSoundID[randomLeaveSoundID], 0.0, 0.0, 0.0);
  2321.    
  2322.     // Convert prkChips to cgChips
  2323.     SetPVarInt(playerid, "cgChips", GetPVarInt(playerid, "cgChips")+GetPVarInt(playerid, "pkrChips"));
  2324.    
  2325.     // De-occuply Slot
  2326.     PokerTable[tableid][pkrPlayers] -= 1;
  2327.     if(GetPVarInt(playerid, "pkrStatus")) PokerTable[tableid][pkrActivePlayers] -= 1;
  2328.     PokerTable[tableid][pkrSlot][GetPVarInt(playerid, "pkrSlot")] = -1;
  2329.    
  2330.     // Check & Stop the Game Loop if No Players at the Table
  2331.     if(PokerTable[tableid][pkrPlayers] == 0) {
  2332.         KillTimer(PokerTable[tableid][pkrPulseTimer]);
  2333.        
  2334.         new tmpString[64];
  2335.         format(tmpString, sizeof(tmpString), "Poker Table %d", tableid);
  2336.         Update3DTextLabelText(PokerTable[tableid][pkrText3DID], COLOR_GOLD, tmpString);
  2337.        
  2338.         ResetPokerTable(tableid);
  2339.     }
  2340.    
  2341.     if(PokerTable[tableid][pkrRound] == 0 && PokerTable[tableid][pkrDelay] < 5) {
  2342.         ResetPokerRound(tableid);
  2343.     }
  2344.    
  2345.     SetPlayerPos(playerid, GetPVarFloat(playerid, "pkrTableJoinX"), GetPVarFloat(playerid, "pkrTableJoinY"), GetPVarFloat(playerid, "pkrTableJoinZ")+0.1);
  2346.     SetCameraBehindPlayer(playerid);
  2347.     TogglePlayerControllable(playerid, 1);
  2348.     ApplyAnimation(playerid, "CARRY", "crry_prtial", 2.0, 0, 0, 0, 0, 0);
  2349.     CancelSelectTextDraw(playerid);
  2350.    
  2351.     if(GetPVarInt(playerid, "pkrActiveHand")) {
  2352.         PokerTable[tableid][pkrActiveHands]--;
  2353.     }
  2354.    
  2355.     // Destroy Poker Memory
  2356.     DeletePVar(playerid, "pkrWinner");
  2357.     DeletePVar(playerid, "pkrCurrentBet");
  2358.     DeletePVar(playerid, "pkrChips");
  2359.     DeletePVar(playerid, "pkrTableJoinX");
  2360.     DeletePVar(playerid, "pkrTableJoinY");
  2361.     DeletePVar(playerid, "pkrTableJoinZ");
  2362.     DeletePVar(playerid, "pkrTableID");
  2363.     DeletePVar(playerid, "pkrSlot");
  2364.     DeletePVar(playerid, "pkrStatus");
  2365.     DeletePVar(playerid, "pkrRoomLeader");
  2366.     DeletePVar(playerid, "pkrRoomBigBlind");
  2367.     DeletePVar(playerid, "pkrRoomSmallBlind");
  2368.     DeletePVar(playerid, "pkrRoomDealer");
  2369.     DeletePVar(playerid, "pkrCard1");
  2370.     DeletePVar(playerid, "pkrCard2");
  2371.     DeletePVar(playerid, "pkrActivePlayer");
  2372.     DeletePVar(playerid, "pkrActiveHand");
  2373.     DeletePVar(playerid, "pkrHide");
  2374.    
  2375.     // Destroy GUI
  2376.     DestroyPokerGUI(playerid);
  2377.    
  2378.     // Delay Exit Call
  2379.     SetTimerEx("PokerExit", 250, false, "d", playerid);
  2380.    
  2381.     return 1;
  2382. }
  2383.  
  2384. ShowCasinoGamesMenu(playerid, dialogid)
  2385. {
  2386.     switch(dialogid)
  2387.     {
  2388.         case DIALOG_CGAMESCALLPOKER:
  2389.         {
  2390.             if(GetPVarInt(playerid, "pkrChips") > 0) {
  2391.                 SetPVarInt(playerid, "pkrActionChoice", 1);
  2392.            
  2393.                 new tableid = GetPVarInt(playerid, "pkrTableID")-1;
  2394.                 new actualBet = PokerTable[tableid][pkrActiveBet]-GetPVarInt(playerid, "pkrCurrentBet");
  2395.            
  2396.                 new szString[128];
  2397.                 if(actualBet > GetPVarInt(playerid, "pkrChips")) {
  2398.                     format(szString, sizeof(szString), "{FFFFFF}Are you sure you want to call $%d (All-In)?:", actualBet);
  2399.                     return ShowPlayerDialog(playerid, DIALOG_CGAMESCALLPOKER, DIALOG_STYLE_MSGBOX, "{FFFFFF}Texas Holdem Poker - (Call)", szString, "All-In", "Cancel");
  2400.                 }
  2401.                 format(szString, sizeof(szString), "{FFFFFF}Are you sure you want to call $%d?:", actualBet);
  2402.                 return ShowPlayerDialog(playerid, DIALOG_CGAMESCALLPOKER, DIALOG_STYLE_MSGBOX, "{FFFFFF}Texas Holdem Poker - (Call)", szString, "Call", "Cancel");
  2403.             } else {
  2404.                 SendClientMessage(playerid, COLOR_WHITE, "DEALER: You do not have enough funds to call.");
  2405.                 new noFundsSoundID[] = {5823, 5824, 5825};
  2406.                 new randomNoFundsSoundID = random(sizeof(noFundsSoundID));
  2407.                 PlayerPlaySound(playerid, noFundsSoundID[randomNoFundsSoundID], 0.0, 0.0, 0.0);
  2408.             }
  2409.         }
  2410.         case DIALOG_CGAMESRAISEPOKER:
  2411.         {
  2412.             new tableid = GetPVarInt(playerid, "pkrTableID")-1;
  2413.            
  2414.             SetPVarInt(playerid, "pkrActionChoice", 1);
  2415.        
  2416.             if(GetPVarInt(playerid, "pkrCurrentBet")+GetPVarInt(playerid, "pkrChips") > PokerTable[tableid][pkrActiveBet]+PokerTable[tableid][pkrBlind]/2) {
  2417.                 SetPVarInt(playerid, "pkrActionChoice", 1);
  2418.            
  2419.                 new szString[128]
  2420.                 format(szString, sizeof(szString), "{FFFFFF}How much do you want to Raise? ($%d-$%d):", PokerTable[tableid][pkrActiveBet]+PokerTable[tableid][pkrBlind]/2, GetPVarInt(playerid, "pkrCurrentBet")+GetPVarInt(playerid, "pkrChips"));
  2421.                 return ShowPlayerDialog(playerid, DIALOG_CGAMESRAISEPOKER, DIALOG_STYLE_INPUT, "{FFFFFF}Texas Holdem Poker - (Raise)", szString, "Raise", "Cancel");
  2422.             } else if(GetPVarInt(playerid, "pkrCurrentBet")+GetPVarInt(playerid, "pkrChips") == PokerTable[tableid][pkrActiveBet]+PokerTable[tableid][pkrBlind]/2) {
  2423.                 SetPVarInt(playerid, "pkrActionChoice", 1);
  2424.            
  2425.                 new szString[128]
  2426.                 format(szString, sizeof(szString), "{FFFFFF}How much do you want to Raise? (All-In):", PokerTable[tableid][pkrActiveBet]+PokerTable[tableid][pkrBlind]/2, GetPVarInt(playerid, "pkrCurrentBet")+GetPVarInt(playerid, "pkrChips"));
  2427.                 return ShowPlayerDialog(playerid, DIALOG_CGAMESRAISEPOKER, DIALOG_STYLE_INPUT, "{FFFFFF}Texas Holdem Poker - (Raise)", szString, "All-In", "Cancel");
  2428.             } else {
  2429.                 SendClientMessage(playerid, COLOR_WHITE, "DEALER: You do not have enough funds to raise.");
  2430.                 new noFundsSoundID[] = {5823, 5824, 5825};
  2431.                 new randomNoFundsSoundID = random(sizeof(noFundsSoundID));
  2432.                 PlayerPlaySound(playerid, noFundsSoundID[randomNoFundsSoundID], 0.0, 0.0, 0.0);
  2433.             }
  2434.            
  2435.         }
  2436.         case DIALOG_CGAMESBUYINPOKER:
  2437.         {
  2438.             new szString[386];
  2439.             format(szString, sizeof(szString), "{FFFFFF}Please input a buy-in amount for the table:\n\nCurrent Casino Chips: {00FF00}$%d{FFFFFF}\nCurrent Poker Chips: {00FF00}$%d{FFFFFF}\nBuy-In Maximum/Minimum: {00FF00}$%d{FFFFFF}/{00FF00}$%d{FFFFFF}", GetPVarInt(playerid, "cgChips"), GetPVarInt(playerid, "pkrChips"), PokerTable[GetPVarInt(playerid, "pkrTableID")-1][pkrBuyInMax], PokerTable[GetPVarInt(playerid, "pkrTableID")-1][pkrBuyInMin]);
  2440.             return ShowPlayerDialog(playerid, DIALOG_CGAMESBUYINPOKER, DIALOG_STYLE_INPUT, "{FFFFFF}Casino Games - (BuyIn Menu)", szString, "Buy In", "Leave");
  2441.         }
  2442.         case DIALOG_CGAMESADMINMENU:
  2443.         {
  2444.             return ShowPlayerDialog(playerid, DIALOG_CGAMESADMINMENU, DIALOG_STYLE_LIST, "{FFFFFF}Casino Games - (Admin Menu)", "{FFFFFF}Setup Poker Minigame...\nLine2\nCredits", "Select", "Close");
  2445.         }
  2446.         case DIALOG_CGAMESSELECTPOKER:
  2447.         {
  2448.             new szString[4096];
  2449.             new szPlaced[64];
  2450.            
  2451.             for(new i = 0; i < MAX_POKERTABLES; i++) {
  2452.                 if(PokerTable[i][pkrPlaced] == 1) { format(szPlaced, sizeof(szPlaced), "{00FF00}Active{FFFFFF}"); }
  2453.                 if(PokerTable[i][pkrPlaced] == 0) { format(szPlaced, sizeof(szPlaced), "{FF0000}Deactived{FFFFFF}"); }
  2454.                 format(szString, sizeof(szString), "%sPoker Table %d (%s)\n", szString, i, szPlaced, PokerTable[i][pkrPlayers]);
  2455.             }
  2456.             return ShowPlayerDialog(playerid, DIALOG_CGAMESSELECTPOKER, DIALOG_STYLE_LIST, "Casino Games - (Select Poker Table)", szString, "Select", "Back");
  2457.         }
  2458.         case DIALOG_CGAMESSETUPPOKER:
  2459.         {  
  2460.             new tableid = GetPVarInt(playerid, "tmpEditPokerTableID")-1;
  2461.        
  2462.             if(PokerTable[tableid][pkrPlaced] == 0) {
  2463.                 return ShowPlayerDialog(playerid, DIALOG_CGAMESSETUPPOKER, DIALOG_STYLE_LIST, "{FFFFFF}Casino Games - (Setup Poker Minigame)", "{FFFFFF}Place Table...", "Select", "Back");
  2464.             } else {
  2465.                 return ShowPlayerDialog(playerid, DIALOG_CGAMESSETUPPOKER, DIALOG_STYLE_LIST, "{FFFFFF}Casino Games - (Setup Poker Minigame)", "{FFFFFF}Edit Table...\nDelete Table...", "Select", "Back");
  2466.             }
  2467.         }
  2468.         case DIALOG_CGAMESCREDITS:
  2469.         {
  2470.             return ShowPlayerDialog(playerid, DIALOG_CGAMESCREDITS, DIALOG_STYLE_MSGBOX, "{FFFFFF}Casino Games - (Credits)", "{FFFFFF}Developed By: Dan 'GhoulSlayeR' Reed", "Back", "");
  2471.         }
  2472.         case DIALOG_CGAMESSETUPPGAME:
  2473.         {
  2474.             new tableid = GetPVarInt(playerid, "pkrTableID")-1;
  2475.        
  2476.             if(GetPVarType(playerid, "pkrTableID")) {
  2477.                 new szString[512];
  2478.                
  2479.                 if(PokerTable[tableid][pkrPass][0] == EOS) {
  2480.                     format(szString, sizeof(szString), "{FFFFFF}Buy-In Max\t({00FF00}$%d{FFFFFF})\nBuy-In Min\t({00FF00}$%d{FFFFFF})\nBlind\t\t({00FF00}$%d{FFFFFF} / {00FF00}$%d{FFFFFF})\nLimit\t\t(%d)\nPassword\t(%s)\nRound Delay\t(%d)\nStart Game",
  2481.                         PokerTable[tableid][pkrBuyInMax],
  2482.                         PokerTable[tableid][pkrBuyInMin],
  2483.                         PokerTable[tableid][pkrBlind],
  2484.                         PokerTable[tableid][pkrBlind]/2,
  2485.                         PokerTable[tableid][pkrLimit],
  2486.                         "None",
  2487.                         PokerTable[tableid][pkrSetDelay]
  2488.                     );
  2489.                 } else {
  2490.                     format(szString, sizeof(szString), "{FFFFFF}Buy-In Max\t({00FF00}$%d{FFFFFF})\nBuy-In Min\t({00FF00}$%d{FFFFFF})\nBlind\t\t({00FF00}$%d{FFFFFF} / {00FF00}$%d{FFFFFF})\nLimit\t\t(%d)\nPassword\t(%s)\nRound Delay\t(%d)\nStart Game",
  2491.                         PokerTable[tableid][pkrBuyInMax],
  2492.                         PokerTable[tableid][pkrBuyInMin],
  2493.                         PokerTable[tableid][pkrBlind],
  2494.                         PokerTable[tableid][pkrBlind]/2,
  2495.                         PokerTable[tableid][pkrLimit],
  2496.                         PokerTable[tableid][pkrPass],
  2497.                         PokerTable[tableid][pkrSetDelay]
  2498.                     );
  2499.                 }
  2500.                 return ShowPlayerDialog(playerid, DIALOG_CGAMESSETUPPGAME, DIALOG_STYLE_LIST, "{FFFFFF}Casino Games - (Setup Poker Room)", szString, "Select", "Quit");
  2501.             }
  2502.         }
  2503.         case DIALOG_CGAMESSETUPPGAME2:
  2504.         {
  2505.             if(GetPVarType(playerid, "pkrTableID")) {
  2506.                 return ShowPlayerDialog(playerid, DIALOG_CGAMESSETUPPGAME2, DIALOG_STYLE_INPUT, "{FFFFFF}Casino Games - (Buy-In Max)", "{FFFFFF}Please input a Buy-In Max:", "Change", "Back");
  2507.             }
  2508.         }
  2509.         case DIALOG_CGAMESSETUPPGAME3:
  2510.         {
  2511.             if(GetPVarType(playerid, "pkrTableID")) {
  2512.                 return ShowPlayerDialog(playerid, DIALOG_CGAMESSETUPPGAME3, DIALOG_STYLE_INPUT, "{FFFFFF}Casino Games - (Buy-In Min)", "{FFFFFF}Please input a Buy-In Min:", "Change", "Back");
  2513.             }
  2514.         }
  2515.         case DIALOG_CGAMESSETUPPGAME4:
  2516.         {
  2517.             if(GetPVarType(playerid, "pkrTableID")) {
  2518.                 return ShowPlayerDialog(playerid, DIALOG_CGAMESSETUPPGAME4, DIALOG_STYLE_INPUT, "{FFFFFF}Casino Games - (Blinds)", "{FFFFFF}Please input Blinds:\n\nNote: Small blinds are automatically half of a big blind.", "Change", "Back");
  2519.             }
  2520.         }
  2521.         case DIALOG_CGAMESSETUPPGAME5:
  2522.         {
  2523.             if(GetPVarType(playerid, "pkrTableID")) {
  2524.                 return ShowPlayerDialog(playerid, DIALOG_CGAMESSETUPPGAME5, DIALOG_STYLE_INPUT, "{FFFFFF}Casino Games - (Limit)", "{FFFFFF}Please input a Player Limit (2-6):", "Change", "Back");
  2525.             }
  2526.         }
  2527.         case DIALOG_CGAMESSETUPPGAME6:
  2528.         {
  2529.             if(GetPVarType(playerid, "pkrTableID")) {
  2530.                 return ShowPlayerDialog(playerid, DIALOG_CGAMESSETUPPGAME6, DIALOG_STYLE_INPUT, "{FFFFFF}Casino Games - (Password)", "{FFFFFF}Please input a Password:\n\nNote: Leave blank to have a public room", "Change", "Back");
  2531.             }
  2532.         }
  2533.         case DIALOG_CGAMESSETUPPGAME7:
  2534.         {
  2535.             if(GetPVarType(playerid, "pkrTableID")) {
  2536.                 return ShowPlayerDialog(playerid, DIALOG_CGAMESSETUPPGAME7, DIALOG_STYLE_INPUT, "{FFFFFF}Casino Games - (Round Delay)", "{FFFFFF}Please input a Round Delay (15-120sec):", "Change", "Back");
  2537.             }
  2538.         }
  2539.     }
  2540.     return 1;
  2541. }
  2542.  
  2543. CMD:casinogames(playerid, params[])
  2544. {
  2545.     if(IsPlayerAdmin(playerid)) {
  2546.         ShowCasinoGamesMenu(playerid, DIALOG_CGAMESADMINMENU);
  2547.     } else {
  2548.         SendClientMessage(playerid, COLOR_WHITE, "You are not a rcon admin, you cannot use this command!");
  2549.     }
  2550.     return 1;
  2551. }
  2552.  
  2553. CMD:poker(playerid, params[]) // DEBUG ONLY
  2554. {
  2555.     SetPlayerPos(playerid, 2108.3777,2393.7341,60.8169);
  2556.     SetPlayerVirtualWorld(playerid, 0);
  2557.     SetPlayerInterior(playerid, 0);
  2558.     SetPlayerTime(playerid, 17, 0);
  2559.     SetPlayerWeather(playerid, 17);
  2560.    
  2561.     SetPVarInt(playerid, "cgChips", 10000);
  2562.    
  2563.     return 1;
  2564. }
  2565.  
  2566. CMD:debugseat(playerid, params[]) // DEBUG ONLY
  2567. {
  2568.     for(new t = 0; t < MAX_POKERTABLES; t++) {
  2569.         if(IsPlayerInRangeOfPoint(playerid, 5.0, PokerTable[t][pkrX], PokerTable[t][pkrY], PokerTable[t][pkrZ])) {
  2570.             new s = strval(params);
  2571.            
  2572.             if(s < 6 && s >= 0) {
  2573.                 SetPlayerPosObjectOffset(PokerTable[t][pkrObjectID], playerid, PokerTableMiscObjOffsets[s][0], PokerTableMiscObjOffsets[s][1], PokerTableMiscObjOffsets[s][2]);
  2574.                 SetPlayerFacingAngle(playerid, PokerTableMiscObjOffsets[s][5]+90.0);
  2575.             }
  2576.         }
  2577.     }
  2578.     return 1;
  2579. }
  2580.  
  2581. CMD:debugcamera(playerid, params[]) // DEBUG ONLY
  2582. {
  2583.     for(new t = 0; t < MAX_POKERTABLES; t++) {
  2584.         if(IsPlayerInRangeOfPoint(playerid, 5.0, PokerTable[t][pkrX], PokerTable[t][pkrY], PokerTable[t][pkrZ])) {
  2585.             CameraRadiusSetPos(playerid, PokerTable[t][pkrX], PokerTable[t][pkrY], PokerTable[t][pkrZ], 90.0, 4.7, 0.1);
  2586.         }
  2587.     }
  2588.     return 1;
  2589. }
  2590.  
  2591. CMD:leavedebugcamera(playerid, params[]) // DEBUG ONLY
  2592. {
  2593.     SetCameraBehindPlayer(playerid);
  2594.     TogglePlayerControllable(playerid, 1);
  2595.     ClearAnimations(playerid, 1);
  2596.    
  2597.     return 1;
  2598. }
  2599.  
  2600. CMD:jointable(playerid, params[])
  2601. {
  2602.     if(GetPVarType(playerid, "pkrTableID") == 0) {
  2603.         for(new t = 0; t < MAX_POKERTABLES; t++) {
  2604.             if(IsPlayerInRangeOfPoint(playerid, 5.0, PokerTable[t][pkrX], PokerTable[t][pkrY], PokerTable[t][pkrZ])) {
  2605.                 if(PokerTable[t][pkrPass][0] != EOS) {
  2606.                     if(!strcmp(params, PokerTable[t][pkrPass], false, 32)) {
  2607.                         JoinPokerTable(playerid, t);
  2608.                     } else {
  2609.                         return SendClientMessage(playerid, COLOR_WHITE, "Usage: /jointable (password)");
  2610.                     }
  2611.                 } else {
  2612.                     JoinPokerTable(playerid, t);
  2613.                 }
  2614.                 return 1;
  2615.             }
  2616.         }
  2617.     } else {
  2618.         SendClientMessage(playerid, COLOR_WHITE, "You are already at a Poker Table! You must /leavetable before you join another one!");
  2619.     }
  2620.     return 1;
  2621. }
  2622.  
  2623. CMD:leavetable(playerid, params[])
  2624. {
  2625.     if(GetPVarType(playerid, "pkrTableID")) {  
  2626.         LeavePokerTable(playerid);
  2627.     }
  2628.     return 1;
  2629. }
  2630.  
  2631. CMD:debugsound(playerid, params[]) // DEBUG ONLY
  2632. {
  2633.     PlayerPlaySound(playerid, strval(params), 0.0, 0.0, 0.0);
  2634. }
  2635.  
  2636. CMD:debugtextsize(playerid, params[])
  2637. {
  2638.     switch(strval(params))
  2639.     {
  2640.         case 0:
  2641.         {
  2642.             PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][37], 0.199999, 1.200000);
  2643.         }
  2644.         case 1:
  2645.         {
  2646.             PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][37], 0.189999, 1.100000);
  2647.         }
  2648.         case 2:
  2649.         {
  2650.             PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][37], 0.179999, 1.000000);
  2651.         }
  2652.         case 3:
  2653.         {
  2654.             PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][37], 0.169999, 0.90000);
  2655.         }
  2656.         case 4:
  2657.         {
  2658.             PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][37], 0.159999, 0.800000);
  2659.         }
  2660.         case 5:
  2661.         {
  2662.             PlayerTextDrawLetterSize(playerid, PlayerPokerUI[playerid][37], 0.149999, 0.700000);
  2663.         }
  2664.     }
  2665.     return 1;
  2666. }
  2667.  
  2668. public OnPlayerConnect(playerid)
  2669. {
  2670.     // DEBUG
  2671.     CancelSelectTextDraw(playerid);
  2672.    
  2673.     SetPVarInt(playerid, "cgChips", 10000);
  2674.     SendClientMessage(playerid, COLOR_WHITE, "Casino Games is in Beta! Some things are most likely broken.");
  2675.     SendClientMessage(playerid, COLOR_GOLD, "Commands: /poker - /jointable - /leavetable - /chips");
  2676.     // DEBUG
  2677.  
  2678.     return 1;
  2679. }
  2680.  
  2681. public OnPlayerDisconnect(playerid, reason)
  2682. {
  2683.     return 1;
  2684. }
  2685.  
  2686. public OnPlayerUpdate(playerid)
  2687. {
  2688.     if(GetPVarType(playerid, "tmpPlacePokerTable")) // Place Poker Table
  2689.     {
  2690.         new keys, updown, leftright;
  2691.         GetPlayerKeys(playerid, keys, updown, leftright);
  2692.        
  2693.         if(keys == KEY_SPRINT) {
  2694.             DeletePVar(playerid, "tmpPlacePokerTable");
  2695.            
  2696.             new Float:x, Float:y, Float:z;
  2697.             GetPlayerPos(playerid, x, y, z);
  2698.             new int = GetPlayerInterior(playerid);
  2699.             new vw = GetPlayerVirtualWorld(playerid);
  2700.            
  2701.             new tableid = PlacePokerTable(GetPVarInt(playerid, "tmpEditPokerTableID")-1, 0, x, y, z+2.0, 0.0, 0.0, 0.0, vw, int);
  2702.            
  2703.             SetPVarFloat(playerid, "tmpPkrX", PokerTable[tableid][pkrX]);
  2704.             SetPVarFloat(playerid, "tmpPkrY", PokerTable[tableid][pkrY]);
  2705.             SetPVarFloat(playerid, "tmpPkrZ", PokerTable[tableid][pkrZ]);
  2706.             SetPVarFloat(playerid, "tmpPkrRX", PokerTable[tableid][pkrRX]);
  2707.             SetPVarFloat(playerid, "tmpPkrRY", PokerTable[tableid][pkrRY]);
  2708.             SetPVarFloat(playerid, "tmpPkrRZ", PokerTable[tableid][pkrRZ]);
  2709.            
  2710.             EditObject(playerid, PokerTable[tableid][pkrObjectID]);
  2711.            
  2712.             new szString[128];
  2713.             format(szString, sizeof(szString), "You have placed Poker Table %d, You may now customize it's position/rotation.", tableid);
  2714.             SendClientMessage(playerid, COLOR_WHITE, szString);
  2715.         }
  2716.     }
  2717.     return 1;
  2718. }
  2719.  
  2720. /*public OnPlayerCommandText(playerid, cmdtext[])
  2721. {
  2722.     return 0;
  2723. }
  2724.  
  2725. public OnPlayerCommandReceived(playerid, cmdtext[])
  2726. {
  2727.     return 1;
  2728. }
  2729.  
  2730. public OnPlayerCommandPerformed(playerid, cmdtext[], success)
  2731. {
  2732.     return 1;
  2733. }*/
  2734.  
  2735. public OnPlayerSelectObject(playerid, type, objectid, modelid, Float:fX, Float:fY, Float:fZ)
  2736. {
  2737.     if(type == SELECT_OBJECT_GLOBAL_OBJECT)
  2738.     {
  2739.         EditObject(playerid, objectid);
  2740.     }
  2741.     return 1;
  2742. }
  2743.  
  2744. public OnPlayerEditObject(playerid, playerobject, objectid, response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ)
  2745. {
  2746.     SetObjectPos(objectid, fX, fY, fZ);
  2747.     SetObjectRot(objectid, fRotX, fRotY, fRotZ);
  2748.  
  2749.     if(response == EDIT_RESPONSE_FINAL)
  2750.     {
  2751.         if(GetPVarType(playerid, "tmpEditPokerTableID")) {
  2752.             new tableid = GetPVarInt(playerid, "tmpEditPokerTableID")-1;
  2753.             DeletePVar(playerid, "tmpEditPokerTableID");
  2754.            
  2755.             DeletePVar(playerid, "tmpPkrX");
  2756.             DeletePVar(playerid, "tmpPkrY");
  2757.             DeletePVar(playerid, "tmpPkrZ");
  2758.             DeletePVar(playerid, "tmpPkrRX");
  2759.             DeletePVar(playerid, "tmpPkrRY");
  2760.             DeletePVar(playerid, "tmpPkrRZ");
  2761.            
  2762.             DestroyPokerTable(tableid);
  2763.             PlacePokerTable(tableid, 1, fX, fY, fZ, fRotX, fRotY, fRotZ, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid));
  2764.            
  2765.             ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSELECTPOKER);
  2766.         }
  2767.     }
  2768.  
  2769.     if(response == EDIT_RESPONSE_CANCEL)
  2770.     {
  2771.         if(GetPVarType(playerid, "tmpEditPokerTableID")) {
  2772.             new tableid = GetPVarInt(playerid, "tmpEditPokerTableID")-1;
  2773.             DeletePVar(playerid, "tmpEditPokerTableID");
  2774.            
  2775.             DestroyPokerTable(tableid);
  2776.             PlacePokerTable(tableid, 0, GetPVarFloat(playerid, "tmpPkrX"), GetPVarFloat(playerid, "tmpPkrY"), GetPVarFloat(playerid, "tmpPkrZ"), GetPVarFloat(playerid, "tmpPkrRX"), GetPVarFloat(playerid, "tmpPkrRY"), GetPVarFloat(playerid, "tmpPkrRZ"), GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid));
  2777.            
  2778.             DeletePVar(playerid, "tmpPkrX");
  2779.             DeletePVar(playerid, "tmpPkrY");
  2780.             DeletePVar(playerid, "tmpPkrZ");
  2781.             DeletePVar(playerid, "tmpPkrRX");
  2782.             DeletePVar(playerid, "tmpPkrRY");
  2783.             DeletePVar(playerid, "tmpPkrRZ");
  2784.            
  2785.             ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSELECTPOKER);
  2786.         }
  2787.     }
  2788. }
  2789.  
  2790. public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid)
  2791. {
  2792.     new tableid = GetPVarInt(playerid, "pkrTableID")-1;
  2793.     if(playertextid == PlayerPokerUI[playerid][38])
  2794.     {
  2795.          switch(GetPVarInt(playerid, "pkrActionOptions"))
  2796.          {
  2797.             case 1: // Raise
  2798.             {
  2799.                 PokerRaiseHand(playerid);
  2800.                 PokerTable[tableid][pkrRotations] = 0;
  2801.             }
  2802.             case 2: // Call
  2803.             {
  2804.                 PokerCallHand(playerid);
  2805.             }
  2806.             case 3: // Check
  2807.             {
  2808.                 PokerCheckHand(playerid);
  2809.                 PokerRotateActivePlayer(tableid);
  2810.             }
  2811.          }
  2812.     }
  2813.     if(playertextid == PlayerPokerUI[playerid][39])
  2814.     {
  2815.         switch(GetPVarInt(playerid, "pkrActionOptions"))
  2816.         {
  2817.             case 1: // Check
  2818.             {
  2819.                 PokerCheckHand(playerid);
  2820.                 PokerRotateActivePlayer(tableid);
  2821.             }
  2822.             case 2: // Raise
  2823.             {
  2824.                 PokerRaiseHand(playerid);
  2825.                 PokerTable[tableid][pkrRotations] = 0;
  2826.             }
  2827.             case 3: // Fold
  2828.             {
  2829.                 PokerFoldHand(playerid);
  2830.                 PokerRotateActivePlayer(tableid);
  2831.             }
  2832.         }
  2833.     }
  2834.     if(playertextid == PlayerPokerUI[playerid][40])
  2835.     {
  2836.          switch(GetPVarInt(playerid, "pkrActionOptions"))
  2837.         {
  2838.             case 1: // Fold
  2839.             {
  2840.                 PokerFoldHand(playerid);
  2841.                 PokerRotateActivePlayer(tableid);
  2842.             }
  2843.             case 2: // Fold
  2844.             {
  2845.                 PokerFoldHand(playerid);
  2846.                 PokerRotateActivePlayer(tableid);
  2847.             }
  2848.         }
  2849.     }
  2850.     if(playertextid == PlayerPokerUI[playerid][41]) // LEAVE
  2851.     {
  2852.         if(GetPVarType(playerid, "pkrTableID")) {
  2853.             LeavePokerTable(playerid);
  2854.         }
  2855.     }
  2856.     return 1;
  2857. }
  2858.  
  2859. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  2860. {
  2861.     if(dialogid == DIALOG_CGAMESADMINMENU)
  2862.     {
  2863.         if(response) {
  2864.             switch(listitem)
  2865.             {
  2866.                 case 0:
  2867.                 {
  2868.                     ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSELECTPOKER);
  2869.                 }
  2870.                 case 1:
  2871.                 {
  2872.                 }
  2873.                 case 2:
  2874.                 {
  2875.                     ShowCasinoGamesMenu(playerid, DIALOG_CGAMESCREDITS);
  2876.                 }
  2877.             }
  2878.         }
  2879.     }
  2880.     if(dialogid == DIALOG_CGAMESSELECTPOKER)
  2881.     {
  2882.         if(response) {
  2883.             SetPVarInt(playerid, "tmpEditPokerTableID", listitem+1);
  2884.             ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPOKER);
  2885.         } else {
  2886.             ShowCasinoGamesMenu(playerid, DIALOG_CGAMESADMINMENU);
  2887.         }
  2888.     }
  2889.     if(dialogid == DIALOG_CGAMESSETUPPOKER)
  2890.     {
  2891.         if(response) {
  2892.             new tableid = GetPVarInt(playerid, "tmpEditPokerTableID")-1;
  2893.        
  2894.             if(PokerTable[tableid][pkrPlaced] == 0) {
  2895.                 switch(listitem)
  2896.                 {
  2897.                     case 0: // Place Poker Table
  2898.                     {
  2899.                         new szString[128];
  2900.                         format(szString, sizeof(szString), "Press '{3399FF}~k~~PED_SPRINT~{FFFFFF}' to place poker table.");
  2901.                         SendClientMessage(playerid, COLOR_WHITE, szString);
  2902.                        
  2903.                         SetPVarInt(playerid, "tmpPlacePokerTable", 1);
  2904.                     }
  2905.                 }
  2906.             } else {
  2907.                 switch(listitem)
  2908.                 {
  2909.                     case 0: // Edit Poker Table
  2910.                     {
  2911.                         SetPVarFloat(playerid, "tmpPkrX", PokerTable[tableid][pkrX]);
  2912.                         SetPVarFloat(playerid, "tmpPkrY", PokerTable[tableid][pkrY]);
  2913.                         SetPVarFloat(playerid, "tmpPkrZ", PokerTable[tableid][pkrZ]);
  2914.                         SetPVarFloat(playerid, "tmpPkrRX", PokerTable[tableid][pkrRX]);
  2915.                         SetPVarFloat(playerid, "tmpPkrRY", PokerTable[tableid][pkrRY]);
  2916.                         SetPVarFloat(playerid, "tmpPkrRZ", PokerTable[tableid][pkrRZ]);
  2917.                    
  2918.                         EditObject(playerid, PokerTable[tableid][pkrObjectID]);
  2919.            
  2920.                         new szString[128];
  2921.                         format(szString, sizeof(szString), "You have selected Poker Table %d, You may now customize it's position/rotation.", tableid);
  2922.                         SendClientMessage(playerid, COLOR_WHITE, szString);
  2923.                     }
  2924.                     case 1: // Destroy Poker Table
  2925.                     {
  2926.                         DestroyPokerTable(tableid);
  2927.                        
  2928.                         new szString[64];
  2929.                         format(szString, sizeof(szString), "You have deleted Poker Table %d.", tableid);
  2930.                         SendClientMessage(playerid, COLOR_WHITE, szString);
  2931.                        
  2932.                         ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSELECTPOKER);
  2933.                     }
  2934.                 }
  2935.             }
  2936.         } else {
  2937.             ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSELECTPOKER);
  2938.         }
  2939.     }
  2940.     if(dialogid == DIALOG_CGAMESCREDITS)
  2941.     {
  2942.         ShowCasinoGamesMenu(playerid, DIALOG_CGAMESADMINMENU);
  2943.     }
  2944.     if(dialogid == DIALOG_CGAMESSETUPPGAME)
  2945.     {
  2946.         if(response) {
  2947.             switch(listitem)
  2948.             {
  2949.                 case 0: // Buy-In Max
  2950.                 {
  2951.                     ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME2);
  2952.                 }
  2953.                 case 1: // Buy-In Min
  2954.                 {
  2955.                     ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME3);
  2956.                 }
  2957.                 case 2: // Blind
  2958.                 {
  2959.                     ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME4);
  2960.                 }
  2961.                 case 3: // Limit
  2962.                 {
  2963.                     ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME5);
  2964.                 }
  2965.                 case 4: // Password
  2966.                 {
  2967.                     ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME6);
  2968.                 }
  2969.                 case 5: // Round Delay
  2970.                 {
  2971.                     ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME7);
  2972.                 }
  2973.                 case 6: // Start Game
  2974.                 {
  2975.                     ShowCasinoGamesMenu(playerid, DIALOG_CGAMESBUYINPOKER);
  2976.                 }
  2977.             }
  2978.         } else {
  2979.             LeavePokerTable(playerid);
  2980.         }
  2981.     }
  2982.     if(dialogid == DIALOG_CGAMESSETUPPGAME2)
  2983.     {
  2984.         if(response) {
  2985.             if(strval(inputtext) < 1 || strval(inputtext) > 1000000000) {
  2986.                 return ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME2);
  2987.             }
  2988.            
  2989.             if(strval(inputtext) <= PokerTable[GetPVarInt(playerid, "pkrTableID")-1][pkrBuyInMin]) {
  2990.                 return ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME2);
  2991.             }
  2992.            
  2993.             PokerTable[GetPVarInt(playerid, "pkrTableID")-1][pkrBuyInMax] = strval(inputtext);
  2994.             return ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME);
  2995.         } else {
  2996.             return ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME);
  2997.         }
  2998.     }
  2999.     if(dialogid == DIALOG_CGAMESSETUPPGAME3)
  3000.     {
  3001.         if(response) {
  3002.             if(strval(inputtext) < 1 || strval(inputtext) > 1000000000) {
  3003.                 return ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME3);
  3004.             }
  3005.            
  3006.             if(strval(inputtext) >= PokerTable[GetPVarInt(playerid, "pkrTableID")-1][pkrBuyInMax]) {
  3007.                 return ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME3);
  3008.             }
  3009.            
  3010.             PokerTable[GetPVarInt(playerid, "pkrTableID")-1][pkrBuyInMin] = strval(inputtext);
  3011.             return ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME);
  3012.         } else {
  3013.             return ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME);
  3014.         }
  3015.     }
  3016.     if(dialogid == DIALOG_CGAMESSETUPPGAME4)
  3017.     {
  3018.         if(response) {
  3019.             if(strval(inputtext) < 1 || strval(inputtext) > 1000000000) {
  3020.                 return ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME4);
  3021.             }
  3022.            
  3023.             PokerTable[GetPVarInt(playerid, "pkrTableID")-1][pkrBlind] = strval(inputtext);
  3024.             return ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME);
  3025.         } else {
  3026.             return ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME);
  3027.         }
  3028.     }
  3029.     if(dialogid == DIALOG_CGAMESSETUPPGAME5)
  3030.     {
  3031.         if(response) {
  3032.             if(strval(inputtext) < 2 || strval(inputtext) > 6) {
  3033.                 return ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME5);
  3034.             }
  3035.            
  3036.             PokerTable[GetPVarInt(playerid, "pkrTableID")-1][pkrLimit] = strval(inputtext);
  3037.             return ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME);
  3038.         } else {
  3039.             return ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME);
  3040.         }
  3041.     }
  3042.     if(dialogid == DIALOG_CGAMESSETUPPGAME6)
  3043.     {
  3044.         if(response) {
  3045.             new tableid = GetPVarInt(playerid, "pkrTableID")-1;
  3046.             strmid(PokerTable[tableid][pkrPass], inputtext, 0, strlen(inputtext), 32);
  3047.             return ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME);
  3048.         } else {
  3049.             ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME);
  3050.         }
  3051.     }
  3052.     if(dialogid == DIALOG_CGAMESSETUPPGAME7)
  3053.     {
  3054.         if(response) {
  3055.             if(strval(inputtext) < 15 || strval(inputtext) > 120) {
  3056.                 return ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME7);
  3057.             }
  3058.            
  3059.             PokerTable[GetPVarInt(playerid, "pkrTableID")-1][pkrSetDelay] = strval(inputtext);
  3060.             return ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME);
  3061.         } else {
  3062.             return ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME);
  3063.         }
  3064.     }
  3065.     if(dialogid == DIALOG_CGAMESBUYINPOKER)
  3066.     {
  3067.         if(response) {
  3068.             if(strval(inputtext) < PokerTable[GetPVarInt(playerid, "pkrTableID")-1][pkrBuyInMin] || strval(inputtext) > PokerTable[GetPVarInt(playerid, "pkrTableID")-1][pkrBuyInMax] || strval(inputtext) > GetPVarInt(playerid, "cgChips")) {
  3069.                 return ShowCasinoGamesMenu(playerid, DIALOG_CGAMESBUYINPOKER);
  3070.             }
  3071.            
  3072.             PokerTable[GetPVarInt(playerid, "pkrTableID")-1][pkrActivePlayers]++;
  3073.             SetPVarInt(playerid, "pkrChips", GetPVarInt(playerid, "pkrChips")+strval(inputtext));
  3074.             SetPVarInt(playerid, "cgChips", GetPVarInt(playerid, "cgChips")-strval(inputtext));
  3075.            
  3076.            
  3077.             if(PokerTable[GetPVarInt(playerid, "pkrTableID")-1][pkrActive] == 3 && PokerTable[GetPVarInt(playerid, "pkrTableID")-1][pkrRound] == 0 && PokerTable[GetPVarInt(playerid, "pkrTableID")-1][pkrDelay] >= 6) {
  3078.                 SetPVarInt(playerid, "pkrStatus", 1);
  3079.             }
  3080.             else if(PokerTable[GetPVarInt(playerid, "pkrTableID")-1][pkrActive] < 3) {
  3081.                 SetPVarInt(playerid, "pkrStatus", 1);
  3082.             }
  3083.            
  3084.             if(PokerTable[GetPVarInt(playerid, "pkrTableID")-1][pkrActive] == 1 && GetPVarInt(playerid, "pkrRoomLeader")) {
  3085.                 PokerTable[GetPVarInt(playerid, "pkrTableID")-1][pkrActive] = 2;
  3086.                 SelectTextDraw(playerid, COLOR_GOLD);
  3087.             }
  3088.         } else {
  3089.             return LeavePokerTable(playerid);
  3090.         }
  3091.     }
  3092.     if(dialogid == DIALOG_CGAMESCALLPOKER)
  3093.     {
  3094.         if(response) {
  3095.             new tableid = GetPVarInt(playerid, "pkrTableID")-1;
  3096.            
  3097.             new actualBet = PokerTable[tableid][pkrActiveBet]-GetPVarInt(playerid, "pkrCurrentBet");
  3098.            
  3099.             if(actualBet > GetPVarInt(playerid, "pkrChips")) {
  3100.                 PokerTable[tableid][pkrPot] += GetPVarInt(playerid, "pkrChips");
  3101.                 SetPVarInt(playerid, "pkrChips", 0);
  3102.                 SetPVarInt(playerid, "pkrCurrentBet", PokerTable[tableid][pkrActiveBet]);
  3103.             } else {
  3104.                 PokerTable[tableid][pkrPot] += actualBet;
  3105.                 SetPVarInt(playerid, "pkrChips", GetPVarInt(playerid, "pkrChips")-actualBet);
  3106.                 SetPVarInt(playerid, "pkrCurrentBet", PokerTable[tableid][pkrActiveBet]);
  3107.             }
  3108.  
  3109.             SetPVarString(playerid, "pkrStatusString", "Call");
  3110.             PokerRotateActivePlayer(tableid);
  3111.            
  3112.             ApplyAnimation(playerid, "CASINO", "cards_raise", 4.1, 0, 1, 1, 1, 1, 1);
  3113.         }
  3114.        
  3115.         DeletePVar(playerid, "pkrActionChoice");
  3116.     }
  3117.     if(dialogid == DIALOG_CGAMESRAISEPOKER)
  3118.     {
  3119.         if(response) {
  3120.             new tableid = GetPVarInt(playerid, "pkrTableID")-1;
  3121.        
  3122.             new actualRaise = strval(inputtext)-GetPVarInt(playerid, "pkrCurrentBet");
  3123.            
  3124.             if(strval(inputtext) >= PokerTable[tableid][pkrActiveBet]+PokerTable[tableid][pkrBlind]/2 && strval(inputtext) <= GetPVarInt(playerid, "pkrCurrentBet")+GetPVarInt(playerid, "pkrChips")) {
  3125.                 PokerTable[tableid][pkrPot] += actualRaise;
  3126.                 PokerTable[tableid][pkrActiveBet] = strval(inputtext);
  3127.                 SetPVarInt(playerid, "pkrChips", GetPVarInt(playerid, "pkrChips")-actualRaise);
  3128.                 SetPVarInt(playerid, "pkrCurrentBet", PokerTable[tableid][pkrActiveBet]);
  3129.                
  3130.                 SetPVarString(playerid, "pkrStatusString", "Raise");
  3131.                
  3132.                 PokerTable[tableid][pkrRotations] = 0;
  3133.                 PokerRotateActivePlayer(tableid);
  3134.                
  3135.                 ApplyAnimation(playerid, "CASINO", "cards_raise", 4.1, 0, 1, 1, 1, 1, 1);
  3136.             } else {
  3137.                 ShowCasinoGamesMenu(playerid, DIALOG_CGAMESRAISEPOKER);
  3138.             }
  3139.         }
  3140.        
  3141.         DeletePVar(playerid, "pkrActionChoice");
  3142.     }
  3143.     return 0;
  3144. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement