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

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

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

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

Каша-малаша, не работает регистрация после написания авторизации.

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

tookieWookie

Ученик
Я учусь, смотрю видеоролики и делаю всё так, как сказано там.
Всё шло хорошо, регистрация работала, текстдравы все работали, с sql запросами беды все были решены, в общем всё работало, пока не принялся делать авторизацию.

1. очень странно работает проверка на символы в пароле при регистрации, проверка стоит на не < 6 и не > 32 символов, но на практике 6 символов он не пропускает, мало говорит, 7 пропустит.

2. после того, как ввёл пароль, диалог пропадает и больше ничего не появляется. ( с чего бы это вдруг? вроде регистрацию не трогал, только авторизацией занимался, тем более что всё делал по гайду, даже перепроверил неск. раз )


Код:
#define GM_NAME     	"Role Play v0.16"
#define GN(%0)      	player[%0][pname]
#define SCM         	SendClientMessage
#define SPD         	ShowPlayerDialog
#define DSI				DIALOG_STYLE_INPUT
#define DSL				DIALOG_STYLE_LIST
#define DSM             DIALOG_STYLE_MSGBOX
#define Tkick(%0) 		SetTimerEx("@_TimeKick", 100, false, "i", %0)
#define Freeze(%0,%1)	TogglePlayerControllable(%0, %1)
#define DSP             DIALOG_STYLE_PASSWORD
Код:
#if !defined isnull
#define isnull(%0)      ((!(%0[0])) || (((%0[0]) == '\1') && (!(%0[1]))))
#endif
Код:
new
// Переменные
	connect_mysql,
// Массивы
	number_skin[MAX_PLAYERS char],
	number_pass[MAX_PLAYERS char],
	
	update_timer[MAX_PLAYERS],
	
	Text: td_select_skin[MAX_PLAYERS][3],
// Массивы BOOL типа
	bool: login_check[MAX_PLAYERS char];
