Jump to content
  • 0

Nu imi da banii


VladDz.

Question

6 answers to this question

Recommended Posts

  • 0
3 minutes ago, catalin9325 said:

Trebuie sa modific dupa gamemode-ul , adica cum este definit de exp la Fs-ul asta poate fi : pBani , iar la tine pMoney ! Verifica , ce am mentionat , bafta ! +1 daca ti-am fost de folos .

La mine in gm e GivePlayerCash, in fs e GivePlayerMoney, am modificat in cash si imi da eririle astea:
error 017: undefined symbol "GivePlayerCash""

sal

Link to comment
Share on other sites

  • 0
3 minutes ago, catalin9325 said:

 

Scrie asa la inceput la FS , new GivePlayerCash;

C:\xampp\htdocs\rif\samp03\filterscripts\lottery.pwn(365) : error 012: invalid function call, not a valid address
C:\xampp\htdocs\rif\samp03\filterscripts\lottery.pwn(365) : warning 215: expression has no effect
C:\xampp\htdocs\rif\samp03\filterscripts\lottery.pwn(365) : warning 215: expression has no effect
C:\xampp\htdocs\rif\samp03\filterscripts\lottery.pwn(365) : error 001: expected token: ";", but found ")"
C:\xampp\htdocs\rif\samp03\filterscripts\lottery.pwn(365) : error 029: invalid expression, assumed zero
C:\xampp\htdocs\rif\samp03\filterscripts\lottery.pwn(365) : fatal error 107: too many error messages on one line

FS: 

#include <a_samp>
#include <zcmd>

#define MIN_BET 100
#define MAX_BET 50000

#define TIME_BETWEEN_NUMBERS 2000     //(1000 = 1 second)

#define DEFAULT_JACKPOT 1000000     // In case a player wins the Jackpot, it will get reset to this amount.
#define JACKPOT_MULTIPLIER 3    // Players bet will be multiplied by this amount and added to the jackpot.
								//For example: if JACKPOT_MULTIPLIER is set to '3' and a player bets $1200,  $3600 will be added to the jackpot.

#define FILE_PATH "LotteryJackpot.ini"

#define HELP_DIALOG 28503

new Float:RM[11] =   // Reward Multiplier
{
	0.0,    // 0 matches
	0.5,  	// 1 match
	1.0,	// 2 matches
	2.0,    // 3 matches
	4.0,    // 4 matches
	8.0,   	// 5 matches
	16.0, 	// 6 matches
	32.0,  	// 7 matches
	64.0,  	// 8 matches
	128.0,  // 9 matches
		   	// 10 matches will get the jackpot, defined somewhere else.
};

new GivePlayerCash;
//PlayerTextdraws
new PlayerText:TD[MAX_PLAYERS][100];   		// 100x PlayerTextDraws for the numbers (0-99)
new PlayerText:TDHeader[MAX_PLAYERS];  		// PlayerTextDraw for Header  (Either "Lottery", "Winner" or "Loser");
new PlayerText:TDPrize[MAX_PLAYERS][2];		// 2x PlayerTextDraws for showing the rewards  0 = left side (1 to 5 matches),  1 = right side (6 to 10 matches)
new PrizeString[MAX_PLAYERS][2][128];       // These strings will hold the info for above Reward-Textdraws.

new PlayerText:TDBet[MAX_PLAYERS];          // PlayerTextDraw that shows the players current bet
new PlayerText:TDNumber[MAX_PLAYERS];       // PlayerTextDraw that shows the current random drawn number
new PlayerText:TDDots[MAX_PLAYERS][10];     // 10x PlayerTextDraws for the circles, encircling the drawn numbers
new PlayerText:TDError[MAX_PLAYERS];        // PlayerTextDraw that will show different Error-Messages.

//Global Textdraws
new Text:gTD[34];                           // 33 TextDraws for the main design (Main background, out-/inner-lines, header-background, reset- & help-button.

//Buttons
new Text:TDLowerBet;                        // TextDraw for the Lower-bet button
new Text:TDRaiseBet;                        // TextDraw for the Raise-bet button
new Text:TDStart;                           // TextDraw for the PLAY-button
new Text:TDClose;                           // TextDraw for the CLOSE-button

//Booleans
new bool:TDSelected[MAX_PLAYERS][100];      // 100x Boolean to check if player has selected/deselected a certain number on his lottery-card.
new bool:AreTDCreated[MAX_PLAYERS];         // Boolean to check if the TextDraws are created for the player.
new bool:AreDotsCreated[MAX_PLAYERS];       // Boolean to check if all 10 Circle-TextDraws are created.

//Variables
new Jackpot;                                // This variable will hold the current Jackpot.

//Timers
new RandomNumbersTimer[MAX_PLAYERS];        // Timer that shows fast random numbers before revealing the 'REAL' number. On default it does 20 loops of 50ms = 1 second.
new LotteryTimer[MAX_PLAYERS];              // Timer that will trigger the process to pick the next random number.

//Other Arrays:
new Bet[MAX_PLAYERS];                       // This array will hold each players current bet.
new LotteryStage[MAX_PLAYERS];              // This array will hold the progress for each player during the whole Lottery-process.
new SelectedNumbers[MAX_PLAYERS];           // This array will count how many numbers each player has selected on his lottery-card.
new RandomNumbersCount[MAX_PLAYERS];        // This array is used to count the number of fast random numbers that are shows before the 'REAL' number is revealed. Used to kill the timer when reaches 20  (x 50ms = 1 second).
new LotteryNumbers[MAX_PLAYERS][10];        // This array will store the final numbers generated by the server for each player.
new LotteryNumbersPicked[MAX_PLAYERS];      // This array will count how many numbers have been picked by the server.
new Lot[MAX_PLAYERS][10];                   // This array will store the numbers selected by each player.
new Matches[MAX_PLAYERS];                   // This array will count how many matches the player got during the drawing.


// Main Callbacks
public OnFilterScriptInit()
{
	CreateGlobalTextDraws();                // Create Global Textdraws
	for(new i; i<MAX_PLAYERS; i++) 			// Loop through the online players
	{
		LotteryStage[i] = -1;               // Reset info
	    if(IsPlayerConnected(i))
	    {
	        for(new j; j<10; j++)
	        {
	        	LotteryNumbers[i][j] = -1;	// Reset info
	        	Lot[i][j] = -1;             // Reset info
			}
	        Bet[i] = MIN_BET;               // Set players bet to minimal bet
	        CreatePlayerTextDraws(i);       // Create the PlayerTextDraw
			LotteryNumbersPicked[i] = 0;    // Reset info
		}
	}
 	new File:file;
    if (!fexist(FILE_PATH))                 // Check if Jackpot-file not exists
    {
    	file = fopen(FILE_PATH,io_write);   // Create new file
    	new str[12];
    	format(str, 12, "%d", DEFAULT_JACKPOT);
    	fwrite(file, str);                  // Write default jackpot value to file
    	fclose(file);                       // Close file
    	Jackpot = DEFAULT_JACKPOT;          // Set Jackpot-variable to default value
	}
	else                                    // ..if the file already exists..
	{
	    file=fopen(FILE_PATH, io_read);     // Open the file
		new str[12];
	 	while(fread(file, str))             // Read the value from the file
	 	{
			Jackpot = strval(str);          // Assign the value from the file to the Jackpot-variable
		}
		fclose(file);                       // Close the file
	}
	print("\n--------------------------------------");
	print(" Lottery Filterscript by Schneider");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	for(new i; i<MAX_PLAYERS; i++)          			// Loop through the online players (in case this filterscript gets unloaded before server is shut down)
	{
	    if(AreTDCreated[i] == true)         			// Check if PlayerTextDraws are created
	    {
	        for(new j; j<100; j++)
			{
				PlayerTextDrawDestroy(i, TD[i][j]);     // Destroy all 100 numbers
			}
			PlayerTextDrawDestroy(i, TDPrize[i][0]);    // Destroy PlayerTextDraw
			PlayerTextDrawDestroy(i, TDPrize[i][1]);    // Destroy PlayerTextDraw
			PlayerTextDrawDestroy(i, TDBet[i]);         // Destroy PlayerTextDraw
			PlayerTextDrawDestroy(i, TDNumber[i]);      // Destroy PlayerTextDraw
			PlayerTextDrawDestroy(i, TDHeader[i]);      // Destroy PlayerTextDraw
			PlayerTextDrawDestroy(i, TDError[i]);       // Destroy PlayerTextDraw
			for(new j; j<10; j++)
			{
			    PlayerTextDrawDestroy(i, TDDots[i][j]); // Destroy the 10 circles
			}
		}
	}
	for(new i=0; i<sizeof(gTD); i++)
	{
	 	TextDrawDestroy(gTD[i]);                        // Destroy global Textdraws
	}
	TextDrawDestroy(TDLowerBet);                        // Destroy Button Textdraw
	TextDrawDestroy(TDRaiseBet);                        // Destroy Button Textdraw
	TextDrawDestroy(TDStart);                           // Destroy Button Textdraw
	TextDrawDestroy(TDClose);                           // Destroy Button Textdraw
	return 1;
}

