Jump to content

Comanda /dice


Lazar William
 Share

Recommended Posts

CMD:dice(playerid, params[]){

new bet;

if (sscanf(params, "i",bet))

{

SendClientMessage(playerid,MSGCMDS_COLOR, "Cum se foloseste: /dice <cat vrei sa pariezi>");

}

else

{

if (bet<1)

{

SendClientMessage(playerid,MSGFAIL_COLOR, "RTD: Trebuie sa pariezi o suma mai mare de 10.000$.");

}

else if (bet>1000000)

{

SendClientMessage(playerid,MSGFAIL_COLOR, "RTD: Limita admisa este de 1.000.000$.");

}

else if(bet>10000)

{

new Cash=GetPlayerMoney(playerid);

if (Cash<bet)

{

new string[128];

format(string,sizeof(string),"RTD: Nu ai destui bani, ai doar: $%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),"RTD: Primul numar: %d %d",NumberDrawn11,NumberDrawn12);

SendClientMessage(playerid,MSGINFO_COLOR,string);

format(string,sizeof(string),"RTD: Al doilea numar: %d %d",NumberDrawn21,NumberDrawn22);

SendClientMessage(playerid,MSGINFO_COLOR,string);

if (Winner==1)

{

if (NumberDouble1>0)

{

format(string,sizeof(string),"RTD: Ai castigat $%d, o dubla!",bet*2);

SendClientMessage(playerid,MSGSUCC_COLOR,string);

SetPVarInt(playerid,"Money",GetPVarInt(playerid,"Money")+bet*2);

GivePlayerMoney(playerid,bet*2);

}

else

{

format(string,sizeof(string),"RTD: Ai castigat $%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),"RTD: Ai pierdut $%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;

}

Link to comment
Share on other sites

Mersi si e filterscript asta nu ?

 

 

C:\Users\William\Desktop\server\filterscripts\dice.pwn(1) : warning 203: symbol is never used: "dice"
C:\Users\William\Desktop\server\filterscripts\dice.pwn(1 -- 87) : error 013: no entry point (no public functions)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
 
 
1 Error.
Edited by .MaFioTTul
Link to comment
Share on other sites

CMD:dice(playerid, params[]){

new bet;

if (sscanf(params, "i",bet))

{

SendClientMessage(playerid,MSGCMDS_COLOR, "Cum se foloseste: /dice <cat vrei sa pariezi>");

}

else

{

if (bet<1)

{

SendClientMessage(playerid,MSGFAIL_COLOR, "RTD: Trebuie sa pariezi o suma mai mare de 10.000$.");

}

else if (bet>1000000)

{

SendClientMessage(playerid,MSGFAIL_COLOR, "RTD: Limita admisa este de 1.000.000$.");

}

else if(bet>10000)

{

new Cash=GetPlayerMoney(playerid);

if (Cash<bet)

{

new string[128];

format(string,sizeof(string),"RTD: Nu ai destui bani, ai doar: $%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),"RTD: Primul numar: %d %d",NumberDrawn11,NumberDrawn12);

SendClientMessage(playerid,MSGINFO_COLOR,string);

format(string,sizeof(string),"RTD: Al doilea numar: %d %d",NumberDrawn21,NumberDrawn22);

SendClientMessage(playerid,MSGINFO_COLOR,string);

if (Winner==1)

{

if (NumberDouble1>0)

{

format(string,sizeof(string),"RTD: Ai castigat $%d, o dubla!",bet*2);

SendClientMessage(playerid,MSGSUCC_COLOR,string);

SetPVarInt(playerid,"Money",GetPVarInt(playerid,"Money")+bet*2);

GivePlayerMoney(playerid,bet*2);

}

else

{

format(string,sizeof(string),"RTD: Ai castigat $%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),"RTD: Ai pierdut $%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;

}

Imi poti zice unde bag asta ? Adica in gm ceva! ZCMd il am in gm si in pawno includes

Link to comment
Share on other sites

Pune asta la forward's.

 

forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);

 

Acum creezi comanda.

if(strcmp(cmd, "/dice", true) == 0){
   if(IsPlayerConnected(playerid))
   {
new dice = random(6)+1;
if (gDice[playerid] == 1)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "%s a dat cu zarurile %d", sendername,dice);
ProxDetector(5.0, playerid, string, TEAM_GREEN_COLOR,TEAM_GREEN_COLOR,TEAM_GREEN_COLOR,TEAM_GREEN_COLOR,TEAM_GREEN_COLOR);
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, "Nu ai zaruri (poti cumpara din orice 24/7).");
return 1;
}
}
return 1;
}

Aceasta comanda este una simpla, fara /dice [nume] [pret]. Daca vrei sa-ti faci comanda cu pret cand dai /dice, foloseste-te de comanda celui care a postat mai sus.

Edited by Recycle
Link to comment
Share on other sites


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...");
  }
}
}

 

  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 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.