18.02.2015, 02:50
(
Последний раз редактировалось PaulDinam; 18.02.2015 в 05:47.
)
Try this:
pawn Код:
new lastInsertID; // at the top of your game mode
public OnCheckEmail(playerid, username[],email[],password[]) {
new rows, fields;
query[0] = 0;
cache_get_data(rows, fields);
if(rows < 1) {
format(query,sizeof(query),"INSERT INTO `accounts` (`username`,`email`,`password`) VALUES(\"%s\",\"%s\",md5(\"%s\"));",username,email,password);
mysql_function_query(g_mysql_handle, query, true, "onAccountCreate", "dd", playerid, lastInsertID);
printf("Registered2: %d | %s | %s | %s", playerid, username, email, password);
} else {
ShowPlayerDialog(playerid, _:EAccountDialog_EnterEmail, DIALOG_STYLE_INPUT, "Enter your email address", "Enter your email address.\n{FF0000}Notice{FFFFFF}: Make sure this is valid, or else you might not be able to reset your email!\n{FF0000}This email is in use! Enter another email!","Ok","Cancel");
}
}
public onAccountCreate(playerid, lastID) {
new id = cache_insert_id();
if(id == 0 || id == lastID) {
SendClientMessage(playerid, X11_RED, "There was an error creating your account.");
//TODO: LOG ERRORS
Kick(playerid);
return 0;
}
lastInsertID = id;
SetPVarInt(playerid,"AccountID",id);
printf("Registered2: %d | %d",playerid, id);
#if debug
new dbgmsg[128];
format(dbgmsg,sizeof(dbgmsg),"[DBG]: Account ID: %d",id);
SendClientMessage(playerid, X11_RED,dbgmsg);
#endif
ShowCharacterDialog(playerid);
return 1;
}