public OnPlayerConnect(playerid)
{
    LotteryStage[playerid] = -1;			// Reset playerinfo
	Bet[playerid] = MIN_BET;                // Reset playerinfo
	SelectedNumbers[playerid] = 0;          // Reset playerinfo
	RandomNumbersCount[playerid] = 0;       // Reset playerinfo
	LotteryNumbersPicked[playerid] = 0;     // Reset playerinfo
	
	for(new j; j<10; j++)
    {
      	LotteryNumbers[playerid][j] = -1;   // Reset playerinfo
      	Lot[playerid][j] = -1;              // Reset playerinfo
	}

 	CreatePlayerTextDraws(playerid);        // Create PlayerTextDraws
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	if(AreTDCreated[playerid] == true)      						// Delete PlayerTextDraws if they are created
	{
	    for(new i; i<100; i++)
		{
			PlayerTextDrawDestroy(playerid, TD[playerid][i]);   	// Destroy PlayerTextDraw
		}
		for(new j; j<10; j++)
		{
		    PlayerTextDrawDestroy(playerid, TDDots[playerid][j]);   // Destroy PlayerTextDraw
		}
		PlayerTextDrawDestroy(playerid, TDPrize[playerid][0]);      // Destroy PlayerTextDraw
		PlayerTextDrawDestroy(playerid, TDPrize[playerid][1]);      // Destroy PlayerTextDraw
		PlayerTextDrawDestroy(playerid, TDBet[playerid]);       	// Destroy PlayerTextDraw
		PlayerTextDrawDestroy(playerid, TDNumber[playerid]);        // Destroy PlayerTextDraw
		PlayerTextDrawDestroy(playerid, TDHeader[playerid]);        // Destroy PlayerTextDraw
		PlayerTextDrawDestroy(playerid, TDError[playerid]);     	// Destroy PlayerTextDraw
		AreTDCreated[playerid] = false;                             // Reset playerinfo
	}
	return 1;
}


public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid)
{
	if((LotteryStage[playerid] == 0))                                           // Check if player is in first stage (Stage 0 = Player is able to select numbers)
	{
	    if(AreDotsCreated[playerid] == true)                                    // Check if the player has already played a game, so we can reset screen
		{                                  
			for(new i; i<10; i++)
	   		{
				PlayerTextDrawDestroy(playerid, TDDots[playerid][i]);           // Destroy the circles around the numbers from previous drawing.
			}
			AreDotsCreated[playerid] = false;                                   // Reset player info
			PlayerTextDrawHide(playerid, TDHeader[playerid]);                   // Hide Header-TextDraw
			PlayerTextDrawSetString(playerid, TDHeader[playerid], "~w~Lottery");// Change the Header-Text to "Lottery";
			PlayerTextDrawShow(playerid, TDHeader[playerid]);                   // Show the Header-TextDraw
			
			PlayerTextDrawHide(playerid, TDPrize[playerid][0]);                 // Hide left reward-textdraw
			PlayerTextDrawHide(playerid, TDPrize[playerid][1]);                 // Hide right reward-textdraw
			new b = Bet[playerid];                                              // Just for shorter writing, store the players bet in a new variable
			format(PrizeString[playerid][0], 128, "01: $%d~n~02: $%d~n~03: $%d~n~04: $%d~n~05: $%d", floatround(b*RM[1]), floatround(b*RM[2]), floatround(b*RM[3]), floatround(b*RM[4]), floatround(b*RM[5]));  // Format left reward-textdraw, showing the possible rewards based on the players bet.
			format(PrizeString[playerid][1], 128, "$%d :06 ~n~$%d :07 ~n~$%d :08 ~n~$%d :09 ~n~$%d :10", floatround(b*RM[6]), floatround(b*RM[7]), floatround(b*RM[8]), floatround(b*RM[9]), Jackpot);  		// Format right reward-textdraw, showing the possible rewards based on the players bet.
			PlayerTextDrawSetString(playerid, TDPrize[playerid][0], PrizeString[playerid][0]);  // Set string
			PlayerTextDrawSetString(playerid, TDPrize[playerid][1], PrizeString[playerid][1]);  // Set string
			PlayerTextDrawShow(playerid, TDPrize[playerid][0]);                 // Show updated rewards-textdraw
			PlayerTextDrawShow(playerid, TDPrize[playerid][1]);                 // Show updated rewards-textdraw

			PlayerTextDrawHide(playerid, TDNumber[playerid]);                   // Hide the TextDraw that showed the last drawn number
			PlayerTextDrawSetString(playerid, TDNumber[playerid], "  ");        // Change the text to an empty string
			PlayerTextDrawShow(playerid, TDNumber[playerid]);                   // Show the  Textdraw
			PlayerPlaySound(playerid, 1184, 0.0, 0.0, 0.0);                     // Stop the music that is started when player wins the jackpot
		}
		new td;                                                                 // This variable will hold the number the player clicks
	    for(new j; j<100; j++)                                                  // Loop through all 100 Number-textdraw
		{
	    	if(playertextid == TD[playerid][j])                                 // Check on which number the player clicked
	    	{
	    	 	td = j;                                                         // Store the number in td-variable.
	    	    break;                                                          // Stop the loop
			}
		}
		PlayerTextDrawHide(playerid, TD[playerid][td]);                         // Hide the clicked number
		if(TDSelected[playerid][td] == false)                                   // Check if the number was NOT selected yet
		{
		    if(SelectedNumbers[playerid] == 10)                                 // Check if the player has already selected 10 numbers (so we can give him an error).
		    {
		        PlayerTextDrawHide(playerid, TDHeader[playerid]);               // Temporarily hide the header (showing "Lottery")
				PlayerTextDrawHide(playerid, TDError[playerid]);                // Hide Error Message (in case an error was already showing)
				PlayerTextDrawSetString(playerid, TDError[playerid], "~r~[Error] ~n~~w~You have already selected ~r~10 ~w~numbers!~n~Press ~g~PLAY ~w~to start!"); // Format an error-message
				PlayerTextDrawShow(playerid, TDError[playerid]);                // Show the error message
				SetTimerEx("HideError", 3500, 0, "u", playerid);                // Start timer to hide the Error-message and show the Lottery-header
			}
			else                                                                // ...if player has not selected 10 numbers yet.
			{
				PlayerTextDrawColor(playerid,TD[playerid][td], 0x46F255FF);     // Change the number-color to green
				TDSelected[playerid][td] = true;                                // Switch the boolean to true.   (= selected)
				new slot = GetFreeSlot(playerid);                               // Get a free slot in the Lots[playerid]-array.
				if(slot != -1)                                                  // Check if no invalid slot has been returned
				{
					Lot[playerid][slot] = td;                                   // Store the selected number in the free slot in the players' Lot-array
				}
				SelectedNumbers[playerid]++;                                    // Increae the number of selected numbers by 1
			}
		}
		else                                                                    // ... else if the number was already selected by the player
		{
		    PlayerTextDrawColor(playerid,TD[playerid][td], 0xD1D1D1FF);         // Change the number-color to grey
		    TDSelected[playerid][td] = false;                                   // Switch the boolean to false  (= not selected)
			new slot = FindSlot(playerid, td);                                  // Find in which slot the number was stored in the players Lot-array
			if(slot != -1)
			{
			    Lot[playerid][slot] = -1;                                       // Free up the slot
			}
		    SelectedNumbers[playerid]--;                                        // Decrease the number of selected numbers by 1
		}
		PlayerTextDrawShow(playerid, TD[playerid][td]);                         // Show the updated number-textdraw
	}
    return 1;
}

