SA-MP Forums Archive
command /dice. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: command /dice. (/showthread.php?tid=531459)



command /dice. - capsator10 - 12.08.2014

I need command /dice (player ID) (amount of money)
For example /dice 2 30000
its will random the number 1-6
and then its choose a number and send message to player if him win or if him lose
For example if win: you choose 2 and you get double gambling
For example if lose:you choose 2 and you wrong

How i can make it, who can help me?


Re: command /dice. - SickAttack - 12.08.2014

Quote:
Originally Posted by YossiBz
View Post
There will be command /dice (player ID) (amount of money)
For example /dice 2 30000
its will random the number 1-6
and then its choose a number and send message to player if him win or if him lose
For example if win: you choose 2 and you get double gambling
For example if lose:you choose 2 and you wrong

If its please tell me how i can make one (or make one for me please)
my englise its not so good
^ Your post look like his.

Quote:
Originally Posted by Babul
View Post
i got a /dice command vs the server, its NOT exactly what you need, anyways, maybe you can use some parts of it. to make it work vs another player will be a good exercise ^^
pawn Code:
CMD:dice(playerid, params[]){
    new bet;
    if (sscanf(params, "i",bet))
    {
        SendClientMessage(playerid,MSGCMDS_COLOR, "Usage: \"/Dice <amount to bet>\"");
    }
    else
    {
        if (bet<1)
        {
            SendClientMessage(playerid,MSGFAIL_COLOR, "Are you kidding me? Bet a positive amount.");
        }
        else if (bet>1000000)
        {
            SendClientMessage(playerid,MSGFAIL_COLOR, "Erm.. To protect a player from losing all his Money, theres a Limit of $1,000,000");
        }
        else
        {
            new Cash=GetPlayerMoney(playerid);
            if (Cash<bet)
            {
                new string[128];
                format(string,sizeof(string),"No Money - No Bet. Your Cash: $%i",Cash);
                SendClientMessage(playerid,MSGFAIL_COLOR,string);
            }
            else
            {
                new NumberDrawn11,NumberDrawn12,NumberDouble1,NumberDrawn21,NumberDrawn22,NumberDouble2,Winner;
                NumberDrawn11=random(6)+1;
                NumberDrawn12=random(6)+1;
                if (NumberDrawn11==NumberDrawn12) NumberDouble1=NumberDrawn11;
                NumberDrawn21=random(6)+1;
                NumberDrawn22=random(6)+1;
                if (NumberDrawn21==NumberDrawn22) NumberDouble2=NumberDrawn21;
                if (NumberDrawn11+NumberDrawn12>NumberDrawn21+NumberDrawn22)
                {
                    Winner=1;
                }
                else if (NumberDrawn11+NumberDrawn12<NumberDrawn21+NumberDrawn22)
                {
                    Winner=2;
                }
                else
                {
                    if (NumberDouble1>NumberDouble2) Winner=1;
                    else if (NumberDouble1<NumberDouble2) Winner=2;
                }
                new string[64];
                format(string,sizeof(string),"Numbers Diced 1: %d %d",NumberDrawn11,NumberDrawn12);
                SendClientMessage(playerid,MSGINFO_COLOR,string);
                format(string,sizeof(string),"Numbers Diced 2: %d %d",NumberDrawn21,NumberDrawn22);
                SendClientMessage(playerid,MSGINFO_COLOR,string);
                if (Winner==1)
                {
                    if (NumberDouble1>0)
                    {
                        format(string,sizeof(string),"You won $%d, a double!",bet*2);
                        SendClientMessage(playerid,MSGSUCC_COLOR,string);
                        SetPVarInt(playerid,"Money",GetPVarInt(playerid,"Money")+bet*2);
                        GivePlayerMoney(playerid,bet*2);
                    }
                    else
                    {
                        format(string,sizeof(string),"You won $%d",bet);
                        SendClientMessage(playerid,MSGSUCC_COLOR,string);
                        SetPVarInt(playerid,"Money",GetPVarInt(playerid,"Money")+bet);
                        GivePlayerMoney(playerid,bet);
                    }
                }
                else if (Winner==2)
                {
                    format(string,sizeof(string),"You lost $%d",bet);
                    SendClientMessage(playerid,MSGFAIL_COLOR,string);
                    SetPVarInt(playerid,"Money",GetPVarInt(playerid,"Money")-bet);
                    GivePlayerMoney(playerid,-bet);
                }
                else if (Winner==0)
                {
                    format(string,sizeof(string),"Draw",bet);
                    SendClientMessage(playerid,MSGFAIL_COLOR,string);
                }
            }
        }
    }
    return 1;
}
ah its a good idea to remove the "double dice-win", when you dice a 1+1, then you win vs my 4+5...



Re: command /dice. - capsator10 - 12.08.2014

I want something like this:











Re: command /dice. - capsator10 - 12.08.2014

anyone?


Re: command /dice. - salev13 - 12.08.2014

Can someone give me it too please?


Re: command /dice. - capsator10 - 12.08.2014

anyone?


Re: command /dice. - Stinged - 12.08.2014

This isn't a request section.


Re: command /dice. - capsator10 - 13.08.2014

bump


Re: command /dice. - Don_Cage - 13.08.2014

Quote:
Originally Posted by capsator10
View Post
bump
Learn to script and make it yourself, post errors here.
Or go to the right section and request there..


Re: command /dice. - GGW - 13.08.2014

is it something like this ?

http://pastebin.com/his7ZpFj