03.08.2018, 04:19
Plugins all loaded
server.cfg > plugins mysql Whirlpool
My problem is when i try to enter my password to register and enter it and all dialog is gone only spawn button to show
And nothing add to database
https://imgur.com/2OuBJ4x
Here is error logs :
This is the code :
server.cfg > plugins mysql Whirlpool
My problem is when i try to enter my password to register and enter it and all dialog is gone only spawn button to show
And nothing add to database
https://imgur.com/2OuBJ4x
Here is error logs :
Код:
[10:59:51] [plugins/mysql] error #1064 while executing query "INSERT INTO `players` (`Username`, `Password) VALUES ('Sssss', '1B898A6CB1E67EB486E88D1B0BDD675220BFE9F9AF56B6DE6B9F44078EDE135CBCD331EEC4DD619F62FE92D56F45CBC22A4F2F3033AF1814B059471FECF56EE5')": You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`Password) VALUES ('Sssss', '1B898A6CB1E67EB486E88D1B0BDD675220BFE9F9AF56B6DE6B9' at line 1
Код:
native WP_Hash(buffer[], len, const str[]); Added
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { switch (dialogid) { case DIALOG_UNUSED: return 1; // Useful for dialogs that contain only information and we do nothing depending on whether they responded or not case DIALOG_LOGIN: { if (!response) return Kick(playerid); new hashed_pass[129]; WP_Hash(hashed_pass, sizeof(hashed_pass), inputtext); if (strcmp(hashed_pass, PlayerInfo[playerid][pPassword]) == 0) { //correct password, spawn the player ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_MSGBOX, "Login", "You have been successfully logged in.", "Okay", ""); // sets the specified cache as the active cache so we can retrieve the rest player data cache_set_active(PlayerInfo[playerid][Cache_ID]); AssignPlayerData(playerid); // remove the active cache from memory and unsets the active cache as well cache_delete(PlayerInfo[playerid][Cache_ID]); PlayerInfo[playerid][Cache_ID] = MYSQL_INVALID_CACHE; KillTimer(PlayerInfo[playerid][LoginTimer]); PlayerInfo[playerid][LoginTimer] = 0; PlayerInfo[playerid][IsLoggedIn] = true; // spawn the player to their last saved position after login SetSpawnInfo(playerid, NO_TEAM, 0, PlayerInfo[playerid][pPosX], PlayerInfo[playerid][pPosY], PlayerInfo[playerid][pPosZ], PlayerInfo[playerid][pPosA], 0, 0, 0, 0, 0, 0); SpawnPlayer(playerid); } else { PlayerInfo[playerid][LoginAttempts]++; if (PlayerInfo[playerid][LoginAttempts] >= 3) { ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_MSGBOX, "Login", "You have mistyped your password too often (3 times).", "Okay", ""); DelayedKick(playerid); } else ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Wrong password!\nPlease enter your password in the field below:", "Login", "Abort"); } } case DIALOG_REGISTER: { if (!response) return Kick(playerid); if (strlen(inputtext) <= 5) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Registration", "Your password must be longer than 5 characters!\nPlease enter your password in the field below:", "Register", "Abort"); new query[500]; WP_Hash(PlayerInfo[playerid][pPassword], 129, inputtext); printf("Returned hash2: %s", PlayerInfo[playerid][pPassword]); mysql_format(g_SQL, query, sizeof query, "INSERT INTO `players` (`Username`, `Password) VALUES ('%e', '%s')", PlayerInfo[playerid][pName], PlayerInfo[playerid][pPassword]); mysql_tquery(g_SQL, query, "OnPlayerRegister", "d", playerid); } default: return 0; // dialog ID was not found, search in other scripts } return 1; }
Код:
forward OnPlayerDataLoaded(playerid, race_check); public OnPlayerDataLoaded(playerid, race_check) { if (race_check != g_MysqlRaceCheck[playerid]) return Kick(playerid); new string[115]; if(cache_num_rows() > 0) { cache_get_value(0, "Password", PlayerInfo[playerid][pPassword], 129); PlayerInfo[playerid][Cache_ID] = cache_save(); format(string, sizeof string, "This account (%s) is registered. Please login by entering your password in the field below:", PlayerInfo[playerid][pName]); ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", string, "Login", "Abort"); PlayerInfo[playerid][LoginTimer] = SetTimerEx("OnLoginTimeout", SECONDS_TO_LOGIN * 1000, false, "d", playerid); } else { format(string, sizeof string, "Welcome %s, you can register by entering your password in the field below:", PlayerInfo[playerid][pName]); ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Registration", string, "Register", "Abort"); } Camera(playerid); return 1; }