Доступ к готовым решениям

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

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

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

Урок Защита аккаунта!

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

SporTsmaN

Компетентный
Всем привет! Выкладываю свою защиту аккаунта. Если такие темы были, извиняюсь. Говорю сразу, что прям очень подробно объяснять не буду, всё очень просто и понятно. Главное задумка, что вроде-бы нет стиллеров (я особо не наблюдаю за подобной тематикой), которые могут считать TextDraw.

PHP:
new Text:DopPasBox;
new Text:DopPasKey[12];
new PlayerText:DopPasText[MAX_PLAYERS];

#define SCM SendClientMessage
#define COLOR_LIGHTBLUE 0x33CCFFAA


enum pInfo
{
    pOtherPass
};
new Player[MAX_PLAYERS][pInfo];


public OnGameMode()
{
	DopPasBox = TextDrawCreate(360.500000, 220.249969, "usebox");
	TextDrawLetterSize(DopPasBox, 0.0, 11.674073);
	TextDrawTextSize(DopPasBox, 278.0, 0.000000);
	TextDrawAlignment(DopPasBox, 1);
	TextDrawColor(DopPasBox, 0);
	TextDrawUseBox(DopPasBox, true);
	TextDrawBoxColor(DopPasBox, 102);
	TextDrawSetShadow(DopPasBox, 0);
	TextDrawSetOutline(DopPasBox, 0);
	TextDrawFont(DopPasBox, 0);
    DopPasKey[0] = TextDrawCreate(313.500000, 299.249877, "0");
    TextDrawTextSize(DopPasKey[0], 321.0, 12.666503);
	DopPasKey[1] = TextDrawCreate(297.500000, 245.000030, "1");
	TextDrawTextSize(DopPasKey[1], 305.558776, 12.666503);
	DopPasKey[2] = TextDrawCreate(314.0, 245.0, "2");
	TextDrawTextSize(DopPasKey[2], 322.500000, 17.499511);
	DopPasKey[3] = TextDrawCreate(331.0, 245.000091, "3");
	TextDrawTextSize(DopPasKey[3], 340.0, 12.666503);
	DopPasKey[4] = TextDrawCreate(296.500000, 264.249877, "4");
	TextDrawTextSize(DopPasKey[4], 305.500000, 12.666503);
	DopPasKey[5] = TextDrawCreate(313.500000, 263.666687, "5");
	TextDrawTextSize(DopPasKey[5], 322.0,12.666503);
	DopPasKey[6] = TextDrawCreate(330.500000, 264.250000, "6");
	TextDrawTextSize(DopPasKey[6], 339.0, 12.666503);
	DopPasKey[7] = TextDrawCreate(296.500000, 281.750061, "7");
	TextDrawTextSize(DopPasKey[7], 304.500000, 12.666503);
	DopPasKey[8] = TextDrawCreate(313.500000, 281.750000, "8");
	TextDrawTextSize(DopPasKey[8], 322.0,12.666503);
	DopPasKey[9] = TextDrawCreate(330.0, 281.750061, "9");
	TextDrawTextSize(DopPasKey[9], 338.0, 12.666503);
	DopPasKey[10] = TextDrawCreate(296.500000, 299.249969, "c");
	TextDrawTextSize(DopPasKey[10], 304.500000, 12.666503);
	DopPasKey[11] = TextDrawCreate(329.0, 301.000030, ">");
	TextDrawTextSize(DopPasKey[11], 338.0, 12.666503);
	for(new i; i < 12; i++)
	{
    	TextDrawLetterSize(DopPasKey[i], 0.449999, 1.600000);
		TextDrawAlignment(DopPasKey[i], 0);
		TextDrawColor(DopPasKey[i], -1378294017);
		TextDrawSetShadow(DopPasKey[i], 0);
		TextDrawSetOutline(DopPasKey[i], 0);
		TextDrawBackgroundColor(DopPasKey[i], 51);
		TextDrawFont(DopPasKey[i], 3);
		TextDrawSetProportional(DopPasKey[i], 1);
		TextDrawSetSelectable(DopPasKey[i], true);
	}
	return true;
}
public OnPlayerConnect(playerid)
{
    Player[playerid][pOtherPass] = 0;
    
    
	DopPasText[playerid] = CreatePlayerTextDraw(i, 319.500000, 227.833312, "-");
	PlayerTextDrawLetterSize(i, DopPasText[playerid], 0.285499, 1.223330);
	PlayerTextDrawTextSize(i, DopPasText[playerid], 313.0, 58.916694);
	PlayerTextDrawAlignment(i, DopPasText[playerid], 2);
	PlayerTextDrawColor(i, DopPasText[playerid], 65535);
	PlayerTextDrawUseBox(i, DopPasText[playerid], true);
	PlayerTextDrawBoxColor(i, DopPasText[playerid], -2139062017);
	PlayerTextDrawSetShadow(i, DopPasText[playerid], 0);
	PlayerTextDrawSetOutline(i, DopPasText[playerid], 0);
	PlayerTextDrawFont(i, DopPasText[playerid], 1);
	return true;
}


