public OnAccountCheck(playerid)
{
new rows, fields;
cache_get_data(rows, fields, mysqlc);
if(rows)
{
cache_get_field_content(0, "password", PlayerInfo[playerid][Password], mysqlc, 129);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login in your account", ""W"In order to play, you need to "R"login", "Login", "Quit");
}
else
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Create a new account", ""W"In order to play, you need to "R"register.", "Register", "Quit");
}
return 1;
}
public OnAccountLoad(playerid)
{
PlayerInfo[playerid][Admin] = cache_get_row_int(0, 5);
PlayerInfo[playerid][Deaths] = cache_get_row_int(0, 6);
PlayerInfo[playerid][Nopm] = cache_get_row_int(0, 7);
PlayerInfo[playerid][Muted] = cache_get_row_int(0, 8);
PlayerInfo[playerid][Vip] = cache_get_row_int(0, 9);
PlayerInfo[playerid][Warn] = cache_get_row_int(0, 10);
PlayerInfo[playerid][RegisterDate] = cache_get_row_int(0, 11);
PlayerInfo[playerid][Jailed] = cache_get_row_int(0, 12);
PlayerInfo[playerid][AdminActions] = cache_get_row_int(0, 13);
PlayerInfo[playerid][Cookies] = cache_get_row_int(0, 14);
PlayerInfo[playerid][Rank] = cache_get_row_int(0, 15);
PlayerInfo[playerid][VipTime] = cache_get_row_int(0, 16);
PlayerInfo[playerid][Class] = cache_get_row_int(0, 17);
PlayerInfo[playerid][PrototypesStolen] = cache_get_row_int(0, 18);
PlayerInfo[playerid][KillAsUsaTeam] = cache_get_row_int(0, 19);
PlayerInfo[playerid][KillAsGermanyTeam] = cache_get_row_int(0, 20);
PlayerInfo[playerid][KillAsItalyTeam] = cache_get_row_int(0, 21);
PlayerInfo[playerid][KillAsJapanTeam] = cache_get_row_int(0, 22);
PlayerInfo[playerid][KillAsMercTeam] = cache_get_row_int(0, 23);
PlayerInfo[playerid][KillAsMexicoTeam] = cache_get_row_int(0, 24);
PlayerInfo[playerid][Exp] = cache_get_row_int(0, 26);
PlayerInfo[playerid][Duty] = cache_get_row_int(0, 27);
PlayerInfo[playerid][DaysAlive] = cache_get_row_int(0, 28);
SetPlayerScore(playerid, PlayerInfo[playerid][Scores]);
GivePlayerMoney(playerid, PlayerInfo[playerid][Cash]);
JustLogged[playerid] = 1;
Logged[playerid] = 1;
UpdateStatsTextdraw(playerid);
SendClientMessage(playerid,red,"------------------------------------------------------");
new playername3[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername3, sizeof(playername3));
new string[128];
format(string,sizeof(string),"* System: Welcome back {F70505}%s (%d) {FFFFFF} - Your stats have been restored.",playername3,playerid);
SCM(playerid,-1,string);
SendClientMessage(playerid,red,"------------------------------------------------------");
CheckVipTime(playerid);
return 1;
}
if(dialogid == DIALOG_LOGIN)
{
if(!response)
{
SendClientMessage(playerid, COLOR_RED, "** To play you must be registered or logged in.");
KickTimer[playerid] = SetTimerEx("KickPlayer",200,false,"d",playerid);
}
if(response)
{
new hpass[129];
WP_Hash(hpass, 129, inputtext);
new name[24];
GetPlayerName(playerid, name, sizeof(name));
printf("Hpass: %s Password: %s", hpass, PlayerInfo[playerid][Password]);
if(!strcmp(hpass, PlayerInfo[playerid][Password]))
{
mysql_format(mysqlc, query, sizeof(query), "SELECT * FROM `playerdata` WHERE `user` = '%e' LIMIT 1", name);
mysql_tquery(mysqlc, query, "OnAccountLoad", "i", playerid);
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login in your account", ""W"In order to play, you need to "R"login\n"R"Wrong password!", "Login", "Quit");
}
}
}
[13:56:48] [DEBUG] Calling callback "OnAccountLoad".. [13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 5, connection: 1 [13:56:48] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '5', data: "0" [13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 6, connection: 1 [13:56:48] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '6', data: "0" [13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 7, connection: 1 [13:56:48] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '7', data: "0" [13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 8, connection: 1 [13:56:48] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '8', data: "0" [13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 9, connection: 1 [13:56:48] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '9', data: "0" [13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 10, connection: 1 [13:56:48] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '10', data: "0" [13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 11, connection: 1 [13:56:48] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '11', data: "0" [13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 12, connection: 1 [13:56:48] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '12', data: "0" [13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 13, connection: 1 [13:56:48] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '13', data: "0" [13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 14, connection: 1 [13:56:48] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '14', data: "0" [13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 15, connection: 1 [13:56:48] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '15', data: "0" [13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 16, connection: 1 [13:56:48] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '16', data: "0" [13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 17, connection: 1 [13:56:48] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '17', data: "0" [13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 18, connection: 1 [13:56:48] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '18', data: "0" [13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 19, connection: 1 [13:56:48] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '19', data: "0" [13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 20, connection: 1 [13:56:48] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '20', data: "0" [13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 21, connection: 1 [13:56:48] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '21', data: "0" [13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 22, connection: 1 [13:56:48] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '22', data: "0" [13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 23, connection: 1 [13:56:48] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '23', data: "0" [13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 24, connection: 1 [13:56:48] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '24', data: "192.168.1.3" [13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 26, connection: 1 [13:56:48] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '26', data: "0" [13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 27, connection: 1 [13:56:48] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '27', data: "0" [13:56:48] [DEBUG] cache_get_row_int - row: 0, field_idx: 28, connection: 1 |
PlayerInfo[playerid][Admin] = cache_get_row_int(0, 5);
PlayerInfo[playerid][Deaths] = cache_get_row_int(0, 6);
PlayerInfo[playerid][Nopm] = cache_get_row_int(0, 7);
PlayerInfo[playerid][Muted] = cache_get_row_int(0, 8);
PlayerInfo[playerid][Admin] = cache_get_row_int(0, 4);
PlayerInfo[playerid][Deaths] = cache_get_row_int(0, 5);
PlayerInfo[playerid][Nopm] = cache_get_row_int(0, 6);
PlayerInfo[playerid][Muted] = cache_get_row_int(0, 7);
[14:11:08] [DEBUG] Calling callback "OnAccountLoad".. [14:11:08] [DEBUG] cache_get_row_int - row: 0, field_idx: 4, connection: 1 [14:11:08] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '4', data: "5" [14:11:08] [DEBUG] cache_get_row_int - row: 0, field_idx: 5, connection: 1 [14:11:08] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '5', data: "100" [14:11:08] [DEBUG] cache_get_row_int - row: 0, field_idx: 6, connection: 1 [14:11:08] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '6', data: "0" [14:11:08] [DEBUG] cache_get_row_int - row: 0, field_idx: 7, connection: 1 [14:11:08] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '7', data: "0" [14:11:08] [DEBUG] cache_get_row_int - row: 0, field_idx: 8, connection: 1 [14:11:08] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '8', data: "0" [14:11:08] [DEBUG] cache_get_row_int - row: 0, field_idx: 9, connection: 1 [14:11:08] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '9', data: "0" [14:11:08] [DEBUG] cache_get_row_int - row: 0, field_idx: 10, connection: 1 [14:11:08] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '10', data: "0" [14:11:08] [DEBUG] cache_get_row_int - row: 0, field_idx: 11, connection: 1 [14:11:08] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '11', data: "0" [14:11:08] [DEBUG] cache_get_row_int - row: 0, field_idx: 12, connection: 1 [14:11:08] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '12', data: "5" [14:11:08] [DEBUG] cache_get_row_int - row: 0, field_idx: 13, connection: 1 [14:11:08] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '13', data: "0" [14:11:08] [DEBUG] cache_get_row_int - row: 0, field_idx: 14, connection: 1 [14:11:08] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '14', data: "5" [14:11:08] [DEBUG] cache_get_row_int - row: 0, field_idx: 15, connection: 1 [14:11:08] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '15', data: "0" [14:11:08] [DEBUG] cache_get_row_int - row: 0, field_idx: 16, connection: 1 [14:11:08] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '16', data: "0" [14:11:08] [DEBUG] cache_get_row_int - row: 0, field_idx: 17, connection: 1 [14:11:08] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '17', data: "0" [14:11:08] [DEBUG] cache_get_row_int - row: 0, field_idx: 18, connection: 1 [14:11:08] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '18', data: "0" [14:11:08] [DEBUG] cache_get_row_int - row: 0, field_idx: 19, connection: 1 [14:11:08] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '19', data: "0" [14:11:08] [DEBUG] cache_get_row_int - row: 0, field_idx: 20, connection: 1 [14:11:08] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '20', data: "192" [14:11:08] [DEBUG] cache_get_row_int - row: 0, field_idx: 21, connection: 1 [14:11:08] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '21', data: "192" [14:11:08] [DEBUG] cache_get_row_int - row: 0, field_idx: 22, connection: 1 [14:11:08] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '22', data: "192" [14:11:08] [DEBUG] cache_get_row_int - row: 0, field_idx: 23, connection: 1 [14:11:08] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '23', data: "192" [14:11:08] [DEBUG] cache_get_row_int - row: 0, field_idx: 24, connection: 1 [14:11:08] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '24', data: "192.168.1.3" [14:11:08] [DEBUG] cache_get_row_int - row: 0, field_idx: 25, connection: 1 [14:11:08] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '25', data: "5" [14:11:08] [DEBUG] cache_get_row_int - row: 0, field_idx: 26, connection: 1 [14:11:08] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '26', data: "0" [14:11:08] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [14:11:08] [DEBUG] CMySQLQuery::~CMySQLQuery() - deconstructor called [14:11:24] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE `playerdata` SET Scores='0', Cash='0', Admin='5', Deaths=", callback: "(null)", format: "(null)" [14:11:24] [DEBUG] CMySQLQuery::CMySQLQuery() - constructor called [14:11:24] [DEBUG] mysql_tquery - scheduling query "UPDATE `playerdata` SET Scores='0', Cash='0', Admin='5', Deaths='100', Nopm='0', Muted='0', Vip='0', Warn='0', RegisterDate='0', Jailed='0', AdminActions='5', Cookies='0', Rank='5', VipTime='0', Class='0', PrototypesStolen='0', Exp='192', Duty='5', KillAsUsaTeam='0', KillAsGermanyTeam='0', KillAsItalyTeam='192', KillAsJapanTeam='192', KillAsMercTeam='192', KillAsMexicoTeam='192', DaysAlive='0' WHERE user='Face9000'".. [14:11:24] [DEBUG] CMySQLQuery::Execute[()] - starting query execution [14:11:24] [DEBUG] CMySQLQuery::Execute[()] - query was successful [14:11:24] [DEBUG] CMySQLQuery::Execute[()] - no callback specified, skipping result saving [14:11:24] [DEBUG] CMySQLQuery::Execute[()] - data being passed to ProcessCallbacks() [14:11:24] [DEBUG] CMySQLQuery::~CMySQLQuery() - deconstructor called |
@CoaPsyFactor - no. Don't do that ever again. If you want simplicity use orm, with orm_apply_cache. Tutorial is that way.
@OP: Consider switching to orm too, until it isn't too late to change all your code to that. |