Dicebet command takes money and the immedielty returns it.
#1

Hello, I downloaded a Dicebet command which allows the players to play dice against the server.
so.. the problem is that for example if the players win money..
the server gives him the money but then takes it back immedietly
same when you loose.. the server takes the money from you but then immedietly returns it..

Код:
CMD:dicebet(playerid, params[]){
	new bet;
	if (sscanf(params, "i",bet))
	{
		SendClientMessage(playerid,COLOR_WHITE, "Usage: \"/Dice <amount to bet>\"");
	}
	else
	{
		if (bet<1)
		{
			SendClientMessage(playerid,COLOR_WHITE, "Are you kidding me? Bet a positive amount.");
		}
		else if (bet>1000000)
		{
			SendClientMessage(playerid,COLOR_WHITE, "You can't bet more than 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,COLOR_WHITE,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,COLOR_CYAN,string);
				format(string,sizeof(string),"Numbers Diced 2: %d %d",NumberDrawn21,NumberDrawn22);
				SendClientMessage(playerid,COLOR_CYAN,string);
				if (Winner==1)
				{
					if (NumberDouble1>0)
					{
						format(string,sizeof(string),"You won $%d, a double!",bet*2);
						SendClientMessage(playerid,COLOR_CYAN,string);
						SetPVarInt(playerid,"Money",GetPVarInt(playerid,"Money")+bet*2);
						GivePlayerMoney(playerid,bet*2);
					}
					else
					{
						format(string,sizeof(string),"You won $%d",bet);
						SendClientMessage(playerid,COLOR_LIME,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,COLOR_RED,string);
					SetPVarInt(playerid,"Money",GetPVarInt(playerid,"Money")-bet);
					GivePlayerMoney(playerid,-bet);
				}
				else if (Winner==0)
				{
					format(string,sizeof(string),"Draw",bet);
					SendClientMessage(playerid,COLOR_WHITE,string);
				}
			}
		}
	}
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)