SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 12/08/2014, 08:14 PM   #1
capsator10
Little Clucker
 
Join Date: Aug 2012
Posts: 19
Reputation: 0
Wink command /dice.

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?
capsator10 is offline   Reply With Quote
Old 12/08/2014, 08:26 PM   #2
SickAttack
High-roller
 
Join Date: Dec 2013
Posts: 4,761
Reputation: 754
Default Re: command /dice.

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...
SickAttack is offline   Reply With Quote
Old 12/08/2014, 09:28 PM   #3
capsator10
Little Clucker
 
Join Date: Aug 2012
Posts: 19
Reputation: 0
Default Re: command /dice.

I want something like this:








capsator10 is offline   Reply With Quote
Old 12/08/2014, 10:21 PM   #4
capsator10
Little Clucker
 
Join Date: Aug 2012
Posts: 19
Reputation: 0
Default Re: command /dice.

anyone?
capsator10 is offline   Reply With Quote
Old 12/08/2014, 10:27 PM   #5
salev13
Big Clucker
 
Join Date: May 2013
Location: England
Posts: 176
Reputation: 0
Default Re: command /dice.

Can someone give me it too please?
salev13 is offline   Reply With Quote
Old 12/08/2014, 10:52 PM   #6
capsator10
Little Clucker
 
Join Date: Aug 2012
Posts: 19
Reputation: 0
Default Re: command /dice.

anyone?
capsator10 is offline   Reply With Quote
Old 12/08/2014, 11:15 PM   #7
Stinged
High-roller
 
Join Date: Feb 2013
Posts: 1,571
Reputation: 187
Default Re: command /dice.

This isn't a request section.
Stinged is offline   Reply With Quote
Old 13/08/2014, 03:14 AM   #8
capsator10
Little Clucker
 
Join Date: Aug 2012
Posts: 19
Reputation: 0
Default Re: command /dice.

bump
capsator10 is offline   Reply With Quote
Old 13/08/2014, 03:34 AM   #9
Don_Cage
High-roller
 
Don_Cage's Avatar
 
Join Date: Aug 2012
Posts: 1,072
Reputation: 40
Default Re: command /dice.

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..
Don_Cage is offline   Reply With Quote
Old 13/08/2014, 04:25 AM   #10
GGW
Big Clucker
 
GGW's Avatar
 
Join Date: Apr 2013
Location: UAE
Posts: 160
Reputation: 13
Default Re: command /dice.

is it something like this ?

http://pastebin.com/his7ZpFj
__________________
GGW is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dice RP LarryTiger Scripting Help 3 21/12/2014 12:29 AM
[Tutorial] How to Make a Dice Command kosa451 Tutorials 13 04/09/2014 07:46 PM
Dice salev13 Scripting Help 1 08/08/2014 04:01 PM
Dice command friezakinght Scripting Help 2 10/07/2014 02:01 PM
Roll The Dice YossiBz Help Archive 2 14/01/2011 11:45 AM


All times are GMT. The time now is 04:18 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.