public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
	for(new i; i < 10; i++)
    {
        if(clickedid == DopPasKey[i])
        {
         	new pass[5];
            if(GetPVarInt(playerid, "ShowTextDopPass") == 1 || GetPVarInt(playerid, "ShowTextDopPass") == 3)
            {
		        GetPVarString(playerid, "DopPassword[0]", pass, sizeof(pass));
		        strinz = "";
		        format(strinz, 5, "%s%d", pass, i);
	            SetPVarString(playerid, "DopPassword[0]", strinz);
			}
			if(GetPVarInt(playerid, "ShowTextDopPass") == 2)
			{
				GetPVarString(playerid, "DopPassword[1]", pass, sizeof(pass));
				strinz = "";
		        format(strinz, 5, "%s%d", pass, i);
	            SetPVarString(playerid, "DopPassword[1]", strinz);
			}
			strinz = "";
   			for(new a = 0; a <= strlen(pass); a++) format(strinz, 5, "%sx", strinz);
            PlayerTextDrawSetString(playerid, DopPasText[playerid], strinz);
            return true;
		}
	}
    if(clickedid == DopPasKey[10]) // C
    {
        switch(GetPVarInt(playerid, "ShowTextDopPass"))
        {
        	case 1: SetPVarString(playerid, "DopPassword[0]", "");
        	case 2: SetPVarString(playerid, "DopPassword[1]", "");
        	case 3: SetPVarString(playerid, "DopPassword[0]", "");
        }
        PlayerTextDrawSetString(playerid, DopPasText[playerid], "-");
        return true;
    }
    if(clickedid == DopPasKey[11]) // >
    {
        new passcount[5];
        if(GetPVarInt(playerid, "ShowTextDopPass") == 1)
        {
            GetPVarString(playerid, "DopPassword[0]", passcount, sizeof(passcount));
            if(strlen(passcount) < 4) return SCM(playerid, COLOR_GREY, "Пароль должен состоять из 4 чисел.");
        	SCM(playerid, COLOR_LIGHTBLUE, "Введите дополнительный пароль ещё раз.");
        	PlayerTextDrawSetString(playerid, DopPasText[playerid], "-");
			SetPVarInt(playerid, "ShowTextDopPass", 2);
        }
        else if(GetPVarInt(playerid, "ShowTextDopPass") == 2)
        {
			new DopPass[2][5];
		    GetPVarString(playerid, "DopPassword[0]", DopPass[0], 5);
		    GetPVarString(playerid, "DopPassword[1]", DopPass[1], 5);
		    if(strcmp(DopPass[0], DopPass[1], true) == 0)
		    {
                Player[playerid][pOtherPass] = strval(DopPass[1]);
                //UpdateOtherValue(playerid, "OtherPass", Player[playerid][pOtherPass]); Сохарним в БД (У меня MySQL (как у Вас, я не знаю))
		        SCM(playerid, COLOR_LIGHTBLUE, "Дополнительный пароль установлен.");
                ProtectionHide(playerid);
		        CancelSelectTextDraw(playerid);
		    }
		    else
		    {
				if(strlen(DopPass[1]) < 4) return true;
		        SCM(playerid, 0xFFFFFFAA, "Повторный пароль введен не верно.");
		    }
        }
        else if(GetPVarInt(playerid, "ShowTextDopPass") == 3)
        {
   			new DopPassOk[5];
		    GetPVarString(playerid, "DopPassword[0]", DopPassOk, 5);
		    if(strval(DopPassOk) != Player[playerid][pOtherPass])
            {
	   			new count = GetPVarInt(playerid, "ProtectioCount");
				SetPVarInt(playerid, "ProtectioCount", count+1);
				if(count+1 >= 3) return Kick(playerid);
				return SCM(playerid, 0xFFFFFFAA, "Дополнительный пароль введен не верно. Попробуйте ещё раз.");
            }
            CancelSelectTextDraw(playerid);
            ProtectionHide(playerid);
            OnPlayerLoginYes(playerid);
        }
        return true;
    }
    //--------------------------------------------------------------------------
    else if(clickedid == Text:INVALID_TEXT_DRAW)
    {
    	if(GetPVarInt(playerid, "ShowTextDopPass") > 0)
        {
            if(GetPVarInt(playerid, "ShowTextDopPass") == 1 || GetPVarInt(playerid, "ShowTextDopPass") == 2) DiaProtection(playerid);
	 		for(new i; i < 12; i++) TextDrawHideForPlayer(playerid, DopPasKey[i]);
			if(GetPVarInt(playerid, "ShowTextDopPass") == 3) return Kick(playerid);
			ProtectionHide(playerid);
        }
    }
    
    return false;
}



public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmd, "/doppass", true) == 0)
	{
	    ProtectionShow(playerid, 1);
	}
	return true;
}





Ваш public/stock авторизации
{
	if(Player[playerid][pOtherPass] == 0)
	{
		// Если доп. пароль не установлен
	}
 	else
	{
	 	ProtectionShow(playerid, 3);
	}
	return true;
}



stock ProtectionShow(playerid, count)
{
	PlayerTextDrawSetString(playerid, DopPasText[playerid], "-");
	for(new i; i < 12; i++) TextDrawShowForPlayer(playerid, DopPasKey[i]);
	TextDrawShowForPlayer(playerid, DopPasBox);
	PlayerTextDrawShow(playerid, DopPasText[playerid]);
	SelectTextDraw(playerid, 0x4598A5FF);
	SetPVarInt(playerid, "ShowTextDraw", 1);
	SetPVarInt(playerid, "ShowTextDopPass", count);
	return true;
}
stock ProtectionHide(playerid)
{
	for(new i; i < 12; i++) TextDrawHideForPlayer(playerid, DopPasKey[i]);
	TextDrawHideForPlayer(playerid, DopPasBox);
	PlayerTextDrawHide(playerid, DopPasText[playerid]);
    DeletePVar(playerid, "DopPassword[0]");
    DeletePVar(playerid, "DopPassword[1]");
    DeletePVar(playerid, "ShowTextDopPass");
    DeletePVar(playerid, "ShowTextDraw");
	return true;
}


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