public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
	if((_:clickedid != INVALID_TEXT_DRAW) && (LotteryStage[playerid] == 0))     // Check if player is in Stage 0 and if the player has not pressed ESC
	{
	    if(AreDotsCreated[playerid] == true)                                    // Same as above... if the player has already finished a game, the screen will be reset for a new game
	    {
		    for(new i; i<10; i++)
	   		{
				PlayerTextDrawDestroy(playerid, TDDots[playerid][i]);           // Destroy the circles from previous game
			}
			AreDotsCreated[playerid] = false;                                   // Reset player info
			PlayerTextDrawHide(playerid, TDHeader[playerid]);                   // Hide the header
			PlayerTextDrawSetString(playerid, TDHeader[playerid], "~w~Lottery");// Change header text back to "Lottery"
			PlayerTextDrawShow(playerid, TDHeader[playerid]);                   // Show updated header
			
			PlayerTextDrawHide(playerid, TDPrize[playerid][0]);                 // Hide left reward-textdraw
			PlayerTextDrawHide(playerid, TDPrize[playerid][1]);                 // Hide right reward-textdraw
			new b = Bet[playerid];                                              // Just for shorter writing, store the players bet in a new variable
			format(PrizeString[playerid][0], 128, "01: $%d~n~02: $%d~n~03: $%d~n~04: $%d~n~05: $%d", floatround(b*RM[1]), floatround(b*RM[2]), floatround(b*RM[3]), floatround(b*RM[4]), floatround(b*RM[5]));  // Format left reward-textdraw, showing the possible rewards based on the players bet.
			format(PrizeString[playerid][1], 128, "$%d :06 ~n~$%d :07 ~n~$%d :08 ~n~$%d :09 ~n~$%d :10", floatround(b*RM[6]), floatround(b*RM[7]), floatround(b*RM[8]), floatround(b*RM[9]), Jackpot);  		// Format right reward-textdraw, showing the possible rewards based on the players bet.
			PlayerTextDrawSetString(playerid, TDPrize[playerid][0], PrizeString[playerid][0]);  // Set string
			PlayerTextDrawSetString(playerid, TDPrize[playerid][1], PrizeString[playerid][1]);  // Set string
			PlayerTextDrawShow(playerid, TDPrize[playerid][0]);                 // Show updated rewards-textdraw
			PlayerTextDrawShow(playerid, TDPrize[playerid][1]);                 // Show updated rewards-textdraw

			PlayerTextDrawHide(playerid, TDNumber[playerid]);                   // Hide last drawn number-textdraw
			PlayerTextDrawSetString(playerid, TDNumber[playerid], "  ");        // Empty the string
			PlayerTextDrawShow(playerid, TDNumber[playerid]);                   // Show updated textdraw
			
 			PlayerPlaySound(playerid, 1184, 0.0, 0.0, 0.0);                     // Stop the music that is started when player wins the jackpot
		}
		
		if(clickedid == TDLowerBet)                                             // If player clicked the Lower-bet button
		{
		    if(Bet[playerid] > MIN_BET)                                         // Check if the players bet is still higher than MIN_BET
			{
			    new str[8];
			    Bet[playerid] -= 100;                                           // Subtract $100 from the players' bet
			    format(str, sizeof(str), "$%d", Bet[playerid]);
				PlayerTextDrawHide(playerid, TDBet[playerid]);                  // Hide the bet-textdraw
				PlayerTextDrawSetString(playerid, TDBet[playerid], str);        // Update the textdraw string
				PlayerTextDrawShow(playerid, TDBet[playerid]);                  // Show the updated bet-textdraw
				
				new b = Bet[playerid];                                          // For shorter writing, store players' current bet in new variable
				format(PrizeString[playerid][0], 128, "01: $%d~n~02: $%d~n~03: $%d~n~04: $%d~n~05: $%d", floatround(b*RM[1]), floatround(b*RM[2]), floatround(b*RM[3]), floatround(b*RM[4]), floatround(b*RM[5]));  // Format left reward-textdraw, showing the possible rewards based on the players bet.
				format(PrizeString[playerid][1], 128, "$%d :06 ~n~$%d :07 ~n~$%d :08 ~n~$%d :09 ~n~$%d :10", floatround(b*RM[6]), floatround(b*RM[7]), floatround(b*RM[8]), floatround(b*RM[9]), Jackpot);          // Format right reward-textdraw, showing the possible rewards based on the players bet.
				PlayerTextDrawSetString(playerid, TDPrize[playerid][0], PrizeString[playerid][0]);      // Update reward-textdraw
				PlayerTextDrawSetString(playerid, TDPrize[playerid][1], PrizeString[playerid][1]);      // Update reward-textdraw
				PlayerTextDrawShow(playerid, TDPrize[playerid][0]);
		   		PlayerTextDrawShow(playerid, TDPrize[playerid][1]);
			}
		}
		if(clickedid == TDRaiseBet)                                             // Same as above... but raise the bet by $100 instead of decrease.
		{
		    if(Bet[playerid] < MAX_BET)
			{
			    new str[8];
			    Bet[playerid] += 100;                                           // Add $100 to the players' bet
			    format(str, sizeof(str), "$%d", Bet[playerid]);
				PlayerTextDrawHide(playerid, TDBet[playerid]);
				PlayerTextDrawSetString(playerid, TDBet[playerid], str);
				PlayerTextDrawShow(playerid, TDBet[playerid]);
				new b = Bet[playerid];
				format(PrizeString[playerid][0], 128, "01: $%d~n~02: $%d~n~03: $%d~n~04: $%d~n~05: $%d", floatround(b*RM[1]), floatround(b*RM[2]), floatround(b*RM[3]), floatround(b*RM[4]), floatround(b*RM[5]));
				format(PrizeString[playerid][1], 128, "$%d :06 ~n~$%d :07 ~n~$%d :08 ~n~$%d :09 ~n~$%d :10", floatround(b*RM[6]), floatround(b*RM[7]), floatround(b*RM[8]), floatround(b*RM[9]), Jackpot);
				PlayerTextDrawSetString(playerid, TDPrize[playerid][0], PrizeString[playerid][0]);
				PlayerTextDrawSetString(playerid, TDPrize[playerid][1], PrizeString[playerid][1]);
				PlayerTextDrawShow(playerid, TDPrize[playerid][0]);
  				PlayerTextDrawShow(playerid, TDPrize[playerid][1]);
			}
		}
		if(clickedid == TDStart)                                                // If the player clicked the PLAY-button
		{
		    if(SelectedNumbers[playerid] != 10)                                 // Check if player has NOT selected 10 numbers yet. Give him error in that case.
			{
			    PlayerTextDrawHide(playerid, TDHeader[playerid]);
		        PlayerTextDrawHide(playerid, TDError[playerid]);
				PlayerTextDrawSetString(playerid, TDError[playerid], "~r~[Error] ~n~~w~You first have to select ~r~10 ~w~numbers!");
				PlayerTextDrawShow(playerid, TDError[playerid]);
				SetTimerEx("HideError", 3500, 0, "u", playerid);
			}
			else if(GetPlayerMoney(playerid) < Bet[playerid])                   // Check if player has NOT enough money. Give him error in that case.
			{
				PlayerTextDrawHide(playerid, TDHeader[playerid]);
		        PlayerTextDrawHide(playerid, TDError[playerid]);
				PlayerTextDrawSetString(playerid, TDError[playerid], "~r~[Error] ~n~~w~You do not have enough money.");
				PlayerTextDrawShow(playerid, TDError[playerid]);
				SetTimerEx("HideError", 3500, 0, "u", playerid);
			}
			else                                                                // If the player has selected 10 numbers and has enough money:
			{
  			    GivePlayerCash(playerid, -Bet[playerid]);                      // Remove the bet from the players' money
			    Jackpot += (Bet[playerid]*JACKPOT_MULTIPLIER);                  // Increase the jackpot by the players bet, multiplied with the defined multiplier (at top of script)
			    new File:file;
			    if (fexist(FILE_PATH))
			    {
			    	file = fopen(FILE_PATH,io_write);
			    	new str[12];
			    	format(str, 12, "%d", Jackpot);
			    	fwrite(file, str);                                          // Update the Jackpot-value in the file
			    	fclose(file);
				}
			    LotteryStage[playerid] = 1;                                     // Set the players stage to '1' (= show fast random numbers)
			    LotteryTimer[playerid] = SetTimerEx("Lottery", 50, 0, "u", playerid);   // Start timer to start the lottery.
			    CancelSelectTextDraw(playerid);                                 // Remove the cursor
			    TogglePlayerControllable(playerid, 0);                          // Freeze the player
			    RandomNumbersCount[playerid] = 0;                               // Reset player info
			}
		}
		if(clickedid == TDClose)                                                // If player clicked the CLOSE-button
		{
	        HideTDForPlayer(playerid);                                          // Hide all textdraws
	        TogglePlayerControllable(playerid, 1);                              // Unfreeze the player
	        CancelSelectTextDraw(playerid);                                     // Remove the cursor
		}
		if(clickedid == gTD[10])  												// If player clicked the Reset-Button
		{
		    Bet[playerid] = MIN_BET;                                            // Reset players' bet to default min-value
		    new b = Bet[playerid];                                              // For short writing, store players bet in new variable
		    format(PrizeString[playerid][0], 128, "01: $%d~n~02: $%d~n~03: $%d~n~04: $%d~n~05: $%d", floatround(b*RM[1]), floatround(b*RM[2]), floatround(b*RM[3]), floatround(b*RM[4]), floatround(b*RM[5]));  // Update the left rewards-textdraw string
			format(PrizeString[playerid][1], 128, "$%d :06 ~n~$%d :07 ~n~$%d :08 ~n~$%d :09 ~n~$%d :10", floatround(b*RM[6]), floatround(b*RM[7]), floatround(b*RM[8]), floatround(b*RM[9]), Jackpot);          // Update the right rewards-textdraw string
			PlayerTextDrawSetString(playerid, TDPrize[playerid][0], PrizeString[playerid][0]);
			PlayerTextDrawSetString(playerid, TDPrize[playerid][1], PrizeString[playerid][1]);
			PlayerTextDrawShow(playerid, TDPrize[playerid][0]);                 // Show updated rewards-textdraw
		    PlayerTextDrawShow(playerid, TDPrize[playerid][1]);                 // Show updated rewards-textdraw
		    
		    new str[8];
		    format(str, sizeof(str), "$%d", Bet[playerid]);                     // Update bet-textdraw
		    PlayerTextDrawHide(playerid, TDBet[playerid]);
			PlayerTextDrawSetString(playerid, TDBet[playerid], str);
			PlayerTextDrawShow(playerid, TDBet[playerid]);
		    
		    SelectedNumbers[playerid] = 0;                                      // Reset player info
		    
		    for(new i; i<10; i++)
		    {
		        Lot[playerid][i] = -1;                                          // Reset players lot
			}
			for(new i; i<100; i++)
			{
			    PlayerTextDrawHide(playerid, TD[playerid][i]);
			    PlayerTextDrawColor(playerid,TD[playerid][i], 0xD1D1D1FF);      // Change the color of all numbers back to grey
			    PlayerTextDrawShow(playerid, TD[playerid][i]);
			    TDSelected[playerid][i] = false;                                // Reset info
			}
		}
		if(clickedid == gTD[11])   // Clicked Help-Button                       // If player clicked the Help-button
		{
		    new string[800];
		    new string2[300];
            format(string2, sizeof(string2), "\n\nYour selected numbers and bet will be remembered and you can\npress the {FF0000}reset{FFFFFF}-button to restore your game to default settings.\n\nMatch all 10 numbers to win the {FFE882}JACKPOT {FFFFFF}of {FFE882}$%d!\n\n\n\t\t{FFE882}GOOD LUCK!", Jackpot);
		    format(string, sizeof(string), "{FFFFFF}Welcome to the {9BDB76}Lottery Game! \n\n{FFFFFF}To play this game you have to \nselect {E36B73}10 numbers {FFFFFF}of your choise and {E36B73}set your bet.\n{FFFFFF}You can lower/raise your bet by clicking the arrows({E36B73} <  > {FFFFFF})\n\nWhen you are ready, press the {B1FAC0}'PLAY' {FFFFFF}button to start. \n10 random numbers will be drawn and you will\nreceive a prize depending on the amount of matches and your bet.%s", string2);
		    ShowPlayerDialog(playerid, HELP_DIALOG, DIALOG_STYLE_MSGBOX, "Lottery Help", string, "OK", ""); // Show Help-dialog
		}
	}
	
	if((_:clickedid == INVALID_TEXT_DRAW) && (LotteryStage[playerid] == 0))     // If player pressed ESC while in the number-selecting-stage
	{
		HideTDForPlayer(playerid);                                              // Hide all textdraws
		TogglePlayerControllable(playerid, 1);                                  // Unfreeze player
	}
	return 1;
}


