Доступ к архиву

Переход в группу "Пользователь"

300.00 ₽
Одноразовый платёж
Быстрый переход в группу "Пользователи", без надобности написания постов и ожидания.

Покупка дает возможность:
Быть полноправным участником форума
Нормальное копирование кода
Создавать темы
Скачивать файлы
Доступ к архиву Pawno-Info

Система рулетки v2

Статус
В этой теме нельзя размещать новые ответы.

#Djuga

Специалист
Здравствуйте уважаемые пользователи портала.
Сегодня я бы хотел предоставить свою версию рулетки, которая намного отличается от версии Andrey.eXe, кодом, дизайном.​

[HR][/HR]
И так, приступим.

[HR][/HR]

1. Ко всем переменным:

PHP:
new 
	Text:gRoll[10],
	PlayerText:t_pRoll[MAX_PLAYERS][8],
	gRollStatus[MAX_PLAYERS char],
	gRollSpins[MAX_PLAYERS char],
	gTimerSpins[MAX_PLAYERS char],
	gRollSpinsCount[MAX_PLAYERS char],
	gRollPrizes[MAX_PLAYERS][9];

new 
	roll_gift[5] = {1550, 1277, 1274, 411, 460}; /*Доступные призы.*/
1. В коллбэк OnPlayerConnect:

PHP:
gRollStatus{playerid} = 
		
		gRollSpins{playerid} =
		gTimerSpins{playerid} =
		gRollSpinsCount{playerid} = 0;
3. В коллбэк OnGameModeInit:

PHP:
gRoll[0] = TextDrawCreate(291.0000, 142.5555, "LD_BEAT:chit"); // пусто
	TextDrawTextSize(gRoll[0], 54.0000, 63.0000);
	TextDrawAlignment(gRoll[0], 1);
	TextDrawColor(gRoll[0], 303174399);
	TextDrawBackgroundColor(gRoll[0], 255);
	TextDrawFont(gRoll[0], 4);
	TextDrawSetProportional(gRoll[0], 0);
	TextDrawSetShadow(gRoll[0], 0);

	gRoll[1] = TextDrawCreate(291.5000, 266.5630, "LD_BEAT:chit"); // пусто
	TextDrawTextSize(gRoll[1], 54.0000, 63.0000);
	TextDrawAlignment(gRoll[1], 1);
	TextDrawColor(gRoll[1], 303174399);
	TextDrawBackgroundColor(gRoll[1], 255);
	TextDrawFont(gRoll[1], 4);
	TextDrawSetProportional(gRoll[1], 0);
	TextDrawSetShadow(gRoll[1], 0);

	gRoll[2] = TextDrawCreate(341.0030, 203.1592, "LD_BEAT:chit"); // пусто
	TextDrawTextSize(gRoll[2], 54.0000, 63.0000);
	TextDrawAlignment(gRoll[2], 1);
	TextDrawColor(gRoll[2], 303174399);
	TextDrawBackgroundColor(gRoll[2], 255);
	TextDrawFont(gRoll[2], 4);
	TextDrawSetProportional(gRoll[2], 0);
	TextDrawSetShadow(gRoll[2], 0);

	gRoll[3] = TextDrawCreate(240.9969, 203.1592, "LD_BEAT:chit"); // пусто
	TextDrawTextSize(gRoll[3], 54.0000, 63.0000);
	TextDrawAlignment(gRoll[3], 1);
	TextDrawColor(gRoll[3], 303174399);
	TextDrawBackgroundColor(gRoll[3], 255);
	TextDrawFont(gRoll[3], 4);
	TextDrawSetProportional(gRoll[3], 0);
	TextDrawSetShadow(gRoll[3], 0);

	gRoll[4] = TextDrawCreate(260.9969, 166.4480, "LD_BEAT:chit"); // пусто
	TextDrawTextSize(gRoll[4], 45.0000, 53.0000);
	TextDrawAlignment(gRoll[4], 1);
	TextDrawColor(gRoll[4], 303174399);
	TextDrawBackgroundColor(gRoll[4], 255);
	TextDrawFont(gRoll[4], 4);
	TextDrawSetProportional(gRoll[4], 0);
	TextDrawSetShadow(gRoll[4], 0);

	gRoll[5] = TextDrawCreate(259.9969, 251.6925, "LD_BEAT:chit"); // пусто
	TextDrawTextSize(gRoll[5], 45.0000, 53.0000);
	TextDrawAlignment(gRoll[5], 1);
	TextDrawColor(gRoll[5], 303174399);
	TextDrawBackgroundColor(gRoll[5], 255);
	TextDrawFont(gRoll[5], 4);
	TextDrawSetProportional(gRoll[5], 0);
	TextDrawSetShadow(gRoll[5], 0);

	gRoll[6] = TextDrawCreate(333.4969, 251.6925, "LD_BEAT:chit"); // пусто
	TextDrawTextSize(gRoll[6], 45.0000, 53.0000);
	TextDrawAlignment(gRoll[6], 1);
	TextDrawColor(gRoll[6], 303174399);
	TextDrawBackgroundColor(gRoll[6], 255);
	TextDrawFont(gRoll[6], 4);
	TextDrawSetProportional(gRoll[6], 0);
	TextDrawSetShadow(gRoll[6], 0);

	gRoll[7] = TextDrawCreate(331.4969, 165.7036, "LD_BEAT:chit"); // пусто
	TextDrawTextSize(gRoll[7], 45.0000, 53.0000);
	TextDrawAlignment(gRoll[7], 1);
	TextDrawColor(gRoll[7], 303174399);
	TextDrawBackgroundColor(gRoll[7], 255);
	TextDrawFont(gRoll[7], 4);
	TextDrawSetProportional(gRoll[7], 0);
	TextDrawSetShadow(gRoll[7], 0);

	gRoll[8] = TextDrawCreate(296.6969, 208.5926, "LD_BEAT:chit"); // пусто
	TextDrawTextSize(gRoll[8], 45.0000, 53.0000);
	TextDrawAlignment(gRoll[8], 1);
	TextDrawColor(gRoll[8], 303174399);
	TextDrawBackgroundColor(gRoll[8], 255);
	TextDrawFont(gRoll[8], 4);
	TextDrawSetProportional(gRoll[8], 0);
	TextDrawSetShadow(gRoll[8], 0);

	gRoll[9] = TextDrawCreate(319.5000, 230.8666, "ROLL"); // пусто
	TextDrawLetterSize(gRoll[9], 0.2085, 0.7848);
	TextDrawTextSize(gRoll[9], 7.4000, 22.0000);
	TextDrawAlignment(gRoll[9], 2);
	TextDrawColor(gRoll[9], -2139062017);
	TextDrawUseBox(gRoll[9], 1);
	TextDrawBoxColor(gRoll[9], 0);
	TextDrawBackgroundColor(gRoll[9], 255);
	TextDrawFont(gRoll[9], 2);
	TextDrawSetProportional(gRoll[9], 1);
	TextDrawSetShadow(gRoll[9], 0);
	TextDrawSetSelectable(gRoll[9], true);
4. В коллбэк OnPlayerClickTextDraw:

PHP:
if(clickedid == gRoll[9])
	{
		if(gRollStatus{playerid} == 2)
			return SendClientMessage(playerid, 0xAFAFAFFF, "Вы уже запустили рулетку!");

		/*Ваше списывание доната/денег*/

		gRollStatus{playerid} = 2;

		gRollSpins{playerid} = 16 + random(16);

        SetTimerEx("@__RouletteUpdate", 500, false, "i", playerid);

	}
5. Ко всем коллбэкам:

PHP:
@__RouletteUpdate(playerid);
@__RouletteUpdate(playerid)
{

	if(++gRollSpinsCount{playerid} == 8)
		gRollSpinsCount{playerid} = 0;

	PlayerTextDrawColor(playerid, t_pRoll[playerid][gRollSpinsCount{playerid}], 0xFF990050);
	
    PlayerTextDrawShow(playerid, t_pRoll[playerid][gRollSpinsCount{playerid}]);

	if(++gTimerSpins{playerid} >= gRollSpins{playerid})
	{

		switch(gRollPrizes[playerid][gRollSpinsCount{playerid}])
		{
			/*Тут вашу выдачу призов*/
			case 1550: /*Меешок с деньгами*/
			{
				GivePlayerMoney(playerid, random(150000/*Максимальный выиграшь*/ - 50000/*Минимальный выиграш*/) + 50000/*Минимальный выиграш*/);
				SendClientMessage(playerid, 0xAFAFAFFF, "Вы выиграли мешок с деньгами!");
			}
			case 1277:/*Диск сохранения*/ 
			{
				SendClientMessage(playerid, -1, "Вы выиграли хз что(9");
			}
			case 1274:/*Доллар*/
			{
				GivePlayerMoney(playerid, random(50000/*Максимальный выиграшь*/ - 5000/*Минимальный выиграш*/) + 5000/*Минимальный выиграш*/);
				SendClientMessage(playerid, 0xAFAFAFFF, "Вы выиграли деньги!");
			}
			case 411: 
			{
				SendClientMessage(playerid, 0xAFAFAFFF, "Вы выиграли машину/лодку!");
			}/*Машины/Лодки*/
			case 460: 
			{
				SendClientMessage(playerid, 0xAFAFAFFF, "Вы выиграли машину/лодку!");
			}/*Машины/Лодки*/

		}

		gRollStatus{playerid} = 1;

		gRollSpins{playerid} =
		gTimerSpins{playerid} =
		gRollSpinsCount{playerid} = 0;

		return true;
	}

	SetTimerEx("@__RouletteChangBackground", 550, false, "dd", playerid, gRollSpinsCount{playerid});

	if(gTimerSpins{playerid} > 16)
   		return SetTimerEx("@__RouletteUpdate", 1000, false, "d", playerid);


	SetTimerEx("@__RouletteUpdate", 500, false, "d", playerid);

	return true;
}

@__RouletteChangBackground(playerid, roll_td);
@__RouletteChangBackground(playerid, roll_td)
{
    PlayerTextDrawColor(playerid, t_pRoll[playerid][gRollSpinsCount{playerid}], 303174399);

    PlayerTextDrawShow(playerid, t_pRoll[playerid][gRollSpinsCount{playerid}]);
}
6. Ко всем командам:

