28.06.2014, 01:59
Here's mine that works as an example:
So as AiRaLoKa said, use cache_get_data, then if(rows).
pawn Код:
forward IsAccountRegistered(playerid);
public IsAccountRegistered(playerid)
{
new rows, fields, string[256];
cache_get_data(rows, fields, Mysql_users);
if(rows) // If account is registered
{
mysql_format(Mysql_users, query, sizeof(query), "SELECT * FROM `fortcarson` WHERE `Fullname` = '%e' LIMIT 1", GetPlayersName(playerid));
mysql_tquery(Mysql_users, query, "Loadplayerdata", "i", playerid);
format(string, sizeof(string), "{FFFFFF}Hello, %s!\n\nWelcome back to {D69929}Fort Carson{FFFFFF}.\nPlease login with your existing password below.", GetPlayersName(playerid));
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "{FFFFFF}Welcome back to Fort Carson.", string, "Login", "Leave");
}
else if(!rows) {
format(string, sizeof(string), "{FFFFFF}Hello, %s.\n\nWelcome to {D69929}Fort Carson Roleplay!{FFFFFF}\nYour account doesn't seem to exist.\nPlease input a desired password below.", GetPlayersName(playerid));
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "{FFFFFF}Welcome to Fort Carson.", string, "Register", "Leave");
}
return 1;
}