22.01.2013, 22:04
Hello, I have a register system on my website and I want it to check if that user has registered, if they haven't I want it to kick them off the server but if they have, I want it to open the login dialog box. It worked but when I removed the register part of it from my script no dialog will open:
I have tried a registered and a non-registered name, nothing happens..
pawn Код:
public OnPlayerConnect(playerid)
{
MoneyGiven[playerid] = -1; // This is the MySQL login system I have
new pname[24]; //Creates our variables.
new string[210];
GetPlayerName(playerid, pname, 24); //Gets the players name
mysql_store_result(); //We store the result.
new rows = mysql_num_rows(); //We get how many rows the query returned. // This is the MySQL login system I have
if(!rows)
{
//If the rows are equal to 0. This means that the query did not find
//anyone under the name we connected under in the database.
//So here we send the player the register dialog.
SendClientMessage(playerid, COLOR_LIGHTRED, "Error: Please register an account at http://127.0.0.1 before being able to play!");
Kick(playerid);
}
if(rows == 1)
{
//If the rows are equal to 1, this means there is a player already registered
//so we can initiate the login dialog to the player or check if the players
//current IP is the same one as in the database.
format(string, sizeof(string), "Welcome back, %s. Please enter your password below to log in.", GetName(playerid));
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login", string, "Confirm", "Quit");
IsRegistered[playerid] = 1; //Sets the registered variable to 1 (Shows that the player is registered).
}
return 1;
}