// Enum'ы
enum pInfo {
	pname[MAX_PLAYER_NAME+1], ppass[32+1], pmail[60+1], plevel, pmoney, psex, pskin, page, pnations, pid, preferal_check, preferal[MAX_PLAYER_NAME+1]
}

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	switch(dialogid)
	{
	    case 1:
	    {
			if(response)
			{
			    new
			        len = strlen(inputtext);
			        
				if(!len)
				{
				    SCM(playerid, COLOR_GREY, !"Вы ничего не ввели!");
				    DialogRegistration(playerid);
				    return true;
				}
				if(!(6 < len < 32))
				{
				    SCM(playerid, COLOR_GREY, !"Неверная длина пароля!");
				    DialogRegistration(playerid);
				    return true;
				}
				if(CheckRussian(inputtext, 32+1))
				{
				    SCM(playerid, COLOR_GREY, !"Смените раскладку клавиатуры!");
				    DialogRegistration(playerid);
				    return true;
				}
				
				strmid(player[playerid][ppass], inputtext, 0, len, 32+1);
				DialogEmail(playerid);
			}
			else
			{
			    SCM(playerid, COLOR_LIGHTRED, !"Введите (/q)uit чтобы выйти");
				Tkick(playerid);
			}
	    }
	    case 2:
	    {
	        if(response)
	        {
	            new
			        len = strlen(inputtext);

				if(!len)
				{
				    SCM(playerid, COLOR_GREY, !"Вы ничего не ввели!");
				    DialogEmail(playerid);
				    return true;
				}
				if(len > 60)
				{
				    SCM(playerid, COLOR_GREY, !"Неверная длина E-Mail!");
				    DialogEmail(playerid);
				    return true;
				}
				if(strfind(inputtext, "@", false) == -1 || strfind(inputtext, ".", false) == -1)
				{
				    SCM(playerid, COLOR_GREY, !"Неверный формат E-Mail!");
				    DialogEmail(playerid);
				    return true;
				}
				if(CheckRussian(inputtext, 60+1))
				{
			        SCM(playerid, COLOR_GREY, !"Смените раскладку клавиатуры!");
				    DialogEmail(playerid);
				    return true;
				}
				strmid(player[playerid][pmail], inputtext, 0, len, 60+1);
				DialogNations(playerid);
	        }
	        else
	            DialogRegistration(playerid);
	    }
	    case 3:
	    {
	        if(response)
	        {
	            player[playerid][pnations] = listitem+1;
	            DialogAge(playerid);
	        }
	        else
	            DialogEmail(playerid);
	    }
	    case 4:
	    {
	        if(response)
	        {
	            new
	                val = strval(inputtext);
	                
	            if(!strlen(inputtext))
				{
				    SCM(playerid, COLOR_GREY, !"Вы ничего не ввели!");
				    DialogAge(playerid);
				    return true;
				}
				if(!(18 < val < 60))
				{
				    SCM(playerid, COLOR_GREY, !"Длина возраста от 18-ти до 60-ти!");
				    DialogAge(playerid);
				    return true;
				}
				
				player[playerid][page] = val;
				DialogReferal(playerid);
	        }
	        else
	            DialogNations(playerid);
	    }
	    case 5:
		{
		    if(response)
		    {
		        if(isnull(inputtext))
				{
				    SCM(playerid, COLOR_GREY, !"Вы ничего не ввели!");
				    DialogReferal(playerid);
				    return true;
				}
				
				static
	    			fmt_str[] = "SELECT * FROM `accounts` WHERE `Name` = '%s'";
				new
				    string[sizeof(fmt_str)+MAX_PLAYER_NAME-1];

				mysql_format(connect_mysql, string, sizeof(string), fmt_str, (inputtext));
				mysql_function_query(connect_mysql, string, true, "@_CheckReferal", "ds", playerid, inputtext);
		    }
		    else
		    {
		        strmid(player[playerid][preferal], "None", 0, strlen("None"), 4+1);
			    DialogSex(playerid);
			}
		}
		case 6:
		{
		    SpawnPlayer(playerid);
		    if(response)
		    {
			    player[playerid][psex] = 1;
			    SetPlayerSkin(playerid, 78);
			    number_skin{playerid} = 1;
			}
		    else
		    {
			    player[playerid][psex] = 2;
			    SetPlayerSkin(playerid, 10);
			    number_skin{playerid} = 11;
			}
			    
			for(new i; i != 3; i++) TextDrawShowForPlayer(playerid, td_select_skin[playerid][i]);
			SelectTextDraw(playerid, 0xFF0000FF);
			SetPlayerVirtualWorld(playerid, playerid);
			SetPlayerInterior(playerid, 5);
			SetPlayerPos(playerid, 226.3548,-8.1306,1002.2109);
			SetPlayerFacingAngle(playerid, 90.4092);
			SetPlayerCameraPos(playerid, 221.8495,-8.1760,1002.2109);
			SetPlayerCameraLookAt(playerid, 226.3548,-8.1306,1002.2109);
			Freeze(playerid, 0);
		}
		case 7:
		{
		    if(response)
		    {
		        if(isnull(inputtext))
				{
				    SCM(playerid, COLOR_GREY, !"Вы ничего не ввели!");
				    DialogAutorization(playerid);
				    return true;
				}
				
				static
				    fmt_str[] = "SELECT * FROM `accounts` WHERE `Name` = '%s' AND `Pass` = '%s'";
				new
				    string[sizeof(fmt_str)+MAX_PLAYER_NAME+29];

				mysql_format(connect_mysql, string, sizeof(string), fmt_str, GN(playerid), inputtext);
				mysql_function_query(connect_mysql, string, true, "@_OnLogin", "d", playerid);
		    }
		    else
			{
			    SCM(playerid, COLOR_LIGHTRED, !"Введите (/q)uit чтобы выйти");
				Tkick(playerid);
			}
		}
	}
	return true;

Код:
public OnPlayerConnect(playerid)
{
	GetPlayerName(playerid, player[playerid][pname], MAX_PLAYER_NAME);
 	static
	    fmt_str[] = "SELECT * FROM `accounts` WHERE `Name` = '%s'";
	new
	    string[sizeof(fmt_str)+MAX_PLAYER_NAME-1];

	mysql_format(connect_mysql, string, sizeof(string), fmt_str, GN(playerid));
	mysql_function_query(connect_mysql, string, true, "@_PlayerCheck", "d", playerid);
	Clear(playerid);
	PlayerTextDraws(playerid);
	return true;
}
public OnPlayerDisconnect(playerid, reason)
{
    KillTimers(playerid);
	return true;
}
public OnPlayerSpawn(playerid)
{
	if(login_check{playerid} == true)
 		SetPlayerSpawn(playerid);
	    
	return true;
}

