PLEASE, HELP LOTTERY
#1

[B] Use this code to the script lottery but not the best. I wish the extraction goes by [COLOR = "# FF0000"] 10k [/ COLOR] to the [COLOR = "# FF0000"] 70k [/ COLOR] and it happens every time, also if I type [COLOR = "# FF0000" ] / ticket [/ COLOR] to buy out a screen where you enter the number you want to play, I would like that the screen does not appear that you were playing, but writing it like this: / ticket <number>. Thank you.

Код:
#include <a_samp>
#include <sscanf2>
//===================================DEFINE
#define DIALOGLOTTERIA 10004
#define COMANDOBIGLIETTO "/biglietto"
#define VINCITABASE 10000
#define VINCITAEXTRA 60000
#define MINUTIESTRAZIONE 5
#define COSTOBIGLIETTO 75
//==================================VERIABILI
new Biglietto[MAX_PLAYERS]=0;
new stringa[256];
new nome[20];
new numerofortunato;
new vincita;
//============================================================ONFILTERSCRIPTINIT
//===============================================================ONPLAYERCONNECT
public OnPlayerConnect(playerid)
{
	format(stringa,sizeof(stringa),"LOTTERIA: {FFFFFF}Se vuoi comprare un biglietto digita {C14124}%s{FFFFFF}.",COMANDOBIGLIETTO);
	SendClientMessage(playerid,0x338CD9FF,stringa);
	return 1;
}
//============================================================ONPLAYERDISCONNECT
public OnPlayerDisconnect(playerid, reason)
{
	Biglietto[playerid]=0;
	return 1;
}
//===========================================================ONPLAYERCOMMANDTEXT
public OnPlayerCommandText(playerid, cmdtext[])
{
	new params[128], ticket;
	if(strcmp(COMANDOBIGLIETTO, cmdtext, true, 10) == 0)
	{
		if(sscanf(params, "i", ticket)) return SendClientMessage(playerid, -1, "USO: /biglietto [1-90]");
		{
			if(ticket > 90 || ticket < 1) return SendClientMessage(playerid, -1, "Inserisci un valore da 1 a 90!");
			Biglietto[playerid] = ticket;
			format(stringa, sizeof(stringa), "Hai acquistato il biglietto %i", ticket);
			SendClientMessage(playerid, -1, stringa);
		}
		return 1;
	}
	return 0;
}

//====================================================================ESTRAZIONE
forward Estrazione();
public Estrazione()
{
 numerofortunato=random(90);
 new a=0;
 for(new i=0;i<MAX_PLAYERS;i++)
 {
  if(Biglietto[i]==numerofortunato)
  {
  GetPlayerName(i,nome,sizeof(nome));
  vincita=VINCITABASE+random(VINCITAEXTRA);
  GivePlayerMoney(i,vincita);
  a=1;
  }
  Biglietto[i]=0;
 }
 if(a==1)
 {
 format(stringa,sizeof(stringa),"LOTTERIA: {8CE46C}%s{FFFFFF} vince {C14124}%d{FFFFFF}$ con l'estrazione del numero {C14124}%d{FFFFFF}.",nome,vincita,numerofortunato);
 SendClientMessageToAll(0x338CD9FF,stringa);
 return 1;
 }
 else
 {
 format(stringa,sizeof(stringa),"LOTTERIA: il numero estratto и {C14124}%d{FFFFFF}, ma nessuno ha vinto.",numerofortunato);
 SendClientMessageToAll(0x338CD9FF,stringa);
 }
 return 1;
}
//=====================================================================ISNUMERIC
stock isNumeric(const string[])
{
	new length=strlen(string);
	if (length==0) return false;
	for (new i = 0; i < length; i++)
	{
	if
	((string[i] > '9' || string[i] < '0' && string[i]!='-' && string[i]!='+') || (string[i]=='-' && i!=0)|| (string[i]=='+' && i!=0))
    return false;
	}
	if (length==1 && (string[0]=='-' || string[0]=='+')) return false;
	return true;
}
Reply
#2

Sorry, but I don't really understand this.
If you have trouble with English, I recommend posting it in your First language's Sub-forum.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)