2021-06-26, 11:14 AM
I've got a login and registration system which works using SQLlite.
Im trying to let the server tell the player whether they are registered or not?
So if they are already registered the server should say?"Welcome back 'player' You are already registered on the server please log in to continue." By returning the playername.
But if they are not registered it should prompt the user with "The 'username' is not registered on this server."
Im trying to let the server tell the player whether they are registered or not?
So if they are already registered the server should say?"Welcome back 'player' You are already registered on the server please log in to continue." By returning the playername.
But if they are not registered it should prompt the user with "The 'username' is not registered on this server."
PHP Code:
public OnPlayerConnect(playerid)
{
SetPlayerCamera(playerid);
? ? SetPlayerScore(playerid, 0);
? ?
? ? PlayerInfo[playerid][pKills] = 0;
PlayerInfo[playerid][pDeaths] = 0;
PlayerInfo[playerid][pLoggedIn] = false;
new query[128];
format(query, sizeof(query), "SELECT `NAME` FROM `USERS` WHERE `NAME` = '%s' COLLATE NOCASE", DB_Escape(ReturnName(playerid)));
? database_result = db_query(server_database, query);
? if(db_num_rows(database_result))
{
// Registered accounts see this login
ShowPlayerDialog(playerid, LOGIN_DIALOG, DIALOG_STYLE_PASSWORD, "{FFFFFF}TWDZS: Account Login", "{FFFFFF}Please enter your password below to login to your account:", "Enter", "Leave");
}
else
{
ShowPlayerDialog(playerid, REGISTER_DIALOG, DIALOG_STYLE_PASSWORD, "{FFFFFF}TWDZS: Register Account", "Please enter a strong password to register your account", "Register", "Cancel");
}
return 1;
}