COMMAND:lottery(playerid, params[])		                                        //Command: /lottery  to start.
{
	if(LotteryStage[playerid] != -1) return SendClientMessage(playerid, 0xF25D46FF, "{F4C670}[Lottery]: {FFFFFF}You are already playing!");  // Check if player has already opened the Lottery
	LotteryStage[playerid] = 0;                                                 // Set players stage to 0  ( = select numbers)
	new b = Bet[playerid];                                                      // For shorter writing, store players' bet in new variable
	format(PrizeString[playerid][0], 128, "01: $%d~n~02: $%d~n~03: $%d~n~04: $%d~n~05: $%d", floatround(b*RM[1]), floatround(b*RM[2]), floatround(b*RM[3]), floatround(b*RM[4]), floatround(b*RM[5]));
	format(PrizeString[playerid][1], 128, "$%d :06 ~n~$%d :07 ~n~$%d :08 ~n~$%d :09 ~n~$%d :10", floatround(b*RM[6]), floatround(b*RM[7]), floatround(b*RM[8]), floatround(b*RM[9]), Jackpot);
	PlayerTextDrawSetString(playerid, TDPrize[playerid][0], PrizeString[playerid][0]);  // Update rewards-textdraw string
	PlayerTextDrawSetString(playerid, TDPrize[playerid][1], PrizeString[playerid][1]);  // Update rewards-textdraw string
    for(new i; i<sizeof(gTD); i++)
	{
	    TextDrawShowForPlayer(playerid, gTD[i]);                                // Show global textdraws
	}
	for(new i; i<100; i++)
	{
		PlayerTextDrawShow(playerid, TD[playerid][i]);                          // Show the numbers
	}
	PlayerTextDrawShow(playerid, TDPrize[playerid][0]);                         // Show rewards (left)
    PlayerTextDrawShow(playerid, TDPrize[playerid][1]);                         // Show rewards (right)

    PlayerTextDrawShow(playerid, TDNumber[playerid]);
    PlayerTextDrawShow(playerid, TDHeader[playerid]);

    TextDrawShowForPlayer(playerid, TDLowerBet);                                // Show lower-bet button
    TextDrawShowForPlayer(playerid, TDRaiseBet);                                // Show raise-bet button

    TextDrawShowForPlayer(playerid, TDStart);                                   // Show PLAY-button
    TextDrawShowForPlayer(playerid, TDClose);                                   // Show CLOSE-button
    new str[8];
    format(str, sizeof(str), "$%d", Bet[playerid]);                             // Format the bet-textdraw
	PlayerTextDrawSetString(playerid, TDBet[playerid], str);
	PlayerTextDrawShow(playerid, TDBet[playerid]);                              // Show the bet-textdraw

    SelectTextDraw(playerid, 0xFF4040AA);                                       // Show the cursor
	return 1;
}

