21.11.2010, 18:42
pawn Код:
public OnPlayerConnect(playerid)
{
new str[128];
print("MySQL, Accounts System verified");
format(Query, sizeof(Query), "SELECT * FROM `accounts`", name(playerid));
mysql_query(Query);
mysql_store_result();
if (mysql_num_rows() >= 1)
{
if (mysql_num_rows() >= 2)
{
mysql_free_result();
format(str, sizeof(str), "[MySQL ERROR]: This name can only be used once | You will need to change your name", name(playerid));
SendClientMessage(playerid, COLOR_RED, str);
Kick(playerid);
}
else
{
mysql_fetch_field_row(PlayerInfo[playerid][pName], "Name");
mysql_free_result();
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Login / Authentication Process", "Hello there.\n\nPlease enter your password to return to the game.", "Login", "Quit");
SendClientMessage(playerid, COLOR_WHITE, "Your account exists. Please enter your password to proceed.");
}
}
else
{
mysql_free_result();
SendClientMessage(playerid, COLOR_WHITE, "Your account does not yet exist. Enter a password to register one!");
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Registration Process", "Hello there.\n\nPlease enter a password to save your stats.", "Register", "Quit");
}
return 1;
}