Код:
public OnPlayerText(playerid, text[])
{
	if(login_check{playerid} == false)
	{
	    SCM(playerid, COLOR_GREY, !"Вы не авторизованы!");
	    return false;
	}
	
	return false;
}
}
Код:
public OnPlayerCommandReceived(playerid, cmd[], params[], flags)
{
    if(login_check{playerid} == false)
	{
	    SCM(playerid, COLOR_GREY, !"Вы не авторизованы!");
	    return false;
	}
	
	return true;
}
}
Код:
public OnPlayerClickTextDraw(playerid, Text: clickedid)
{
	if(clickedid == Text:INVALID_TEXT_DRAW && number_skin{playerid} > 0)
	    SelectTextDraw(playerid, 0xFF0000FF);
	if(clickedid == td_select_skin[playerid][0])
	{
	    number_skin{playerid} ++;
	    if(player[playerid][psex] == 1)
		{
	        if(number_skin{playerid} == 11)
	            number_skin{playerid} = 1;
		}
	    else
	    {
	        if(number_skin{playerid} == 24)
	            number_skin{playerid} = 11;
		}
	    
	    switch(number_skin{playerid})
	    {
	        // Мужские
	        case 1: SetPlayerSkin(playerid, 78);
	        case 2: SetPlayerSkin(playerid, 79);
	        case 3: SetPlayerSkin(playerid, 134);
	        case 4: SetPlayerSkin(playerid, 135);
	        case 5: SetPlayerSkin(playerid, 136);
	        case 6: SetPlayerSkin(playerid, 137);
	        case 7: SetPlayerSkin(playerid, 160);
	        case 8: SetPlayerSkin(playerid, 200);
	        case 9: SetPlayerSkin(playerid, 212);
	        case 10: SetPlayerSkin(playerid, 230);
	        // Женские
	        case 11: SetPlayerSkin(playerid, 10);
	        case 12: SetPlayerSkin(playerid, 39);
	        case 13: SetPlayerSkin(playerid, 54);
	        case 14: SetPlayerSkin(playerid, 75);
	        case 15: SetPlayerSkin(playerid, 77);
	        case 16: SetPlayerSkin(playerid, 89);
	        case 17: SetPlayerSkin(playerid, 129);
	        case 18: SetPlayerSkin(playerid, 130);
	        case 19: SetPlayerSkin(playerid, 196);
	        case 20: SetPlayerSkin(playerid, 197);
	        case 21: SetPlayerSkin(playerid, 199);
	        case 22: SetPlayerSkin(playerid, 218);
	        case 23: SetPlayerSkin(playerid, 232);
	    }
	}
	if(clickedid == td_select_skin[playerid][1])
	{
	    number_skin{playerid} --;
	    if(player[playerid][psex] == 1)
	    {
	        if(number_skin{playerid} == 0)
	            number_skin{playerid} = 10;
		}
	    else
	    {
	        if(number_skin{playerid} == 10)
	            number_skin{playerid} = 23;
		}

	    switch(number_skin{playerid})
	    {
	        // Мужские
	        case 1: SetPlayerSkin(playerid, 78);
	        case 2: SetPlayerSkin(playerid, 79);
	        case 3: SetPlayerSkin(playerid, 134);
	        case 4: SetPlayerSkin(playerid, 135);
	        case 5: SetPlayerSkin(playerid, 136);
	        case 6: SetPlayerSkin(playerid, 137);
	        case 7: SetPlayerSkin(playerid, 160);
	        case 8: SetPlayerSkin(playerid, 200);
	        case 9: SetPlayerSkin(playerid, 212);
	        case 10: SetPlayerSkin(playerid, 230);
	        // Женские
	        case 11: SetPlayerSkin(playerid, 10);
	        case 12: SetPlayerSkin(playerid, 39);
	        case 13: SetPlayerSkin(playerid, 54);
	        case 14: SetPlayerSkin(playerid, 75);
	        case 15: SetPlayerSkin(playerid, 77);
	        case 16: SetPlayerSkin(playerid, 89);
	        case 17: SetPlayerSkin(playerid, 129);
	        case 18: SetPlayerSkin(playerid, 130);
	        case 19: SetPlayerSkin(playerid, 196);
	        case 20: SetPlayerSkin(playerid, 197);
	        case 21: SetPlayerSkin(playerid, 199);
	        case 22: SetPlayerSkin(playerid, 218);
	        case 23: SetPlayerSkin(playerid, 232);
	    }
	}
	if(clickedid == td_select_skin[playerid][2])
	{
	    for(new i; i != 3; i++) TextDrawHideForPlayer(playerid, td_select_skin[playerid][i]);
	    SCM(playerid, COLOR_WHITE, !"Вы успешно зарегистрировались");
	    login_check{playerid} = true;
	    update_timer[playerid] = SetTimerEx("@_UpdateTime", 1_000, false, "i", playerid);
	    Freeze(playerid, 1);
	    number_skin{playerid} = 0;
	    CancelSelectTextDraw(playerid);
	    // Создание аккаунта
	    player[playerid][plevel] = 1;
	    player[playerid][pmoney] = 0;
	    player[playerid][pskin] = GetPlayerSkin(playerid);
	    static
		    fmt_str[] =
			"\
				INSERT INTO `accounts` (`Name`, `Pass`, `Mail`, `Sex`, `Skin`, `Age`, `Nations`, `Level`, `Referal`, `Referal Check`) VALUES ('%s', '%s', \
				'%s', '%d', '%d', '%d', '%d', '%d', '%s', '%d')\
			",
			fmt_str_2[] = "SELECT * FROM `accounts` WHERE `Name` = '%s'";
		new
		    string[sizeof(fmt_str)+MAX_PLAYER_NAME*2+85],
		    string_2[sizeof(fmt_str_2)+MAX_PLAYER_NAME-1];

		mysql_format(connect_mysql, string, sizeof(string), fmt_str,
		player[playerid][pname], player[playerid][ppass], player[playerid][pmail], player[playerid][psex], player[playerid][pskin], player[playerid][page],
		player[playerid][pnations], player[playerid][plevel], player[playerid][preferal], player[playerid][preferal_check]);
		
		mysql_format(connect_mysql, string_2, sizeof(string_2), fmt_str_2, player[playerid][pname]);
		mysql_function_query(connect_mysql, string, true, "", "");
		mysql_function_query(connect_mysql, string_2, true, "@_GetID", "i", playerid);
	    SpawnPlayer(playerid);
	}
	return true;
}
Код:
@_OnLogin(playerid);
@_OnLogin(playerid)
{
	new
	    rows,
	    fields;

	cache_get_data(rows, fields);
	if(rows)
	{
	    cache_get_field_content(0, "Pass", player[playerid][ppass], connect_mysql, 32);
	    cache_get_field_content(0, "Mail", player[playerid][pmail], connect_mysql, 60);
	    cache_get_field_content(0, "Referal", player[playerid][preferal], connect_mysql, MAX_PLAYER_NAME);
	    player[playerid][plevel] = cache_get_field_content_int(0, "Level");
	    player[playerid][pmoney] = cache_get_field_content_int(0, "Money");
	    player[playerid][pskin] = cache_get_field_content_int(0, "Skin");
	    player[playerid][psex] = cache_get_field_content_int(0, "Sex");
	    player[playerid][preferal_check] = cache_get_field_content_int(0, "Referal Check");
	    player[playerid][page] = cache_get_field_content_int(0, "Age");
	    player[playerid][pnations] = cache_get_field_content_int(0, "Nations");
	    //
	    login_check{playerid} = true;
	    SetTimerEx("@_FastSpawn", 100, false, "i", playerid);
	    update_timer[playerid] = SetTimerEx("@_UpdateTime", 1_000, false, "i", playerid);
	}
	else
	{
	    number_pass{playerid} ++;
	    if(number_pass{playerid} == 3)
	    {
	        SCM(playerid, COLOR_LIGHTRED, !"Попытки на авторизацию кончились, введите /q");
	        Tkick(playerid);
	        return true;
	    }
	    
	    static const
		    fmt_str[] = "Неверный пароль, осталось попыток: %d";
		new
		    string[sizeof(fmt_str)];

		format(string, sizeof(string), fmt_str, 3-number_pass{playerid});
		SCM(playerid, COLOR_RED, string);
	    DialogAutorization(playerid);
	}
	return true;
}

Кстати, заметил странную особенность.
Автор гайдов выкладывает каждую серию билд мода который пишет в этой серии. В общем, я скачал его мод, и попытался запустить у себя - проблема такая же, хотя у него на видосе всё работает.
 
Последнее редактирование:
Статус
В этой теме нельзя размещать новые ответы.
Сверху Снизу