12.01.2012, 15:54
I can register the same account multiple times. (well, I have to)
What's wrong?
pawn Код:
public OnPlayerConnect(playerid)
{
SetPlayerColor(playerid, PC);
new String[128];
format(String, sizeof(String), ""ORANGE"%s "PURPLE"(%i) "ORANGE"has joined the server. ", GetName(playerid), playerid);
SendClientMessageToAll(-1, String);
SetPlayerTime(playerid, 0, 0);
PlayerMoney[playerid] = -1;
new Query[200], pName[24];
GetPlayerName(playerid, pName, 24);
format(Query, sizeof(Query), "SELECT IP FROM `Players` WHERE Username = '%s' LIMIT 1", pName);
mysql_query(Query);
mysql_store_result();
new Rows = mysql_num_rows();
if(!Rows)
{
ShowPlayerDialog(playerid, REGISTER, DIALOG_STYLE_PASSWORD, ""#PURPLE"Account system", ""#ORANGE"Register or login below to gain access.", ""PURPLE"Done", "");
}
if(Rows == 1)
{
new IP[2][16];
mysql_fetch_field_row(IP[0], "IP");
GetPlayerIp(playerid, IP[1], 16);
if(strlen(IP[0]) != 0 && !strcmp(IP[0], IP[1], true))
{
Login(playerid);
SpawnPlayer(playerid);
}
else
{
ShowPlayerDialog(playerid, REGISTER, DIALOG_STYLE_PASSWORD, ""#PURPLE"Account system", ""#ORANGE"Register or login below to gain access.", ""PURPLE"Done", "");
IsPlayerRegistered[playerid] = 1;
}
}
mysql_free_result();
return 1;
}