help me please /dice
#1

Hey im trying to make /dice cmd
its will look like /dice [playerid] [amount of money]
and other player /accept dice [playerid] or /reject dice[playerid]

example:

player1 ( id : 558 ) typed : /dice 25 1000000
player2 (id : 25 ) typed : /accept dice 25

then server choose random player , for example server choose player 2

Player2 get message : You won 1000000$
and player1 get message: You lose 1000000$

and remove from player 1 1000000 and give player 2 1000000

also please dont forget to check if players have same amount of money

ex2 player1( id : 55 typed: /dice 25 100000000
player1 get message you dont have that ammount of money

ex3 player1 ( id 55 typed: /dice 25 100000000
player1 get message another player dont have that amount of money

ex4 player1 (id 55 typed: /dice 25 100
player1 get message dice request sent
player2 get message [ Name of player1 with id] want to dice you with( amount of money) /accept dice or /reject dice ( playerid server will get id of player1)

please help me i was trying to script this from long time but i cant
Reply
#2

Looking for scripters/helpers? Post here!
Reply
#3

Put your ideas in code... In reality is just a combination of some variables, sscanf, some ifs (posibble with elses), some returns, some get player money and give player money and a call of random(). (Simple compared with another things)
Reply
#4

Quote:
Originally Posted by 10MIN
View Post
Put your ideas in code... In reality is just a combination of some variables, sscanf, some ifs (posibble with elses), some returns, some get player money and give player money and a call of random(). (Simple compared with another things)
idk im not scripter if you can help me please do!
Reply
#5

Code:
new diceinvited[MAX_PLAYERS]=255, bet;
CMD:dice(playerid, params[]){
new enemyid;
new MyName[MAX_PLAYER_NAME], string2[24+MAX_PLAYER_NAME];
GetPlayerName(playerid, MyName, sizeof(MyName));
if (sscanf(params, "ii", enemyid, bet))
{
  SendClientMessage(playerid, 0xFFFFFF, "{A80000}Cum se foloseste: {FFFFFF}/dice <playerid> <money>");
}
else
{
  if(enemyid != INVALID_PLAYER_ID)
  {
    if(enemyid != playerid)
    {
      if (bet<=1)
      {
	    SendClientMessage(playerid, 0xFFFFFF, "{A80000}RTD: {FFFFFF}Nu poti paria doar 1$.");
	  }
	  else if (bet>5000000)
	  {
		SendClientMessage(playerid, 0xFFFFFF, "{A80000}RTD: {FFFFFF}Din motive de securitate, limita maxima este de 5.000.000$.");
	  }
	  else
	  {
		new Banet=GetPlayerMoney(playerid);
		if (Banet<bet)
		{
		  new string[128];
		  format(string,sizeof(string),"{A80000}RTD: {FFFFFF}Nu ai destui bani, ai doar: $%i",Banet);
		  SendClientMessage(playerid,0xFFFFFF,string);
		}
		else
		{
		  new HisName[MAX_PLAYER_NAME];
    	  GetPlayerName(enemyid, HisName, sizeof(HisName));
		   new string[128];
 		  format(string,sizeof(string),"{A80000}RTD: {FFFFFF}%s a fost invitat la zaruri.", HisName);
		  SendClientMessage(playerid,0xFFFFFF,string);
		  format(string,sizeof(string),"{A80000}RTD: {FFFFFF}Ai fost invitat la niste zaruri de catre %s, suma : %i$", MyName, bet);
		  SendClientMessage(enemyid,0xFFFFFF,string);
 		  format(string,sizeof(string),"{A80000}RTD: {FFFFFF}Accepta folosind comanda [/acceptdice <playerid>]");
		  SendClientMessage(enemyid,0xFFFFFF,string);
		  format(string2,sizeof(string2),"%s",MyName);
		  diceinvited[enemyid]=GetPlayerID(string2);
		}
	  }
	}
	else
	{
	  SendClientMessage(playerid, 0xFFFFFF, "{A80000}RTD: {FFFFFF}Nu te poti invita singur.");
	}
  }
  else
  {
    SendClientMessage(playerid, 0xFFFFFF, "{A80000}RTD: {FFFFFF}Acest player nu este online.");
  }
}
return 1;

}
CMD:acceptdice(playerid, params[]){
new enemyid;
new MyName[MAX_PLAYER_NAME];
GetPlayerName(playerid, MyName, sizeof(MyName));
if (sscanf(params, "i", enemyid))
{
  SendClientMessage(playerid, 0xFFFFFF, "{A80000}Cum se foloseste: {FFFFFF}/acceptdice <playerid>");
}
else
{
  if(enemyid == diceinvited[playerid] && enemyid != 255)
  {
    diceinvited[playerid]=255;
    new Banet=GetPlayerMoney(playerid);
    if (Banet<bet)
    {
	  new string[128];
	  format(string,sizeof(string),"{A80000}RTD: {FFFFFF}Nu ai destui bani, ai doar %i$.",Banet);
	  SendClientMessage(playerid,0xFFFFFF,string);
	  format(string,sizeof(string),"%s",MyName);
	  diceinvited[playerid]=255;
	}
	else
	{
	  diceinvited[playerid]=255;
	  new MyNumber[MAX_PLAYERS];
	  new Winner;
	  MyNumber[playerid]=random(6);
	  MyNumber[enemyid]=random(6);
	  if (MyNumber[playerid] == MyNumber[enemyid]) Winner=0;
	  if (MyNumber[playerid] > MyNumber[enemyid]) Winner=1;
	  if (MyNumber[playerid] < MyNumber[enemyid]) Winner=2;
	  new string[64];
	  format(string,sizeof(string),"{A80000}RTD: {FFFFFF}Numarul tau este %i iar al lui este %i.", MyNumber[playerid], MyNumber[enemyid]);
	  SendClientMessage(playerid,0xFFFFFF,string);
	  format(string,sizeof(string),"{A80000}RTD: {FFFFFF}Numarul tau este %i iar al lui este %i.", MyNumber[playerid], MyNumber[enemyid]);
	  SendClientMessage(enemyid,0xFFFFFF,string);
	  if (Winner==1)
	  {
		format(string,sizeof(string),"{A80000}RTD: {FFFFFF}Ai castigat %d$", bet*2);
		SendClientMessage(playerid,0xFFFFFF,string);
		format(string,sizeof(string),"{A80000}RTD: {FFFFFF}Ai pierdut %d$", bet);
		SendClientMessage(enemyid,0xFFFFFF,string);
		playerVariables[playerid][pMoney]+ = bet;
		playerVariables[enemyid][pMoney]- = bet;
	  }
	  else if (Winner==2)
	  {
		format(string,sizeof(string),"{A80000}RTD: {FFFFFF}Ai pierdut %d$", bet);
		SendClientMessage(playerid,0xFFFFFF,string);
		format(string,sizeof(string),"{A80000}RTD: {FFFFFF}Ai castigat %d$", bet);
		SendClientMessage(enemyid,0xFFFFFF,string);
 		playerVariables[playerid][pMoney]-=bet;
 		playerVariables[enemyid][pMoney]+=bet;
	  }
	  else if (Winner==0)
	  {
	    format(string,sizeof(string),"{A80000}RTD: {FFFFFF}Egalitate...",bet);
		SendClientMessage(playerid,0xFFFFFF,string);
		format(string,sizeof(string),"{A80000}RTD: {FFFFFF}Egalitate...",bet);
		SendClientMessage(enemyid,0xFFFFFF,string);
	  }
    }
  }
  else
  {
    SendClientMessage(playerid, 0xFFFFFF, "{A80000}RTD: {FFFFFF}Acest player nu te-a invitat la zaruri...");
  }
}
}

//=========================================================================
i have some errors
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)