10.07.2018, 19:07
Код:
COMMAND:openbets(playerid, params[]) { new imessage[128]; if(PlayerInfo[playerid][dealer] != 1) return SendClientError(playerid, CANT_USE_CMD); if(PlayerTemp[playerid][dealerduty] != 1) return SendClientError(playerid, "You must be on dealer duty to use this command."); if(TableInfo[playerid][opened] == 0) return SendClientError(playerid, "You don't have any opened table."); TableInfo[playerid][bettingOpened] = 1; format(imessage, sizeof(imessage), "Betting is now - Opened -.", playerid, PlayerName(playerid)); SendTableMSG(playerid, imessage); PlayerLoop(p) { if(tableid[p] == playerid && joinedtable[p]) { TextDrawSetString(Dealertexton1, "~r~ Opened"); TextDrawDestroy(Dealertext3); TextDrawShowForAll(Dealertext1); } } return 1; } COMMAND:closebets(playerid, params[]) { new imessage[128]; if(PlayerInfo[playerid][dealer] != 1) return SendClientError(playerid, CANT_USE_CMD); if(PlayerTemp[playerid][dealerduty] != 1) return SendClientError(playerid, "You must be on dealer duty to use this command."); if(TableInfo[playerid][opened] == 0) return SendClientError(playerid, "You don't have any opened table."); TableInfo[playerid][bettingOpened] = 0; //NearMessage(playerid,"Closed betting",COLOR_ME2); //Action(playerid, "Closed betting"); format(imessage, sizeof(imessage), "Betting is now - Closed -.", playerid, PlayerName(playerid)); SendTableMSG(playerid, imessage); TextDrawSetString(Dealertxthead[playerid], "Bets: ~r~Closed"); PlayerLoop(p) { if(tableid[p] == playerid && joinedtable[p]) { TextDrawSetString(Dealertexton1, "~r~ CLOSED"); TextDrawShowForAll(Dealertext1); TextDrawShowForAll(Dealertext2); TextDrawShowForAll(Dealertext3); } } return 1; } COMMAND:bet(playerid, params[]) { new amount, bet[128], message[128], TextdrawMSG[128]; if(sscanf(params, "is", amount, bet)) return SCP(playerid, "[Amount] [Bet]"); if(joinedtable[playerid] == false) return SendClientError(playerid, "You Haven't Joined a Dealer's Table!"); if(PlayerTemp[playerid][sm] <= amount) return SendClientError(playerid, "You don't have this much cash in hand!"); if(TableInfo[tableid[playerid]][bettingOpened] == 0) return SendClientError(playerid, "Bets are currently closed!"); if(amount < TableInfo[tableid[playerid]][minbet] || amount > TableInfo[tableid[playerid]][maxbet]) return SendClientError(playerid, "Invalid amount! The amount is not within the Dealer's Betting Range!"); if(PlayerTemp[playerid][betted] == 1) return SendClientError(playerid, "You have already betted!"); GivePlayerMoneyEx(playerid,-amount); GivePlayerMoneyEx(tableid[playerid], amount); format(message, sizeof(message), "[%d] %s betted on ---> %s <--- [$%s]", playerid, PlayerName(playerid), bet, AddCommasToInt(amount)); format(TextdrawMSG, sizeof(TextdrawMSG), "\\n[%d]%s bet:%s AMOUNT: %d", playerid, PlayerName(playerid), bet, AddCommasToInt(amount)); SendTableMSG(playerid, message); PlayerLoop(p) { if(tableid[p] == playerid && joinedtable[p]) { TextDrawSetString(Dealertexton1, "~r~ CLOSED"); TextDrawShowForAll(Dealertext1); TextDrawShowForAll(Dealertext2); TextDrawSetString(DealerText3, TextdrawMSG); TextDrawShowForAll(Dealertext3); } } PlayerTemp[playerid][betted] = 1; return 1; }