forward Lottery(playerid);
public Lottery(playerid)                                                        // Main timer
{
	switch(LotteryStage[playerid])                                              // Switch the players stage
	{
	    case 1:   																// Stage 1: Intro showing random nummbers 20x/second
		{
      		RandomNumbersTimer[playerid] = SetTimerEx("ShowRandomNumbers", 50, 1, "u", playerid); // Start 50ms repeating timer to show fast random numbers before revealing real number.
		}
		case 2:  																// Stage 2: Draw a Number
		{
		    new Draw = LotteryNumbersPicked[playerid];                          // For shorter writing, store the amount of picked numbers in new variable
   		    new bool:found, bool:taken, number;                                 // Create few new variables
		    while (found == false)                                              // Loop until a unique number has been found
		    {
		        taken = false;                                                  // Reset boolean to false
		        number = random(100);                                           // Generate a random number from 0 to 99
		        for(new i; i<10; i++)                                           // Loop through the already drawn numbers
		        {
		         	if(number == LotteryNumbers[playerid][i])                   // Check if generated number has already been picked
					{
						taken = true;                                           // ..if yes, set 'taken'  to true
					}
				}
				if(taken == false)                                              // if loop is finished an 'taken' is still 'false' it means we found a unique number
				{
				    LotteryNumbers[playerid][Draw] = number;                    // Store the new number in the array
					found = true;                                               // Set 'found' to true to stop the loop
				}
			}
			new str[5], Float:X = 258.0, Float:Y = 189.0;                       // Create new varibles. The X and Y are the textdraw-coordinates for the circle around number "00", the other coordinates will be caclulated from this point
			format(str, 5, "%02d", number);                                     // Format string to show the generated number
			PlayerTextDrawHide(playerid, TDNumber[playerid]);
			PlayerTextDrawSetString(playerid, TDNumber[playerid], str);
			PlayerTextDrawShow(playerid, TDNumber[playerid]);
	
			new bool:match;                                                     // Create new boolean that will check if a match has been found
			for(new i; i<10; i++)                                               // Loop through all numbers selected by the player
			{
			    if(Lot[playerid][i] == number)                                  // If the new generated number matches a number in the players array...
			    {
					Matches[playerid]++;                                        // Increase the number of matches by 1
					match = true;                                               // Set match-boolean to true
				}
			}

			new horizontal;                                                     // Create new variable to keep track of the horizontal collumns
			for(new c; c<(number); c++)                                         // Now we have to calculate the coordinates for the circle around the generated number.
			{
			    X = floatadd(X, 16.0);                                          // Increase the X-coordinate by 16.0
			    horizontal++;                                                   // Increase the horizontal variable by 1
			    if(horizontal == 10)                                            // If we have moved 10 collumns
			    {
		 			horizontal = 0;                                             // Set horizontal variable back to 0
				    X = 258.0;                                                  // Set the X-coordinate back to 258.0   (go to first collumn)
                    Y = floatadd(Y, 16.0);                                      // Increase the Y-coordinate by 16.0    (go to next row)
				}
  			}                                                                   // When the loop is finished, we will have the right X- and Y-coordinates for the circle around the number
  			
			new Float:x, Float:y, Float:z;
			GetPlayerPos(playerid, x, y, z);
  			if(match == true) PlayerPlaySound(playerid, 1057, x, y, z);         // If a match was found, play high beep-sound
			else PlayerPlaySound(playerid, 1085, x, y, z);                      // else if no match was found, play low beep-sound

 		    TDDots[playerid][Draw] = CreatePlayerTextDraw(playerid, X, Y, "O"); // Create Circle-textdraw at the calculated coordinates
			PlayerTextDrawBackgroundColor(playerid,TDDots[playerid][Draw], 255);
			PlayerTextDrawFont(playerid,TDDots[playerid][Draw], 2);
			PlayerTextDrawLetterSize(playerid,TDDots[playerid][Draw], 0.650000, 3.400000);
			if(match == true) PlayerTextDrawColor(playerid,TDDots[playerid][Draw], 0x7DFA2AFF);     // If number matched, make circle bright green
			else PlayerTextDrawColor(playerid,TDDots[playerid][Draw], 0xB3D69CFF);                  // If no match, make circle pale-green
			PlayerTextDrawSetOutline(playerid,TDDots[playerid][Draw], 0);
			PlayerTextDrawSetProportional(playerid,TDDots[playerid][Draw], 1);
			PlayerTextDrawSetShadow(playerid,TDDots[playerid][Draw], 1);
			PlayerTextDrawSetSelectable(playerid,TDDots[playerid][Draw], 0);
			PlayerTextDrawShow(playerid, TDDots[playerid][Draw]);
            new b = Bet[playerid];
			switch(Matches[playerid])   // Switch through the current amount of matches. Giving the current amount a red color while the rest is white.
			{
			    case 0:	format(PrizeString[playerid][0], 128, "~w~01: $%d~n~02: $%d~n~03: $%d~n~04: $%d~n~05: $%d", floatround(b*RM[1]), floatround(b*RM[2]), floatround(b*RM[3]), floatround(b*RM[4]), floatround(b*RM[5]));
			    case 1: format(PrizeString[playerid][0], 128, "~r~01: $%d~n~~w~02: $%d~n~03: $%d~n~04: $%d~n~05: $%d", floatround(b*RM[1]), floatround(b*RM[2]), floatround(b*RM[3]), floatround(b*RM[4]), floatround(b*RM[5]));
			    case 2: format(PrizeString[playerid][0], 128, "~w~01: $%d~n~~r~02: $%d~n~~w~03: $%d~n~04: $%d~n~05: $%d", floatround(b*RM[1]), floatround(b*RM[2]), floatround(b*RM[3]), floatround(b*RM[4]), floatround(b*RM[5]));
			    case 3: format(PrizeString[playerid][0], 128, "~w~01: $%d~n~02: $%d~n~~r~03: $%d~n~~w~04: $%d~n~05: $%d", floatround(b*RM[1]), floatround(b*RM[2]), floatround(b*RM[3]), floatround(b*RM[4]), floatround(b*RM[5]));
			    case 4: format(PrizeString[playerid][0], 128, "~w~01: $%d~n~02: $%d~n~03: $%d~n~~r~04: $%d~n~~w~05: $%d",floatround(b*RM[1]), floatround(b*RM[2]), floatround(b*RM[3]), floatround(b*RM[4]), floatround(b*RM[5]));
			    case 5: format(PrizeString[playerid][0], 128, "~w~01: $%d~n~02: $%d~n~03: $%d~n~04: $%d~n~~r~05: $%d", floatround(b*RM[1]), floatround(b*RM[2]), floatround(b*RM[3]), floatround(b*RM[4]), floatround(b*RM[5]));
			    
			    case 6: format(PrizeString[playerid][1], 128, "~r~$%d :06 ~n~~w~$%d :07 ~n~$%d :08 ~n~$%d :09 ~n~$%d :10", floatround(b*RM[6]), floatround(b*RM[7]), floatround(b*RM[8]), floatround(b*RM[9]), Jackpot);
			    case 7: format(PrizeString[playerid][1], 128, "~w~$%d :06 ~n~~r~$%d :07 ~n~~w~$%d :08 ~n~$%d :09 ~n~$%d :10", floatround(b*RM[6]), floatround(b*RM[7]), floatround(b*RM[8]), floatround(b*RM[9]), Jackpot);
			    case 8: format(PrizeString[playerid][1], 128, "~w~$%d :06 ~n~$%d :07 ~n~~r~$%d :08 ~n~~w~$%d :09 ~n~$%d :10", floatround(b*RM[6]), floatround(b*RM[7]), floatround(b*RM[8]), floatround(b*RM[9]), Jackpot);
			    case 9: format(PrizeString[playerid][1], 128, "~w~$%d :06 ~n~$%d :07 ~n~$%d :08 ~n~~r~$%d :09 ~n~~w~$%d :10", floatround(b*RM[6]), floatround(b*RM[7]), floatround(b*RM[8]), floatround(b*RM[9]), Jackpot);
			    case 10: format(PrizeString[playerid][1], 128, "~w~$%d :06 ~n~$%d :07 ~n~$%d :08 ~n~$%d :09 ~n~~r~$%d :10", floatround(b*RM[6]), floatround(b*RM[7]), floatround(b*RM[8]), floatround(b*RM[9]), Jackpot);
			}
            switch(Matches[playerid])
			{
			    case 0..5: format(PrizeString[playerid][1], 128, "~w~$%d :06 ~n~$%d :07 ~n~$%d :08 ~n~$%d :09 ~n~$%d :10", floatround(b*RM[6]), floatround(b*RM[7]), floatround(b*RM[8]), floatround(b*RM[9]), Jackpot);
			    case 6..10: format(PrizeString[playerid][0], 128, "~w~01: $%d~n~02: $%d~n~03: $%d~n~04: $%d~n~05: $%d", floatround(b*RM[1]), floatround(b*RM[2]), floatround(b*RM[3]), floatround(b*RM[4]), floatround(b*RM[5]));
			}
			PlayerTextDrawHide(playerid, TDPrize[playerid][0]);
    		PlayerTextDrawHide(playerid, TDPrize[playerid][1]);
			PlayerTextDrawSetString(playerid, TDPrize[playerid][0], PrizeString[playerid][0]);
			PlayerTextDrawSetString(playerid, TDPrize[playerid][1], PrizeString[playerid][1]);
	        PlayerTextDrawShow(playerid, TDPrize[playerid][0]); 		        // Show the updates rewards-textdraws
    		PlayerTextDrawShow(playerid, TDPrize[playerid][1]);                 // Show the updates rewards-textdraws

			Draw++;                                                             // Increase the count of drawn numbers by 1
   			if(Draw == 10)                                                      // If 10 numbers have been drawn then finish the game
			{
			    AreDotsCreated[playerid] = true;                                // Set boolian to check if all cicles have been created to 'true'
			    LotteryStage[playerid] = 3;                                     // Set stage to 3  ( = finish game)
			    LotteryTimer[playerid] = SetTimerEx("Lottery", 400, 0, "u", playerid);  // Start timer to finish the game
  			}
			else                                                                // If less than 10 numbers have been draws
			{
			    LotteryNumbersPicked[playerid]++;                               // Increase the global amount of drawn numbers by 1
			    LotteryStage[playerid] = 1;                                     // Set stage to '1'  ( = show fast random numbers)
				LotteryTimer[playerid] = SetTimerEx("Lottery", TIME_BETWEEN_NUMBERS, 0, "u", playerid);     //Start timer to pick next number
			}
  		}
  		case 3:   																// End of the Game
  		{
  		    new str[128];
  		    switch (Matches[playerid])                                          // Switch through the amount of matches
  		    {
  		        case 0:                                                         // If no matches at all...
 				{
					format(str, sizeof(str), "{F4C670}[Lottery]: {FFFFFF}Sorry, you do not have any matches.. Better luck next time!"),  // Player = loser
					SendClientMessage(playerid, 0xF2B346FF, str);
					PlayerTextDrawHide(playerid, TDHeader[playerid]);
					PlayerTextDrawSetString(playerid, TDHeader[playerid], "~r~Loser!");
					PlayerTextDrawShow(playerid, TDHeader[playerid]);
				}
				case 1..9:                                                      // If 1 to 9 numbers match with the players selection...
				{
                    format(str, sizeof(str), "{F4C670}[Lottery]: {FFFFFF}Congratulations! You've got {55CF5F}%d {FFFFFF}match(es) and won {55CF5F}$%d{FFFFFF}!", Matches[playerid], floatround(Bet[playerid]*RM[Matches[playerid]]));
                    SendClientMessage(playerid, 0x00FF00FF, str);
                    GivePlayerCash(playerid, floatround(Bet[playerid]*RM[Matches[playerid]])); // Give player his prize
                    PlayerTextDrawHide(playerid, TDHeader[playerid]);
					PlayerTextDrawSetString(playerid, TDHeader[playerid], "~w~Winner!");
					PlayerTextDrawShow(playerid, TDHeader[playerid]);
				}
				case 10:                                                        // If all 10 selected numbers match, the player wins the Jackpot
				{
				    PlayerTextDrawHide(playerid, TDHeader[playerid]);
					PlayerTextDrawSetString(playerid, TDHeader[playerid], "~w~Jackpot!!");
					PlayerTextDrawShow(playerid, TDHeader[playerid]);
					new pName[MAX_PLAYER_NAME];
					GetPlayerName(playerid, pName, sizeof(pName));
					format(str, sizeof(str), "{F4C670}[Lottery]: {55CF5F}%s {FFFFFF}has won the {FF0000}JACKPOT {FFFFFF}of {55CF5F}$%d! {FFFFFF}Congratulations!!", pName, Jackpot);
					SendClientMessageToAll(-1, str);
				    format(str, sizeof(str), " {FFFFFF}Congratulations! You've got {55CF5F}10 {FFFFFF}matches and won the {FF0000}JACKPOT {FFFFFF}of {55CF5F}$%d!!!", Jackpot);
                    SendClientMessage(playerid, -1, str);

					GivePlayerCash(playerid, Jackpot);                         // Give player the Jackpot
                    
                    new Float:x, Float:y, Float:z;
					GetPlayerPos(playerid, x, y, z);
					PlayerPlaySound(playerid, 1183, x, y, z);                   // Play music

				    new File:file, string[12];                                  // Reset the jackpot to its default in the file
                    file = fopen(FILE_PATH,io_write);
			    	format(string, 12, "%d", DEFAULT_JACKPOT);
			    	fwrite(file, string);
			    	fclose(file);
			    	Jackpot = DEFAULT_JACKPOT;
				}
			}
  		    LotteryNumbersPicked[playerid] = 0;                                 // Reset player info
		    LotteryStage[playerid] = 0;                                         // Reset player info (Let player select new numbers)
		    Matches[playerid] = 0;                                              // Reset player info
		    SelectTextDraw(playerid, 0xFF4040AA);                               // Show cursor to select new numbers
  		}
	}
	return 1;
}

