07.07.2016, 14:16
Hello guys, I have this problem with my script. The issue is that, whenever I create a character, it loads fine & that stuff, but whenever I log out and log in a again, it asks me to register a new account, and it duplicates that current account with another one in the database.
^ is on player connect.
pawn Код:
new query[100];
mysql_format(sqlHandle, query, sizeof(query), "SELECT `password`, `salt` FROM `samp_users` WHERE `user` = '%e'", PlayerInfo[playerid][pName]);
mysql_function_query(sqlHandle, query, true, "OnPlayerConnectMessage", "i", playerid);
pawn Код:
forward OnPlayerConnectMessage(playerid);
public OnPlayerConnectMessage(playerid)
{
new rows,
fields;
cache_get_data(rows, fields);
if(IsPlayerNPC(playerid)) return 1;
if(rows == 0)
{
InterpolateCameraPos(playerid, 2063.923339, -1702.275024, 34.853111, 2089.476318, -1807.090942, 20.214666, 12000);
InterpolateCameraLookAt(playerid, 2065.908203, -1706.804077, 34.113159, 2094.372070, -1807.174194, 19.202371, 12000);
InterpolateCameraPos(playerid, 1655.096923, -1577.136230, 75.375434, 1711.800170, -1632.878051, 72.387596, 12000);
InterpolateCameraLookAt(playerid, 1655.198974, -1582.068359, 74.560607, 1706.827392, -1633.183715, 71.966285, 12000);
InterpolateCameraPos(playerid, 2200.799560, -1708.760986, 24.258514, 2067.180419, -1718.331054, 35.945064, 12000);
InterpolateCameraLookAt(playerid, 2195.925048, -1708.421142, 23.198024, 2071.677246, -1716.617187, 34.587982, 12000);
//ShowPlayerDialog(playerid, DIALOG_REG_LEAVE, DIALOG_STYLE_MSGBOX, "{FF9900}Registration", "Welcome to {FF9900}GM-Name{A9C4E4}!\n\nThis username is not registered, please visit {FF9900}www.losangelesrp.org/{A9C4E4} in order to register this account.", "Leave", "");*/
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "{FF9900}Registration", "Welcome to {FF9900}LA:RP{A9C4E4}!\n\nThis username is not registered. Please enter your desired password in case you would like to register a new account:", "Submit", "Leave");
}
else
{
new welcomeMessage[125];
cache_get_row(0, 0, PlayerInfo[playerid][pPassword], sqlHandle, 129);
cache_get_row(0, 1, PlayerInfo[playerid][pSalt], sqlHandle, 64);
format(welcomeMessage, sizeof(welcomeMessage), "Welcome back, {FF9900}%s{A9C4E4}!\n\nPlease enter your password below in order to verify yourself:", GetNameWithSpace(playerid));
InterpolateCameraPos(playerid, 2063.923339, -1702.275024, 34.853111, 2089.476318, -1807.090942, 20.214666, 12000);
InterpolateCameraLookAt(playerid, 2065.908203, -1706.804077, 34.113159, 2094.372070, -1807.174194, 19.202371, 12000);
InterpolateCameraPos(playerid, 1655.096923, -1577.136230, 75.375434, 1711.800170, -1632.878051, 72.387596, 12000);
InterpolateCameraLookAt(playerid, 1655.198974, -1582.068359, 74.560607, 1706.827392, -1633.183715, 71.966285, 12000);
InterpolateCameraPos(playerid, 2200.799560, -1708.760986, 24.258514, 2067.180419, -1718.331054, 35.945064, 12000);
InterpolateCameraLookAt(playerid, 2195.925048, -1708.421142, 23.198024, 2071.677246, -1716.617187, 34.587982, 12000);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "{FF9900}Welcome", welcomeMessage, "Login", "Leave");
}
TextDrawShowForPlayer(playerid, TD_Website);
return 1;
}