26.01.2014, 09:49
I have a problem, can someone tell why when i register a new account and i rejoin, i have to register again?
OnPlayerConnect
The public:
The register dialog:
mysql log:
What's wrong? lol
OnPlayerConnect
pawn Код:
new query[128];
new name[24];
GetPlayerName(playerid, name, sizeof(name));
new IP[16];
GetPlayerIp(playerid, IP, 16);
mysql_format(mysql, query, sizeof(query),"SELECT * FROM `playerdata` WHERE `user` = '%e' LIMIT 1", name);
mysql_tquery(mysql, query, "OnAccountCheck", "i", playerid);
new rows, fields;
cache_get_data(rows, fields, mysql);
if(rows)
{
cache_get_row(0, 2, PlayerInfo[playerid][Password], mysql, 129);
PlayerInfo[playerid][pAccountID] = cache_get_row_int(0, 0);
printf("%s", PlayerInfo[playerid][Password]);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login", "In order to play, you need to login", "Login", "Quit");
}
else
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Register", "In order to play, you need to register.", "Register", "Quit");
}
pawn Код:
public OnAccountCheck(playerid)
{
new rows, fields;
cache_get_data(rows, fields, mysql);
if(rows)
{
cache_get_row(0, 2, PlayerInfo[playerid][Password], mysql, 129);
PlayerInfo[playerid][pAccountID] = cache_get_row_int(0, 0);
printf("%s", PlayerInfo[playerid][Password]);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login", "In order to play, you need to login", "Login", "Quit");
}
else
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Register", "In order to play, you need to register.", "Register", "Quit");
}
return 1;
}
pawn Код:
new query[1000];
if(dialogid == DIALOG_REGISTER)
{
if(response)
{
new pname[24];
GetPlayerName(playerid, pname, sizeof(pname));
new IP[16];
GetPlayerIp(playerid, IP, sizeof(IP));
if(CheckInput(inputtext)) return SendClientMessage(playerid, 0x0000ff, "You cannot use this password.");
if(strlen(inputtext) < 4 || strlen(inputtext) > 20) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Register", "In order to play, you need to register.\nYour password must be at least min 4 characters and max 20.", "Register", "Quit");
WP_Hash(PlayerInfo[playerid][Password], 129, inputtext);
mysql_format(mysql, query, sizeof(query), "INSERT INTO playerdata (user, password, Scores, Cash, Admin, Deaths, Nopm, Muted, Vip, Warn, RegisterDate, Jailed, AdminActions, Cookies, Rank, VipTime, Class, PrototypesStolen, KillAsUsaTeam, KillAsGermanyTeam, KillAsItalyTeam, KillAsJapanTeam, KillAsMercTeam, KillAsMexicoTeam, IP, DaysAlive) VALUES('%s', '%s', 0, 0, 0, 0, 0, 0, 0, 0, '%s', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '%s', '0')", pname, PlayerInfo[Password], InsertTimeStamp(), IP);
mysql_tquery(mysql, query, "", "");
new Bannedby[20];
format(Bannedby, 20, "Not Banned");
Logged[playerid] = 1;
new stats[128];
format(stats, sizeof(stats), "UPDATE ServerStats SET TotalAccounts = TotalAccounts + 1");
mysql_function_query(mConnectionHandle, stats, false, "", "");
WindowForPlayer(playerid, "You are now ~r~registered ~w~to Battlefield War Heroes! Enjoy playing!");
WelcomeDialog(playerid);
new echo[130];
new kname[24];
GetPlayerName(playerid, kname, 24);
format(echo,sizeof(echo),"0,3** System: %s (%d) (IP: %s) has registered a new account",pname,playerid,IP);
IRC_GroupSay(gGroupID, IRC_ACHANNEL, echo);
new admin[128];
format(admin,sizeof(admin),"** System: %s (%d) (%s) has registered a new account.",pname,playerid,IP);
SendStaffMessage(LIGHTBLUE,admin);
new txd[128];
format(txd,sizeof(txd),"%s (%d) (IP: %s) registered a new account",pname,playerid,IP);
TextDrawSetString(RegTxd, txd);
new welcome[130];
format(welcome, sizeof(welcome), "Welcome to Battlefield War Heroes, ~r~%s! Type ~r~/rules ~w~and ~r~/cmds ~w~for server info.",pname);
GameTextForPlayer(playerid,welcome,6000,4);
}
if(!response)
{
SendClientMessage(playerid, COLOR_RED, "** To play you must be registered or logged in.");
KickTimer[playerid] = SetTimerEx("KickPlayer",200,false,"d",playerid);
}
}
Quote:
[11:59:21] [DEBUG] mysql_errno - connection: 1 [11:59:42] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM `Bans` WHERE (`Username` = 'yugyyygu' OR `IP` = '1", callback: "(null)", format: "(null)" [11:59:42] [DEBUG] CMySQLQuery::CMySQLQuery() - constructor called [11:59:42] [DEBUG] mysql_tquery - scheduling query "SELECT * FROM `Bans` WHERE (`Username` = 'yugyyygu' OR `IP` = '192.168.1.3') AND `Banned` = 1 LIMIT 1".. [11:59:42] [DEBUG] cache_get_row_count - connection: 1 [11:59:42] [DEBUG] mysql_format - connection: 0, len: 128, format: "SELECT * FROM `playerdata` WHERE `user` = '%e' LIMIT 1" [11:59:42] [DEBUG] mysql_tquery - connection: 0, query: "", callback: "OnAccountCheck", format: "i" [11:59:42] [DEBUG] cache_get_data - connection: 0 [11:59:42] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE ServerStats SET TotalJoins = TotalJoins + 1", callback: "(null)", format: "(null)" [11:59:42] [DEBUG] CMySQLQuery::CMySQLQuery() - constructor called [11:59:42] [DEBUG] mysql_tquery - scheduling query "UPDATE ServerStats SET TotalJoins = TotalJoins + 1".. [11:59:42] [DEBUG] CMySQLQuery::Execute[()] - starting query execution [11:59:43] [DEBUG] CMySQLQuery::Execute[()] - query was successful [11:59:43] [DEBUG] CMySQLQuery::Execute[()] - no callback specified, skipping result saving [11:59:43] [DEBUG] CMySQLQuery::Execute[()] - data being passed to ProcessCallbacks() [11:59:43] [DEBUG] CMySQLQuery::Execute[()] - starting query execution [11:59:43] [DEBUG] CMySQLQuery::~CMySQLQuery() - deconstructor called [11:59:43] [DEBUG] CMySQLQuery::Execute[()] - query was successful [11:59:43] [DEBUG] CMySQLQuery::Execute[()] - no callback specified, skipping result saving [11:59:43] [DEBUG] CMySQLQuery::Execute[()] - data being passed to ProcessCallbacks() [11:59:43] [DEBUG] CMySQLQuery::~CMySQLQuery() - deconstructor called [11:59:45] [DEBUG] mysql_format - connection: 0, len: 1000, format: "INSERT INTO playerdata (user, password, Scores, Cash, Admin, Deaths, Nopm, Muted, Vip, Warn, RegisterDate, Jailed, AdminActions,..." [11:59:45] [DEBUG] mysql_tquery - connection: 0, query: "", callback: "(null)", format: "(null)" [11:59:45] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE ServerStats SET TotalAccounts = TotalAccounts + 1", callback: "(null)", format: "(null)" [11:59:45] [DEBUG] CMySQLQuery::CMySQLQuery() - constructor called [11:59:45] [DEBUG] mysql_tquery - scheduling query "UPDATE ServerStats SET TotalAccounts = TotalAccounts + 1".. [11:59:45] [DEBUG] CMySQLQuery::Execute[()] - starting query execution [11:59:45] [DEBUG] CMySQLQuery::Execute[()] - query was successful [11:59:45] [DEBUG] CMySQLQuery::Execute[()] - no callback specified, skipping result saving [11:59:45] [DEBUG] CMySQLQuery::Execute[()] - data being passed to ProcessCallbacks() [11:59:45] [DEBUG] CMySQLQuery::~CMySQLQuery() - deconstructor called [11:59:52] [DEBUG] mysql_tquery - connection: 0, query: "UPDATE `playerdata` SET Scores='0', Cash='0', Admin='0', Deaths=", callback: "(null)", format: "(null)" |