forward ShowRandomNumbers(playerid);
public ShowRandomNumbers(playerid)                                              // Before a random number is drawn, a bunch of random numbers will flash for a second
{
	new str[5];
	format(str, 5, "%02d", random(100));                                        // Format a string with a random number
    PlayerTextDrawHide(playerid, TDNumber[playerid]);
    PlayerTextDrawSetString(playerid, TDNumber[playerid], str);
    PlayerTextDrawShow(playerid, TDNumber[playerid]);                           // Show the number
    RandomNumbersCount[playerid]++;                                             // Increase the counter by 1
    if(RandomNumbersCount[playerid] == 20)                                      // If 20 random numbers have been shown
    {
     	KillTimer(RandomNumbersTimer[playerid]);                                // Kill the timer
        RandomNumbersCount[playerid] = 0;                                       // Reset player info
        LotteryStage[playerid] = 2;                                             // Set stage to 2 ( = draw next number)
        Lottery(playerid);                                                      // Call the lottery-function
	}
	return 1;
}

forward HideError(playerid);
public HideError(playerid)                                                      // Triggered by timer when an error-message is shown
{
    PlayerTextDrawHide(playerid, TDError[playerid]);                            // Hide the error-textdraw
	PlayerTextDrawShow(playerid, TDHeader[playerid]);                           // Show the Lottery-header
	return 1;
}

GetFreeSlot(playerid)                                                           // This function will return a free (if any) slot in the players Lot-array
{
	for(new i; i<10; i++)                                                       // Loop through the 10 slots in the  players' Lot-array
	{
	    if(Lot[playerid][i] == -1) return i;                                    // If the value in this slot is empty (-1) return the slot
	}
	return -1;                                                                  // If all slots are full, return -1
}

FindSlot(playerid, number)                                                      // This function look in which slot a given number is stored
{
	for(new i; i<10; i++)                                                       // Loop through the 10 slots in the players' Lot-array
	{
	    if(Lot[playerid][i] == number) return i;                                // If the given number matches with the stored number in this slot, return the slot
	}
	return -1;                                                                  // If the given number is not in the array, return -1
}

CreatePlayerTextDraws(playerid)                                                 // Create all PlayerTextDraws
{
    new str[5], Float:X = 267.0, Float:Y = 200.0, count;                        // Start with the 100 numbers, they are placed in a 10x10 grid. The coordinates will be calculated from 1 starting point (location of number "00")
	for(new i; i<10; i++)                                                       // Loop 10x to create the rows
	{
	    X = 267.0;
	    for(new j; j<10; j++)                                                   // Loop 10x to create the collumns.
	    {
	    	format(str, sizeof(str), "%02d", count);
			TD[playerid][count] = CreatePlayerTextDraw(playerid, X, Y, str);
			PlayerTextDrawAlignment(playerid,TD[playerid][count], 2);
			PlayerTextDrawBackgroundColor(playerid,TD[playerid][count], 255);
			PlayerTextDrawFont(playerid,TD[playerid][count], 1);
			PlayerTextDrawLetterSize(playerid,TD[playerid][count], 0.220000, 1.200000);
			PlayerTextDrawColor(playerid,TD[playerid][count], 0xD1D1D1FF);
			PlayerTextDrawSetOutline(playerid,TD[playerid][count], 1);
			PlayerTextDrawSetProportional(playerid,TD[playerid][count], 1);
			PlayerTextDrawSetShadow(playerid,TD[playerid][count], 1);
			PlayerTextDrawUseBox(playerid,TD[playerid][count], 1);
			PlayerTextDrawBoxColor(playerid,TD[playerid][count], 0);
			PlayerTextDrawTextSize(playerid,TD[playerid][count], 8.000000, 10.000000);
			PlayerTextDrawSetSelectable(playerid,TD[playerid][count], 1);
			X = floatadd(X, 16.0);
			count++;
		}
		Y = floatadd(Y, 16.0);
	}
	TDPrize[playerid][0] = CreatePlayerTextDraw(playerid, 259.000000, 150.000000, "01: $000~n~02: $000~n~03: $000~n~04: $000~n~05: $000");
	PlayerTextDrawBackgroundColor(playerid, TDPrize[playerid][0], 255);
	PlayerTextDrawFont(playerid, TDPrize[playerid][0], 1);
	PlayerTextDrawLetterSize(playerid, TDPrize[playerid][0], 0.230000, 0.95);
	PlayerTextDrawColor(playerid, TDPrize[playerid][0], 0xF2E4CEFF);
	PlayerTextDrawSetOutline(playerid, TDPrize[playerid][0], 0);
	PlayerTextDrawSetProportional(playerid, TDPrize[playerid][0], 0);
	PlayerTextDrawSetShadow(playerid, TDPrize[playerid][0], 1);
	PlayerTextDrawSetSelectable(playerid, TDPrize[playerid][0], 0);
	
	TDPrize[playerid][1] = CreatePlayerTextDraw(playerid, 418.000000, 150.000000, "$000 :06 ~n~$000 :07 ~n~$000 :08 ~n~$000 :09 ~n~$000 :10");
	PlayerTextDrawAlignment(playerid, TDPrize[playerid][1], 3);
	PlayerTextDrawBackgroundColor(playerid, TDPrize[playerid][1], 255);
	PlayerTextDrawFont(playerid, TDPrize[playerid][1], 1);
	PlayerTextDrawLetterSize(playerid, TDPrize[playerid][1], 0.230000, 0.95);
	PlayerTextDrawColor(playerid, TDPrize[playerid][1], 0xF2E4CEFF);
	PlayerTextDrawSetOutline(playerid, TDPrize[playerid][1], 0);
	PlayerTextDrawSetProportional(playerid, TDPrize[playerid][1], 0);
	PlayerTextDrawSetShadow(playerid, TDPrize[playerid][1], 1);
	PlayerTextDrawSetSelectable(playerid, TDPrize[playerid][1], 0);
	
	TDBet[playerid] = CreatePlayerTextDraw(playerid,340.000000, 150.000000, "$0000");   // Current Bet Text
	PlayerTextDrawAlignment(playerid,TDBet[playerid], 2);
	PlayerTextDrawBackgroundColor(playerid,TDBet[playerid], 255);
	PlayerTextDrawFont(playerid,TDBet[playerid], 1);
	PlayerTextDrawLetterSize(playerid,TDBet[playerid], 0.230000, 1.000000);
	PlayerTextDrawColor(playerid,TDBet[playerid], -173980929);
	PlayerTextDrawSetOutline(playerid,TDBet[playerid], 0);
	PlayerTextDrawSetProportional(playerid,TDBet[playerid], 1);
	PlayerTextDrawSetShadow(playerid,TDBet[playerid], 1);
	PlayerTextDrawSetSelectable(playerid,TDBet[playerid], 0);
	
	TDNumber[playerid] = CreatePlayerTextDraw(playerid,340.000000, 167.000000, "  ");     // Drawn Number
	PlayerTextDrawAlignment(playerid,TDNumber[playerid], 2);
	PlayerTextDrawBackgroundColor(playerid,TDNumber[playerid], 255);
	PlayerTextDrawFont(playerid,TDNumber[playerid], 1);
	PlayerTextDrawLetterSize(playerid,TDNumber[playerid], 0.549999, 2.199999);
	PlayerTextDrawColor(playerid,TDNumber[playerid], -1);
	PlayerTextDrawSetOutline(playerid,TDNumber[playerid], 1);
	PlayerTextDrawSetProportional(playerid,TDNumber[playerid], 1);
	PlayerTextDrawSetSelectable(playerid,TDNumber[playerid], 0);

    TDHeader[playerid] = CreatePlayerTextDraw(playerid, 340.000000, 104.000000, "Lottery");   // Header Text
	PlayerTextDrawAlignment(playerid, TDHeader[playerid], 2);
	PlayerTextDrawBackgroundColor(playerid, TDHeader[playerid], 255);
	PlayerTextDrawFont(playerid, TDHeader[playerid], 0);
	PlayerTextDrawLetterSize(playerid, TDHeader[playerid], 0.910000, 3.000000);
	PlayerTextDrawColor(playerid, TDHeader[playerid], 0xF2E4CEFF);
	PlayerTextDrawSetOutline(playerid, TDHeader[playerid], 1);
	PlayerTextDrawSetProportional(playerid, TDHeader[playerid], 1);
	PlayerTextDrawSetShadow(playerid, TDHeader[playerid], 1);

    TDError[playerid] = CreatePlayerTextDraw(playerid,340.000000, 107.000000, "~r~[Error] ~n~~w~You have already selected ~r~10 ~w~numbers!~n~Press ~g~PLAY ~w~to start!");
	PlayerTextDrawAlignment(playerid,TDError[playerid], 2);
	PlayerTextDrawBackgroundColor(playerid,TDError[playerid], 255);
	PlayerTextDrawFont(playerid,TDError[playerid], 1);
	PlayerTextDrawLetterSize(playerid,TDError[playerid], 0.200000, 1.100000);
	PlayerTextDrawColor(playerid,TDError[playerid], -1);
	PlayerTextDrawSetOutline(playerid,TDError[playerid], 1);
	PlayerTextDrawSetProportional(playerid,TDError[playerid], 1);
	PlayerTextDrawSetSelectable(playerid,TDError[playerid], 0);

	AreTDCreated[playerid] = true;
}

