Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CMD:blackjack(playerid, params[])
- {
- new string[128], giveplayerid, offerAmount;
- if(sscanf(params, "u", giveplayerid, offerAmount))
- return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /blackjack [playerid/partofname] [amount]");
- }
- else if(!IsPlayerConnected(giveplayerid)) {
- SendClientMessage(playerid, COLOR_GRAY, "Invalid player specified.");
- }
- if(IsPlayerConnected(BlackJackOffer[playerid])) {
- if(GetPlayerCash(playerid) > offerAmount[playerid]) {
- if(playerid == giveplayerid)
- {
- SendClientMessage(playerid, COLOR_GREY, "You can't use this command on yourself.");
- return 1;
- }
- if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_GREY, "Player is currently not connected to the server.");
- if(ProxDetectorS(8.0, playerid, giveplayerid))
- {
- BlackJackOffer[giveplayerid] = playerid;
- BlackJackAmount[giveplayerid] = offerAmount;
- format(string, sizeof(string), "* You offered %s in blackjack at $%d.", GetPlayerNameEx(giveplayerid), offerAmount);
- SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
- format(string, sizeof(string), "* %s has offered you %s in blackjack, (type /acceptblackjack) to buy.", GetPlayerNameEx(playerid), price);
- SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
- return 1;
- }
- else
- {
- SendClientMessage(playerid, COLOR_GREY, "That player is not near you.");
- return 1;
- }
- }
- }
- return;
- }
- CMD:acceptblackjack(playerid, params[])
- {
- new string[128];
- new aBJdice = random(6)+1;
- new aBJdice1 = random(6)+1;
- new aBJdice2 = random(6)+1;
- new oBJdice = random(6)+1;
- new oBJdice1 = random(6)+1;
- new oBJdice2 = random(6)+1;
- new giveplayerid[MAX_PLAYER_NAME];
- if(BlackJackOffer[playerid] < 999) {
- if(PlayerInfo[playerid][pDice])
- {
- format(string, sizeof(string), "* %s rolls a dice that lands on %d.", GetPlayerNameEx(giveplayerid),aBJdice);
- format(string, sizeof(string), "* rolls again, dice that lands on %d.", GetPlayerNameEx(giveplayerid),aBJdice1);
- format(string, sizeof(string), "* rolls again, dice that lands on %d.", GetPlayerNameEx(giveplayerid),aBJdice2);
- format(string, sizeof(string), "* %s rolls a dice that lands on %d.", GetPlayerNameEx(playerid),oBJdice);
- format(string, sizeof(string), "* rolls again, dice that lands on %d.", GetPlayerNameEx(playerid),oBJdice1);
- format(string, sizeof(string), "* rolls again, dice that lands on %d.", GetPlayerNameEx(playerid),oBJdice2);
- ProxDetector(5.0, playerid, string, COLOR_DICEROLL,COLOR_DICEROLL,COLOR_DICEROLL,COLOR_DICEROLL,COLOR_DICEROLL);
- aHighestDice = aBJdice + aBJdice1 + aBJdice2;
- oHighestDice = oBJdice + oBJdice1 + oBJdice2;
- if(aHighestDice > 21){
- SendClientMessage(playerid, COLOR_WHITE, "they bust, you win.");
- SendClientMessage(giveplayerid, COLOR_WHITE, "You bust, offerer wins.");
- GivePlayerCash(playerid,-BlackJackAmount[playerid]);
- return 1;
- }
- else if(oHighestDice > 21){
- SendClientMessage(playerid, COLOR_WHITE, "The offerer bust, you win.");
- SendClientMessage(giveplayerid, COLOR_WHITE, "You bust, they win.");
- GivePlayerCash(giveplayerid,-BlackJackAmount[playerid]);
- return 1;
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_GRAY, "You don't have a dice.");
- return 1;
- }
- else
- {
- SendClientMessage(playerid, COLOR_GREY, "Nobody offered you blackjack.");
- return 1;
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement