13.12.2012, 10:56
1. Hello Guys
2. i am running a server on linux [VOLTHOST] , With mysql
3. I have problem with the register system it is: When i type the pass in the Dialog, Nothing shows...It should show "Account Registered" and it should create an Login dialog after that.
4. I already bulid a Sql in the Volthost and the database and pass are same in the script
5. Codes: it compiled already
Register COde:
2. Public PlayerConnected
8. Fix it = +rep....Thank you guys!
2. i am running a server on linux [VOLTHOST] , With mysql
3. I have problem with the register system it is: When i type the pass in the Dialog, Nothing shows...It should show "Account Registered" and it should create an Login dialog after that.
4. I already bulid a Sql in the Volthost and the database and pass are same in the script
5. Codes: it compiled already
Register COde:
pawn Код:
public OnPlayerRegister(playerid, password[])
{
//FuncLog("OnPlayerRegister");
if(IsPlayerConnected(playerid))
{
new playername[MAX_PLAYER_NAME];
new playername3[MAX_PLAYER_NAME];
new newpass[64];
GetPlayerName(playerid, playername3, sizeof(playername3));
mysql_real_escape_string(playername3, playername);
mysql_real_escape_string(password, newpass);
new query[128];//PASSWORD
format(query, sizeof(query), "INSERT INTO `userinfo` (UserName) VALUES ('%s');", playername);
mysql_query(query);
new newaccountsqlid = MySQLCheckAccount(playername3);
if (newaccountsqlid != 0)
{
format(query, sizeof(query), "INSERT INTO `uservehicles` (ID, UserName) VALUES (%d, '%s');", newaccountsqlid, playername);
mysql_query(query);
format(query, sizeof(query), "INSERT INTO `userstrings` (ID, UserName, Password) VALUES (%d, '%s', '%s');", newaccountsqlid, playername, newpass);
mysql_query(query);
format(query, sizeof(query), "INSERT INTO `userlocker` (ID, Username) VALUES (%d, '%s');", newaccountsqlid, playername);
mysql_query(query);
PlayerInfo[playerid][pSQLID] = newaccountsqlid;
strmid(PlayerInfo[playerid][pKey], password, 0, strlen(password), 127);
SendClientMessage(playerid, COLOR_YELLOW, "Account registered, you can now login.");
ShowPlayerDialog(playerid, 115, DIALOG_STYLE_INPUT, "{00BFFF}New york Roleplay", "This account is Registered!\nPlease enter your Password!", "Login", "Exit");
gPlayerAccount[playerid] = 1;
OnPlayerLogin(playerid, password);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "If you are bugged please relog.");
return 0;
}
}
return 0;
}
pawn Код:
public PlayerConnected(playerid)
{
SpawnPlayer(playerid);
new plname[MAX_PLAYER_NAME],string[150];
GetPlayerName(playerid, plname, 24);
new sqlaccountstatus = MySQLCheckAccount(plname);
if(sqlaccountstatus > 0)
{
gPlayerAccount[playerid] = 1;
PlayerInfo[playerid][pSQLID] = sqlaccountstatus;
//Preload Password
format(string, sizeof(string), "SELECT `Password` FROM `userstrings` WHERE `id`=%d LIMIT 1;",sqlaccountstatus);
mysql_query(string);
mysql_store_result();
mysql_fetch_field("Password", PlayerInfo[playerid][pKey]);
mysql_free_result();
SendClientMessage(playerid, COLOR_ORANGE, "*******************");
SendClientMessage(playerid, COLOR_ORANGE, "Welcome to NYRP!");
SendClientMessage(playerid, COLOR_ORANGE, "This username is registered please login.");
ShowPlayerDialog(playerid, 115, DIALOG_STYLE_INPUT, "{00BFFF}New York Roleplay", "{FFFFFF}This account is registered!\nPlease enter your password!", "Login", "Exit");
return 1;
}
else
{
gPlayerAccount[playerid] = 0;
SendClientMessage(playerid, COLOR_ORANGE, "*******************");
SendClientMessage(playerid, COLOR_ORANGE, "Welcome to NYRP!");
SendClientMessage(playerid, COLOR_ORANGE, "Please register to start playing.");
ShowPlayerDialog(playerid, 116, DIALOG_STYLE_INPUT, "{00BFFF}New york Roleplay", "This account is not registered!\nPlease enter your Password!", "Register", "Exit");
return 1;
}
}