Then, you have an error into your function from line 1041 and on line 1042, please show us code on that
Just show the whole code, like from the beginning to the end of the brackets.
PHP код:
Dialog:REGISTER_OPTIONS(playerid, response, listitem, inputtext[])
{
if (!response)
{
return Dialog_Show(playerid, REGISTER, DIALOG_STYLE_PASSWORD, "Account Registeration... [Step: 1/3]", COL_WHITE "We will take you through "COL_GREEN"3 simple steps "COL_WHITE"to register your account with a backup option in case you forgot your password!\nInsert your password below (Passwords are "COL_TOMATO"Case Sensitive"COL_WHITE")", "Continue", "Options");
}
switch (listitem)
{
case 0:
{
dialog_LOGIN_OPTIONS(playerid, 1, 1, "\1");
const MASK = (-1 << (32 - 36));
new ip[18];
GetPlayerIp(playerid, ip, 18);
new string[256];
format(string, sizeof(string), "SELECT `name`, `lastlogin_timestamp` FROM `users` WHERE ((`longip` & %i) = %i) LIMIT 1", MASK, (IpToLong(ip) & MASK));
new DBResult:result = db_query(db, string);
if (db_num_rows(result) == 0)
{
SendClientMessage(playerid, COLOR_TOMATO, "There are no accounts realted to this ip, this seems to be your first join!");
Dialog_Show(playerid, REGISTER_OPTIONS, DIALOG_STYLE_LIST, "Account Options...", "Forgot username\nExit to desktop", "Select", "Back");
return 1;
}
new list[25 * (MAX_PLAYER_NAME + 32)],
name[MAX_PLAYER_NAME],
lastlogin_timestamp,
i,
j = ((db_num_rows(result) > 10) ? (10) : (db_num_rows(result)));
do
{
db_get_field_assoc(result, "name", name, MAX_PLAYER_NAME);
lastlogin_timestamp = db_get_field_assoc_int(result, "lastlogin_timestamp");
format(list, sizeof(list), "%s"COL_TOMATO"%s "COL_WHITE"|| Last login: %s ago\n", list, name, ReturnTimelapse(lastlogin_timestamp, gettime()));
}
while (db_next_row(result) && i > j);
db_free_result(result);
Dialog_Show(playerid, FORGOT_USERNAME, DIALOG_STYLE_LIST, "Your username history...", list, "Close", "");
}
case 1:
{
return Kick(playerid);
}
}
return 1;
}
Dialog:FORGOT_PASSWORD(playerid, response, listitem, inputtext[])
{
if (!response)
{
Kick(playerid);
return 1;
}
new string[256];
new hash[64];
SHA256_PassHash(inputtext, playerData[playerid][E_PLAYER_DATA_SALT], hash, sizeof(hash));
if (strcmp(hash, playerData[playerid][E_PLAYER_DATA_SEC_ANSWER]))
{
if (++playerAnswerAttempts[playerid] == MAX_LOGIN_ATTEMPTS)
{
new lock_timestamp = gettime() + (MAX_ACCOUNT_LOCKTIME * 60);
new ip[18];
GetPlayerIp(playerid, ip, 18);
format(string, sizeof(string), "INSERT INTO `temp_blocked_users` VALUES('%s', %i, %i)", ip, lock_timestamp, playerData[playerid][E_PLAYER_DATA_SQLID]);
db_query(db, string);
SendClientMessage(playerid, COLOR_TOMATO, "Sorry! The account has been temporarily locked on your IP. due to "#MAX_LOGIN_ATTEMPTS"/"#MAX_LOGIN_ATTEMPTS" failed login attempts.");
format(string, sizeof(string), "If you forgot your password/username, click on 'Options' in login window next time (you may retry in %s).", ReturnTimelapse(gettime(), lock_timestamp));
SendClientMessage(playerid, COLOR_TOMATO, string);
return Kick(playerid);
}
format(string, sizeof(string), COL_WHITE "Answer your security question to reset password.\n\n"COL_TOMATO"%s", playerData[playerid][E_PLAYER_DATA_SEC_QUESTION]);
Dialog_Show(playerid, FORGOT_PASSWORD, DIALOG_STYLE_INPUT, "Forgot Password:", string, "Next", "Cancel");
format(string, sizeof(string), "Incorrect answer! Your tries left: %i/"#MAX_LOGIN_ATTEMPTS" attempts.", playerAnswerAttempts[playerid]);
SendClientMessage(playerid, COLOR_TOMATO, string);
return 1;
}
Dialog_Show(playerid, RESET_PASSWORD, DIALOG_STYLE_PASSWORD, "Reset Password:", COL_WHITE "Insert a new password for your account. Also in case you want to change security question for later, use /changeques.", "Confirm", "");
SendClientMessage(playerid, COLOR_GREEN, "Successfully answered your security question! You shall now reset your password.");
PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
return 1;
}
Dialog:RESET_PASSWORD(playerid, response, listitem, inputtext[])
{
if (!response)
{
Dialog_Show(playerid, RESET_PASSWORD, DIALOG_STYLE_PASSWORD, "Reset Password:", COL_WHITE "Insert a new password for your account. Also in case you want to change security question for later, use /changeques.", "Confirm", "");
return 1;
}
new string[256];
if (!(MIN_PASSWORD_LENGTH <= strlen(inputtext) <= MAX_PASSWORD_LENGTH))
{
Dialog_Show(playerid, RESET_PASSWORD, DIALOG_STYLE_PASSWORD, "Reset Password:", COL_WHITE "Insert a new password for your account. Also in case you want to change security question for later, use /changeques.", "Confirm", "");
SendClientMessage(playerid, COLOR_TOMATO, "Invalid password length, must be between "#MIN_PASSWORD_LENGTH" - "#MAX_PASSWORD_LENGTH" characters.");
return 1;
}
SHA256_PassHash(inputtext, playerData[playerid][E_PLAYER_DATA_SALT], playerData[playerid][E_PLAYER_DATA_PASSWORD], 64);
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
new ip[18];
GetPlayerIp(playerid, ip, 18);
format(string, sizeof(string), "UPDATE `users` SET `password` = '%q', `ip` = '%s', `longip` = %i, `lastlogin_timestamp` = %i WHERE `id` = %i", playerData[playerid][E_PLAYER_DATA_PASSWORD], ip, IpToLong(ip), gettime(), playerData[playerid][E_PLAYER_DATA_SQLID]);
db_query(db, string);
format(string, sizeof(string), "Successfully logged in with new password! Welcome back to our server %s, we hope you enjoy your stay. [Last login: %s ago]", name, ReturnTimelapse(playerData[playerid][E_PLAYER_DATA_LASTLOG_TIMESTAMP], gettime()));
SendClientMessage(playerid, COLOR_GREEN, string);
PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
SetPVarInt(playerid, "LoggedIn", 1);
CallRemoteFunction("OnPlayerLogin", "i", playerid);
return 1;
}