Roll The Dice
#1

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
Reply
#2

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 ^^
Код:
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...
Reply
#3

tnx!!!!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)