CreateGlobalTextDraws()
{
  	new count, Float:X = 259.0, Float:Y = 199.0;
  	
  	gTD[count] = TextDrawCreate(339.000000, 107.000000, "~n~");   // Background
	TextDrawAlignment(gTD[count], 2);
	TextDrawBackgroundColor(gTD[count], 255);
	TextDrawFont(gTD[count], 1);
	TextDrawLetterSize(gTD[count], 0.759999, 27.700000);
	TextDrawColor(gTD[count], -1);
	TextDrawSetOutline(gTD[count], 0);
	TextDrawSetProportional(gTD[count], 1);
	TextDrawSetShadow(gTD[count], 1);
	TextDrawUseBox(gTD[count], 1);
	TextDrawBoxColor(gTD[count], 120);
	TextDrawTextSize(gTD[count], 124.000000, 159.000000);
	TextDrawSetSelectable(gTD[count], 0);
  	
  	count++;
  	
    gTD[count] = TextDrawCreate(339.000000, 108.000000, "~n~");   //Header Background
	TextDrawAlignment(gTD[count], 2);
	TextDrawBackgroundColor(gTD[count], 255);
	TextDrawFont(gTD[count], 1);
	TextDrawLetterSize(gTD[count], 0.500000, 3.099999);
	TextDrawColor(gTD[count], 0xB5FFF6FF);
	TextDrawSetOutline(gTD[count], 0);
	TextDrawSetProportional(gTD[count], 1);
	TextDrawSetShadow(gTD[count], 1);
	TextDrawUseBox(gTD[count], 1);
	TextDrawBoxColor(gTD[count], 0xB5FFF655);
	TextDrawTextSize(gTD[count], 40.000000, -170.000000);
	TextDrawSetSelectable(gTD[count], 0);

    count++;

    gTD[count] = TextDrawCreate(257.000000, 107.000000, "~n~");    //Outline Right
	TextDrawAlignment(gTD[count], 2);
	TextDrawBackgroundColor(gTD[count], 255);
	TextDrawFont(gTD[count], 1);
	TextDrawLetterSize(gTD[count], 0.500000, 27.799999);
	TextDrawColor(gTD[count], -1);
	TextDrawSetOutline(gTD[count], 0);
	TextDrawSetProportional(gTD[count], 1);
	TextDrawSetShadow(gTD[count], 1);
	TextDrawUseBox(gTD[count], 1);
	TextDrawBoxColor(gTD[count], 255);
	TextDrawTextSize(gTD[count], 30.000000, -1.000000);
	TextDrawSetSelectable(gTD[count], 0);

    count++;

	gTD[count] = TextDrawCreate(421.000000, 107.000000, "~n~");   // Outline Left
	TextDrawAlignment(gTD[count], 2);
	TextDrawBackgroundColor(gTD[count], 255);
	TextDrawFont(gTD[count], 1);
	TextDrawLetterSize(gTD[count], 0.500000, 27.799999);
	TextDrawColor(gTD[count], -1);
	TextDrawSetOutline(gTD[count], 0);
	TextDrawSetProportional(gTD[count], 1);
	TextDrawSetShadow(gTD[count], 1);
	TextDrawUseBox(gTD[count], 1);
	TextDrawBoxColor(gTD[count], 255);
	TextDrawTextSize(gTD[count], 30.000000, -1.000000);
	TextDrawSetSelectable(gTD[count], 0);

    count++;
    
	gTD[count] = TextDrawCreate(339.000000, 104.000000, "~n~");  //Outline Top
	TextDrawAlignment(gTD[count], 2);
	TextDrawBackgroundColor(gTD[count], 255);
	TextDrawFont(gTD[count], 1);
	TextDrawLetterSize(gTD[count], 0.500000, -0.000000);
	TextDrawColor(gTD[count], -1);
	TextDrawSetOutline(gTD[count], 0);
	TextDrawSetProportional(gTD[count], 1);
	TextDrawSetShadow(gTD[count], 1);
	TextDrawUseBox(gTD[count], 1);
	TextDrawBoxColor(gTD[count], 255);
	TextDrawTextSize(gTD[count], 40.000000, -170.000000);
	TextDrawSetSelectable(gTD[count], 0);

    count++;
    
	gTD[count] = TextDrawCreate(339.000000, 359.000000, "~n~");  //Outline Onder
	TextDrawAlignment(gTD[count], 2);
	TextDrawBackgroundColor(gTD[count], 255);
	TextDrawFont(gTD[count], 1);
	TextDrawLetterSize(gTD[count], 0.500000, -0.000000);
	TextDrawColor(gTD[count], -1);
	TextDrawSetOutline(gTD[count], 0);
	TextDrawSetProportional(gTD[count], 1);
	TextDrawSetShadow(gTD[count], 1);
	TextDrawUseBox(gTD[count], 1);
	TextDrawBoxColor(gTD[count], 255);
	TextDrawTextSize(gTD[count], 40.000000, -170.000000);
	TextDrawSetSelectable(gTD[count], 0);

    count++;
    
    gTD[count] = TextDrawCreate(313.500000, 150.000000, "ld_beat:chit");   //Circle Outline
	TextDrawLetterSize(gTD[count], 0.000000, 0.000000);
	TextDrawTextSize(gTD[count], 53.0, 58.0);
	TextDrawAlignment(gTD[count], 2);
	TextDrawColor(gTD[count], 255);
	TextDrawSetShadow(gTD[count], 2);
	TextDrawSetOutline(gTD[count], 2);
	TextDrawBackgroundColor(gTD[count], 0x00000000);
	TextDrawFont(gTD[count], 4);

	count++;

    gTD[count] = TextDrawCreate(317.500000, 154.000000, "ld_beat:chit");   //Circle
	TextDrawLetterSize(gTD[count], 0.000000, 0.000000);
	TextDrawTextSize(gTD[count], 45.0, 50.0);
	TextDrawAlignment(gTD[count], 2);
	TextDrawColor(gTD[count], 0xB1FAC0FF);
	TextDrawSetShadow(gTD[count], 2);
	TextDrawSetOutline(gTD[count], 2);
	TextDrawBackgroundColor(gTD[count], 0x00000000);
	TextDrawFont(gTD[count], 4);

	count++;
	
	gTD[count] = TextDrawCreate(259.000000, 143.000000, "Matches / Prize:");    //Matches / Prize text
	TextDrawBackgroundColor(gTD[count], 255);
	TextDrawFont(gTD[count], 1);
	TextDrawLetterSize(gTD[count], 0.139999, 0.699999);
	TextDrawColor(gTD[count], 0xB1FAC0FF);
	TextDrawSetOutline(gTD[count], 0);
	TextDrawSetProportional(gTD[count], 1);
	TextDrawSetShadow(gTD[count], 1);
	TextDrawSetSelectable(gTD[count], 0);

	count++;

	gTD[count] = TextDrawCreate(340.000000, 139.000000, "BET");       // Bet Text
	TextDrawAlignment(gTD[count], 2);
	TextDrawBackgroundColor(gTD[count], 255);
	TextDrawFont(gTD[count], 1);
	TextDrawLetterSize(gTD[count], 0.290000, 1.000000);
	TextDrawColor(gTD[count], 0xB1FAC0FF);
	TextDrawSetOutline(gTD[count], 0);
	TextDrawSetProportional(gTD[count], 1);
	TextDrawSetShadow(gTD[count], 1);
	TextDrawSetSelectable(gTD[count], 0);

    count++;

    gTD[count] = TextDrawCreate(268.000000, 129.000000, "Reset");
	TextDrawAlignment(gTD[count], 2);
	TextDrawBackgroundColor(gTD[count], 255);
	TextDrawFont(gTD[count], 1);
	TextDrawLetterSize(gTD[count], 0.170000, 0.899999);
	TextDrawColor(gTD[count], -16776961);
	TextDrawSetOutline(gTD[count], 1);
	TextDrawSetProportional(gTD[count], 1);
	TextDrawUseBox(gTD[count], 1);
	TextDrawBoxColor(gTD[count], 0);
	TextDrawTextSize(gTD[count], 10.000000, 30.000000);
	TextDrawSetSelectable(gTD[count], 1);
	
	count++;

	gTD[count] = TextDrawCreate(411.000000, 129.000000, "Help");
	TextDrawAlignment(gTD[count], 2);
	TextDrawBackgroundColor(gTD[count], 255);
	TextDrawFont(gTD[count], 1);
	TextDrawLetterSize(gTD[count], 0.170000, 0.899999);
	TextDrawColor(gTD[count], 16777215);
	TextDrawSetOutline(gTD[count], 1);
	TextDrawSetProportional(gTD[count], 1);
	TextDrawUseBox(gTD[count], 1);
	TextDrawBoxColor(gTD[count], 0);
	TextDrawTextSize(gTD[count], 10.000000, 30.000000);
	TextDrawSetSelectable(gTD[count], 1);

	count++;

	for(new i=0; i<11; i++)  // Create Vertical Lines
	{
	    if(i == 10)
	    {
	    	gTD[count] = TextDrawCreate((X+1), 199.000000, "~n~");
		}
		else
		{
		    gTD[count] = TextDrawCreate(X, 199.000000, "~n~");
		}
		TextDrawAlignment(gTD[count], 2);
		TextDrawBackgroundColor(gTD[count], 255);
		TextDrawFont(gTD[count], 1);
		TextDrawLetterSize(gTD[count], 0.500000, 17.399993);
		TextDrawColor(gTD[count], -1);
		TextDrawSetOutline(gTD[count], 0);
		TextDrawSetProportional(gTD[count], 1);
		TextDrawSetShadow(gTD[count], 1);
		TextDrawUseBox(gTD[count], 1);
		TextDrawBoxColor(gTD[count], 255);
		TextDrawTextSize(gTD[count], 1.000000, -2.000000);
		X = floatadd(X, 16.0);
		count++;
	}
	for(new i=0; i<11; i++)  // Create Horizontal Lines
	{
		gTD[count] = TextDrawCreate(340.000000, Y, "~n~");
		TextDrawAlignment(gTD[count], 2);
		TextDrawBackgroundColor(gTD[count], 255);
		TextDrawFont(gTD[count], 1);
		TextDrawLetterSize(gTD[count], 0.500000, -0.300006);
		TextDrawColor(gTD[count], -1);
		TextDrawSetOutline(gTD[count], 0);
		TextDrawSetProportional(gTD[count], 1);
		TextDrawSetShadow(gTD[count], 1);
		TextDrawUseBox(gTD[count], 1);
		TextDrawBoxColor(gTD[count], 255);
		TextDrawTextSize(gTD[count], 61.000000, 158.000000);
		TextDrawSetSelectable(gTD[count], 0);
		Y = floatadd(Y, 16.0);
		count++;
	}
	TDLowerBet = TextDrawCreate(326.000000, 136.000000, "<");      // Lower Bet Button
	TextDrawAlignment(TDLowerBet, 2);
	TextDrawBackgroundColor(TDLowerBet, 255);
	TextDrawFont(TDLowerBet, 1);
	TextDrawLetterSize(TDLowerBet, 0.329999, 1.600000);
	TextDrawColor(TDLowerBet, -1);
	TextDrawSetOutline(TDLowerBet, 1);
	TextDrawSetProportional(TDLowerBet, 1);
	TextDrawUseBox(TDLowerBet, 1);
	TextDrawBoxColor(TDLowerBet, 0);
	TextDrawTextSize(TDLowerBet, 15.000000, 20.000000);
	TextDrawSetSelectable(TDLowerBet, 1);

	TDRaiseBet = TextDrawCreate(354.000000, 136.000000, ">");    //  Raise Bet Button
	TextDrawAlignment(TDRaiseBet, 2);
	TextDrawBackgroundColor(TDRaiseBet, 255);
	TextDrawFont(TDRaiseBet, 1);
	TextDrawLetterSize(TDRaiseBet, 0.329999, 1.600000);
	TextDrawColor(TDRaiseBet, -1);
	TextDrawSetOutline(TDRaiseBet, 1);
	TextDrawSetProportional(TDRaiseBet, 1);
	TextDrawUseBox(TDRaiseBet, 1);
	TextDrawBoxColor(TDRaiseBet, 0);
	TextDrawTextSize(TDRaiseBet, 15.000000, 20.000000);
	TextDrawSetSelectable(TDRaiseBet, 1);

    TDStart = TextDrawCreate(292.000000, 365.000000, "PLAY");    // Play Button
	TextDrawAlignment(TDStart, 2);
	TextDrawBackgroundColor(TDStart, 255);
	TextDrawFont(TDStart, 1);
	TextDrawLetterSize(TDStart, 0.509999, 2.100000);
	TextDrawColor(TDStart, 0xB1FAC0FF);
	TextDrawSetOutline(TDStart, 1);
	TextDrawSetProportional(TDStart, 1);
	TextDrawUseBox(TDStart, 1);
	TextDrawBoxColor(TDStart, 0);
	TextDrawTextSize(TDStart, 53.000000, 50.000000);
	TextDrawSetSelectable(TDStart, 1);

	TDClose = TextDrawCreate(381.000000, 365.000000, "CLOSE");   // Close Button
	TextDrawAlignment(TDClose, 2);
	TextDrawBackgroundColor(TDClose, 255);
	TextDrawFont(TDClose, 1);
	TextDrawLetterSize(TDClose, 0.509999, 2.100000);
	TextDrawColor(TDClose, 0xFF9696FF);
	TextDrawSetOutline(TDClose, 1);
	TextDrawSetProportional(TDClose, 1);
	TextDrawUseBox(TDClose, 1);
	TextDrawBoxColor(TDClose, 0);
	TextDrawTextSize(TDClose, 53.000000, 50.000000);
	TextDrawSetSelectable(TDClose, 1);
    print("CLose Button Created");
}