PHP:
CMD:roll(playerid)
{

	if(0 == gRollStatus{playerid})
	{
		gRollStatus{playerid} = 1;

		SendClientMessage(playerid, 0xAFAFAFFF, "Вы открыли игровую рулетку! Чтобы крутить данную рулетку, нажмите \"ROLL\"");
		SendClientMessage(playerid, 0xAFAFAFFF, "Для закрытия рулетки, введите команду снова.");

		t_pRoll[playerid][0] = CreatePlayerTextDraw(playerid, 269.5000, 175.3333, ""); // пусто
		PlayerTextDrawTextSize(playerid, t_pRoll[playerid][0], 27.0000, 34.0000);
		PlayerTextDrawAlignment(playerid, t_pRoll[playerid][0], 1);
		PlayerTextDrawColor(playerid, t_pRoll[playerid][0], -1);
		PlayerTextDrawBackgroundColor(playerid, t_pRoll[playerid][0], 303174144);
		PlayerTextDrawFont(playerid, t_pRoll[playerid][0], 5);
		PlayerTextDrawSetProportional(playerid, t_pRoll[playerid][0], 0);
		PlayerTextDrawSetShadow(playerid, t_pRoll[playerid][0], 0);
		PlayerTextDrawSetPreviewModel(playerid, t_pRoll[playerid][0], 1550);
		PlayerTextDrawSetPreviewRot(playerid, t_pRoll[playerid][0], 0.0000, 0.0000, 0.0000, 1.0000);

		t_pRoll[playerid][1] = CreatePlayerTextDraw(playerid, 342.0000, 259.9555, ""); // пусто
		PlayerTextDrawTextSize(playerid, t_pRoll[playerid][1], 27.0000, 34.0000);
		PlayerTextDrawAlignment(playerid, t_pRoll[playerid][1], 1);
		PlayerTextDrawColor(playerid, t_pRoll[playerid][1], -1);
		PlayerTextDrawBackgroundColor(playerid, t_pRoll[playerid][1], 303174144);
		PlayerTextDrawFont(playerid, t_pRoll[playerid][1], 5);
		PlayerTextDrawSetProportional(playerid, t_pRoll[playerid][1], 0);
		PlayerTextDrawSetShadow(playerid, t_pRoll[playerid][1], 0);
		PlayerTextDrawSetPreviewModel(playerid, t_pRoll[playerid][1], 1550);
		PlayerTextDrawSetPreviewRot(playerid, t_pRoll[playerid][1], 0.0000, 0.0000, 0.0000, 1.0000);

		t_pRoll[playerid][2] = CreatePlayerTextDraw(playerid, 268.5000, 259.9555, ""); // пусто
		PlayerTextDrawTextSize(playerid, t_pRoll[playerid][2], 27.0000, 34.0000);
		PlayerTextDrawAlignment(playerid, t_pRoll[playerid][2], 1);
		PlayerTextDrawColor(playerid, t_pRoll[playerid][2], -1);
		PlayerTextDrawBackgroundColor(playerid, t_pRoll[playerid][2], 303174144);
		PlayerTextDrawFont(playerid, t_pRoll[playerid][2], 5);
		PlayerTextDrawSetProportional(playerid, t_pRoll[playerid][2], 0);
		PlayerTextDrawSetShadow(playerid, t_pRoll[playerid][2], 0);
		PlayerTextDrawSetPreviewModel(playerid, t_pRoll[playerid][2], 1550);
		PlayerTextDrawSetPreviewRot(playerid, t_pRoll[playerid][2], 0.0000, 0.0000, 0.0000, 1.0000);

		t_pRoll[playerid][3] = CreatePlayerTextDraw(playerid, 340.0000, 176.5777, ""); // пусто
		PlayerTextDrawTextSize(playerid, t_pRoll[playerid][3], 29.0000, 32.0000);
		PlayerTextDrawAlignment(playerid, t_pRoll[playerid][3], 1);
		PlayerTextDrawColor(playerid, t_pRoll[playerid][3], -1);
		PlayerTextDrawBackgroundColor(playerid, t_pRoll[playerid][3], 303174144);
		PlayerTextDrawFont(playerid, t_pRoll[playerid][3], 5);
		PlayerTextDrawSetProportional(playerid, t_pRoll[playerid][3], 0);
		PlayerTextDrawSetShadow(playerid, t_pRoll[playerid][3], 0);
		PlayerTextDrawSetPreviewModel(playerid, t_pRoll[playerid][3], 1277);
		PlayerTextDrawSetPreviewRot(playerid, t_pRoll[playerid][3], 0.0000, 0.0000, 0.0000, 1.0000);

		t_pRoll[playerid][4] = CreatePlayerTextDraw(playerid, 342.5000, 208.9333, ""); // пусто
		PlayerTextDrawTextSize(playerid, t_pRoll[playerid][4], 47.0000, 51.0000);
		PlayerTextDrawAlignment(playerid, t_pRoll[playerid][4], 1);
		PlayerTextDrawColor(playerid, t_pRoll[playerid][4], -1);
		PlayerTextDrawBackgroundColor(playerid, t_pRoll[playerid][4], 303174144);
		PlayerTextDrawFont(playerid, t_pRoll[playerid][4], 5);
		PlayerTextDrawSetProportional(playerid, t_pRoll[playerid][4], 0);
		PlayerTextDrawSetShadow(playerid, t_pRoll[playerid][4], 0);
		PlayerTextDrawSetPreviewModel(playerid, t_pRoll[playerid][4], 411);
		PlayerTextDrawSetPreviewRot(playerid, t_pRoll[playerid][4], 0.0000, 0.0000, 20.0000, 1.0000);
		PlayerTextDrawSetPreviewVehCol(playerid, t_pRoll[playerid][4], 1, 1);

		t_pRoll[playerid][5] = CreatePlayerTextDraw(playerid, 300.5000, 278.0000, ""); // пусто
		PlayerTextDrawTextSize(playerid, t_pRoll[playerid][5], 37.0000, 40.0000);
		PlayerTextDrawAlignment(playerid, t_pRoll[playerid][5], 1);
		PlayerTextDrawColor(playerid, t_pRoll[playerid][5], -1);
		PlayerTextDrawBackgroundColor(playerid, t_pRoll[playerid][5], 303174144);
		PlayerTextDrawFont(playerid, t_pRoll[playerid][5], 5);
		PlayerTextDrawSetProportional(playerid, t_pRoll[playerid][5], 0);
		PlayerTextDrawSetShadow(playerid, t_pRoll[playerid][5], 0);
		PlayerTextDrawSetPreviewModel(playerid, t_pRoll[playerid][5], 46);
		PlayerTextDrawSetPreviewRot(playerid, t_pRoll[playerid][5], 0.0000, 0.0000, 20.0000, 1.0000);

		t_pRoll[playerid][6] = CreatePlayerTextDraw(playerid, 300.0000, 153.5555, ""); // пусто
		PlayerTextDrawTextSize(playerid, t_pRoll[playerid][6], 37.0000, 40.0000);
		PlayerTextDrawAlignment(playerid, t_pRoll[playerid][6], 1);
		PlayerTextDrawColor(playerid, t_pRoll[playerid][6], -1);
		PlayerTextDrawBackgroundColor(playerid, t_pRoll[playerid][6], 303174144);
		PlayerTextDrawFont(playerid, t_pRoll[playerid][6], 5);
		PlayerTextDrawSetProportional(playerid, t_pRoll[playerid][6], 0);
		PlayerTextDrawSetShadow(playerid, t_pRoll[playerid][6], 0);
		PlayerTextDrawSetPreviewModel(playerid, t_pRoll[playerid][6], 46);
		PlayerTextDrawSetPreviewRot(playerid, t_pRoll[playerid][6], 0.0000, 0.0000, 20.0000, 1.0000);

		t_pRoll[playerid][7] = CreatePlayerTextDraw(playerid, 244.0000, 209.5555, ""); // пусто
		PlayerTextDrawTextSize(playerid, t_pRoll[playerid][7], 47.0000, 51.0000);
		PlayerTextDrawAlignment(playerid, t_pRoll[playerid][7], 1);
		PlayerTextDrawColor(playerid, t_pRoll[playerid][7], -1);
		PlayerTextDrawBackgroundColor(playerid, t_pRoll[playerid][7], 303174144);
		PlayerTextDrawFont(playerid, t_pRoll[playerid][7], 5);
		PlayerTextDrawSetProportional(playerid, t_pRoll[playerid][7], 0);
		PlayerTextDrawSetShadow(playerid, t_pRoll[playerid][7], 0);
		PlayerTextDrawSetPreviewModel(playerid, t_pRoll[playerid][7], 460);
		PlayerTextDrawSetPreviewRot(playerid, t_pRoll[playerid][7], 0.0000, 0.0000, 20.0000, 1.0000);
		PlayerTextDrawSetPreviewVehCol(playerid, t_pRoll[playerid][7], 1, 1);

		for(new i; i < 8; i++)
		{
			gRollPrizes[playerid][i-9] = roll_gift[random(sizeof roll_gift)];

			PlayerTextDrawSetPreviewModel(playerid, t_pRoll[playerid][i], gRollPrizes[playerid][i-9]);
		}

		for(new i; i < sizeof gRoll; i++) TextDrawShowForPlayer(playerid, gRoll[i]);	

                for(new i; i < 8; i++) PlayerTextDrawShow(playerid, t_pRoll[playerid][i]);

		SelectTextDraw(playerid, 0xFFFFFFFF);
	}	
	else if(1 == gRollStatus{playerid})
	{
		for(new i; i < sizeof gRoll; i++) TextDrawHideForPlayer(playerid, gRoll[i]);
 for(new i; i < 8; i++) PlayerTextDrawDestroy(playerid, t_pRoll[playerid][i]);

		CancelSelectTextDraw(playerid);	
	}
}
Парочка скринов​


[HR][/HR]

При размещении на другие порталы, указывайте авторов.

#Djuga - Функционал
#Rips - Дизайн рулетки​







 
Последнее редактирование:
Статус
В этой теме нельзя размещать новые ответы.
Сверху Снизу