Jump to content

Comanda [/dice]


StarRo
 Share

Recommended Posts

Comanda /dice

 

News-uri :

 

 

new diceinvited[MAX_PLAYERS]=255, bet;

Comanda:

CMD:dice(playerid, params[]){
new enemyid;
new MyName[MAX_PLAYER_NAME], string2[24+MAX_PLAYER_NAME];
GetPlayerName(playerid, MyName, sizeof(MyName));
 if(!IsPlayerInRangeOfPoint(playerid, 100, 2016.2699,1017.7790,996.8750)) return SendClientMessage(playerid, COLOR_WHITE,"{FFB870}Nu te afli in casino!");
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, "{FFFFFF}Nu poti paria doar 1$.");
 }
 else if (bet>5000000)
 {
SendClientMessage(playerid, 0xFFFFFF, "{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),"{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),"{FFFFFF}%s a fost invitat la zaruri.", HisName);
 SendClientMessage(playerid,0xFFFFFF,string);
 format(string,sizeof(string),"{FFFFFF}Ai fost invitat la niste zaruri de catre %s, suma : %i$", MyName, bet);
 SendClientMessage(enemyid,0xFFFFFF,string);
   format(string,sizeof(string),"{FFFFFF}Accepta folosind comanda [/acceptdice <playerid>]");
 SendClientMessage(enemyid,0xFFFFFF,string);
 format(string2,sizeof(string2),"%s",MyName);
 diceinvited[enemyid]=GetPlayerID(string2);
}
 }
}
else
{
 SendClientMessage(playerid, 0xFFFFFF, "{FFFFFF}Nu te poti invita singur.");
}
  }
  else
  {
    SendClientMessage(playerid, 0xFFFFFF, "{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),"{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),"{FFFFFF}Numarul tau este %i iar al lui este %i.", MyNumber[playerid], MyNumber[enemyid]);
 SendClientMessage(playerid,0xFFFFFF,string);
 format(string,sizeof(string),"{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),"{FFFFFF}Ai castigat %d$", bet*2);
SendClientMessage(playerid,0xFFFFFF,string);
format(string,sizeof(string),"{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),"{FFFFFF}Ai pierdut %d$", bet);
SendClientMessage(playerid,0xFFFFFF,string);
format(string,sizeof(string),"{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),"{FFFFFF}Egalitate...",bet);
SendClientMessage(playerid,0xFFFFFF,string);
format(string,sizeof(string),"{FFFFFF}Egalitate...",bet);
SendClientMessage(enemyid,0xFFFFFF,string);
 }
    }
  }
  else
  {
    SendClientMessage(playerid, 0xFFFFFF, "{FFFFFF}Acest player nu te-a invitat la zaruri...");
  }
}
}

 

Link to comment
Share on other sites

  • 2 weeks later...
Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.