HideTDForPlayer(playerid)
{
    for(new i; i<sizeof(gTD); i++)
	{
	    TextDrawHideForPlayer(playerid, gTD[i]);
	}
	for(new i; i<100; i++)
	{
		PlayerTextDrawHide(playerid, TD[playerid][i]);
	}
	if(AreDotsCreated[playerid] == true)
	{
		for(new i; i<10; i++)
		{
	    	PlayerTextDrawDestroy(playerid, TDDots[playerid][i]);
		}
		AreDotsCreated[playerid] = false;
	}
	PlayerTextDrawHide(playerid, TDPrize[playerid][0]);
	PlayerTextDrawHide(playerid, TDPrize[playerid][1]);
	new b = Bet[playerid];
	format(PrizeString[playerid][0], 128, "01: $%d~n~02: $%d~n~03: $%d~n~04: $%d~n~05: $%d", floatround(b*RM[1]), floatround(b*RM[2]), floatround(b*RM[3]), floatround(b*RM[4]), floatround(b*RM[5]));
	format(PrizeString[playerid][1], 128, "$%d :06 ~n~$%d :07 ~n~$%d :08 ~n~$%d :09 ~n~$%d :10", floatround(b*RM[6]), floatround(b*RM[7]), floatround(b*RM[8]), floatround(b*RM[9]), Jackpot);
	PlayerTextDrawSetString(playerid, TDPrize[playerid][0], PrizeString[playerid][0]);
	PlayerTextDrawSetString(playerid, TDPrize[playerid][1], PrizeString[playerid][1]);

    PlayerTextDrawHide(playerid, TDNumber[playerid]);
	PlayerTextDrawSetString(playerid, TDNumber[playerid], "  ");

    PlayerTextDrawHide(playerid, TDBet[playerid]);
    PlayerTextDrawHide(playerid, TDHeader[playerid]);

    TextDrawHideForPlayer(playerid, TDLowerBet);
    TextDrawHideForPlayer(playerid, TDRaiseBet);
    TextDrawHideForPlayer(playerid, TDStart);
    TextDrawHideForPlayer(playerid, TDClose);
	LotteryStage[playerid] = -1;
	PlayerPlaySound(playerid, 1184, 0.0, 0.0, 0.0);
}
	

 

sal

Link to comment
Share on other sites

  • 0

Foloseste 

CallRemoteFunction("GivePlayerCash", "dd",playerid, bani
);

Inlocuiesti si tu 'bani' cu cati trebuie sa dea si playerid cui vrei sa ii dai bani la ce id. Functia asta o folosesti la fiecare GivePlayerMoney al tau. Sper ca e de ajutor asta. Daca nu functioneaza singura solutie e sa bagi fs in gamemode si decat sa inlocuiesti fiecare GivePlayerMoney cu GivePlayerCash (probabil o sa fac un tutorial video maine si o sa iau ca exemplu fsul tau daca nu a functionat prima metoda) +1 Daca ti-am fost ajutor. :-)

Edited by AdrianG
Link to comment
Share on other sites

  • 0
9 hours ago, AdrianG said:

Foloseste 


CallRemoteFunction("GivePlayerCash", "dd",playerid, bani
);

Inlocuiesti si tu 'bani' cu cati trebuie sa dea si playerid cui vrei sa ii dai bani la ce id. Functia asta o folosesti la fiecare GivePlayerMoney al tau. Sper ca e de ajutor asta. Daca nu functioneaza singura solutie e sa bagi fs in gamemode si decat sa inlocuiesti fiecare GivePlayerMoney cu GivePlayerCash (probabil o sa fac un tutorial video maine si o sa iau ca exemplu fsul tau daca nu a functionat prima metoda) +1 Daca ti-am fost ajutor. :-)

Nu a functionat.

sal

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
Answer this question...

×   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.

×
×
  • Create New...

Important Information

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. For more details you can also review our Terms of Use and Privacy Policy.