Register/Login system
#1

I have working register and login system but i want it changed.
In my register system you have to enter /register [password] or /login [password] in chat. What i want is window to show when player join and then to type password and register or if registered to type password and login. Or they can press on button "Quit" and then server closes connection.
Here is command:
Quote:

CMD:register(playerid,params[])
{
if (PlayerInfo[playerid][LoggedIn] == 1) return SendClientMessage(playerid,COLOR_RED,"ACCOUNT: You are already registered and logged in.");
if (udb_Exists(PlayerName2(playerid))) return SendClientMessage(playerid,COLOR_RED,"ACCOUNT: This account already exists, please use '/login [password]'.");
if (strlen(params) == 0) return SendClientMessage(playerid,COLOR_RED,"ACCOUNT: Correct usage: '/register [password]'");
if (strlen(params) < 4 || strlen(params) > 20) return SendClientMessage(playerid,COLOR_RED,"ACCOUNT: Password length must be greater than three characters");
if (udb_Create(PlayerName2(playerid),params))
{
new file[256],rname[MAX_PLAYER_NAME], tmp3[100];
new strdate[20], year,month,day;
getdate(year, month, day);
GetPlayerName(playerid,rname,sizeof(rname));
format(file,sizeof(file),"/ladmin/users/%s.sav",udb_encode(rname));
GetPlayerIp(playerid,tmp3,100);
dini_Set(file,"ip",tmp3);
// dini_Set(file,"password",params);
dUserSetINT(PlayerName2(playerid)).("registered",1 );
format(strdate, sizeof(strdate), "%d/%d/%d",day,month,year);
dini_Set(file,"RegisteredDate",strdate);
dUserSetINT(PlayerName2(playerid)).("loggedin",1);
dUserSetINT(PlayerName2(playerid)).("banned",0);
dUserSetINT(PlayerName2(playerid)).("level",0);
dUserSetINT(PlayerName2(playerid)).("LastOn",0);
dUserSetINT(PlayerName2(playerid)).("money",0);
dUserSetINT(PlayerName2(playerid)).("kills",0);
dUserSetINT(PlayerName2(playerid)).("deaths",0);
dUserSetINT(PlayerName2(playerid)).("Bank",PlayerI nfo[playerid][bank]);
dUserSetINT(PlayerName2(playerid)).("weed",PlayerI nfo[playerid][weed]);
dUserSetINT(PlayerName2(playerid)).("Gang",PlayerI nfo[playerid][gang]);
dUserSetINT(PlayerName2(playerid)).("Condoms",Play erInfo[playerid][condoms]);
dUserSetINT(PlayerName2(playerid)).("inalcatraz",P layerInfo[playerid][inalcatraz]);
PlayerInfo[playerid][LoggedIn] = 1;
PlayerInfo[playerid][Registered] = 1;
SavePlayer(playerid);
dUserSetINT(PlayerName2(playerid)).("bowner",0);
dUserSetINT(PlayerName2(playerid)).("bowned",0);
dUserSetINT(PlayerName2(playerid)).("vowned",0);
dUserSetINT(PlayerName2(playerid)).("vowner",0);
dUserSetINT(PlayerName2(playerid)).("vowned2",0);
dUserSetINT(PlayerName2(playerid)).("vowner2",0);
dUserSetINT(PlayerName2(playerid)).("vowned3",0);
dUserSetINT(PlayerName2(playerid)).("vowner3",0);
dUserSetINT(PlayerName2(playerid)).("vowned4",0);
dUserSetINT(PlayerName2(playerid)).("vowner4",0);
dUserSetINT(PlayerName2(playerid)).("vowned5",0);
dUserSetINT(PlayerName2(playerid)).("vowner5",0);
dUserSetINT(PlayerName2(playerid)).("vowned6",0);
dUserSetINT(PlayerName2(playerid)).("vowner6",0);
dUserSetINT(PlayerName2(playerid)).("vowned7",0);
dUserSetINT(PlayerName2(playerid)).("vowner7",0);
dUserSetINT(PlayerName2(playerid)).("vowned8",0);
dUserSetINT(PlayerName2(playerid)).("vowner8",0);
dUserSetINT(PlayerName2(playerid)).("vowned9",0);
dUserSetINT(PlayerName2(playerid)).("vowner9",0);
dUserSetINT(PlayerName2(playerid)).("vowned10",0);
dUserSetINT(PlayerName2(playerid)).("vowner10",0);
dUserSetINT(PlayerName2(playerid)).("vowned11",0);
dUserSetINT(PlayerName2(playerid)).("vowner11",0);
dUserSetINT(PlayerName2(playerid)).("vowned12",0);
dUserSetINT(PlayerName2(playerid)).("vowner12",0);
dUserSetINT(PlayerName2(playerid)).("vowned13",0);
dUserSetINT(PlayerName2(playerid)).("vowner13",0);
dUserSetINT(PlayerName2(playerid)).("vowned14",0);
dUserSetINT(PlayerName2(playerid)).("vowner14",0);
dUserSetINT(PlayerName2(playerid)).("vowned15",0);
dUserSetINT(PlayerName2(playerid)).("vowner15",0);
dUserSetINT(PlayerName2(playerid)).("Houseid", -255);
dUserSetINT(PlayerName2(playerid)).("Rentid", -255);
dUserSetINT(PlayerName2(playerid)).("SpawnX", 0);
dUserSetINT(PlayerName2(playerid)).("SpawnY", 0);
dUserSetINT(PlayerName2(playerid)).("SpawnZ", 0);
dUserSetINT(PlayerName2(playerid)).("SpawnInt", 0);
LoginPlayer(playerid);
LoadPlayer(playerid);
SendClientMessage(playerid, green, "ACCOUNT: You are now registered, and have been automaticaly logged in");
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
return 1;
}
return 1;
}

CMD:login(playerid,params[])
{
if (PlayerInfo[playerid][LoggedIn] == 1) return SendClientMessage(playerid,COLOR_RED,"ACCOUNT: You are already logged in.");
if (!udb_Exists(PlayerName2(playerid))) return SendClientMessage(playerid,COLOR_RED,"ACCOUNT: Account doesn't exist, please use '/register [password]'.");
if (strlen(params)==0) return SendClientMessage(playerid,COLOR_RED,"ACCOUNT: Correct usage: '/login [password]'");
if (udb_CheckLogin(PlayerName2(playerid),params))
{
new file[256], tmp3[100], string[128], lname[MAX_PLAYER_NAME];
GetPlayerName(playerid,lname,sizeof(lname));
format(file,sizeof(file),"/ladmin/users/%s.sav",udb_encode(lname));
GetPlayerIp(playerid,tmp3,100);
dini_Set(file,"ip",tmp3);
LoginPlayer(playerid);
LoadPlayer(playerid);
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
if(PlayerInfo[playerid][Level] > 0) {
format(string,sizeof(string),"ACCOUNT: Successfully Logged In. (Level %d)", PlayerInfo[playerid][Level] );
return SendClientMessage(playerid,green,string);
} else return SendClientMessage(playerid,green,"ACCOUNT: Successfully Logged In");
}
return SendClientMessage(playerid,COLOR_RED,"ACCOUNT: Login failed! Incorrect Password");
}

LoginPlayer(playerid)
{
if(ServerInfo[GiveMoney] == 1) {ResetPlayerMoney(playerid); GivePlayerMoney(playerid, dUserINT(PlayerName2(playerid)).("money") ); }
dUserSetINT(PlayerName2(playerid)).("loggedin",1);
PlayerInfo[playerid][Deaths] = (dUserINT(PlayerName2(playerid)).("deaths"));
PlayerInfo[playerid][Kills] = (dUserINT(PlayerName2(playerid)).("kills"));
PlayerInfo[playerid][Level] = (dUserINT(PlayerName2(playerid)).("level"));
PlayerInfo[playerid][Registered] = 1;
PlayerInfo[playerid][LoggedIn] = 1;
}

So that system should create everything same as this one does.
Reply
#2

Use [pawn]
Reply
#3

Quote:
Originally Posted by AMouldyLemon
Посмотреть сообщение
Use [pawn]
I don't know how to create that, so I asked here!
Reply
#4

I believe that what you want is a dialog register/login system?

If so use this link to learn how to create one using Y-INI and Whirlpool (both scripted by ******).

Tutorial was made by newbienoob, it's pretty accessible and easy for everyone to understand.
Reply
#5

Quote:
Originally Posted by HrvojeII
Посмотреть сообщение
You don't say :O I don't know how to create that, so I asked here!
Don't try and make him look stupid while you're being stupid. He means don't use the [quote] tags in your post but put your script in [pawn] tags instead. Also there are plenty of Login/Registration system tutorials on this forum that can be found using the search button.
Reply
#6

[quote=VitalRP;3170348]Don't try and make him look stupid while you're being stupid. He means don't use the
Quote:

tags in your post but put your script in [pawn] tags instead. Also there are plenty of Login/Registration system tutorials on this forum that can be found using the search button.

I'm not trying to make him look stupid lol Just looked like good time for a little joke.. I didn't mean anything bad.
Reply
#7

You can create a dialog and use SendPlayerDialog to send that dialog to the player when he connects (OnPlayerConnects).

Example:

pawn Код:
if(PlayerInfo[playerid][Registered] != 1)
{
//REGISTER DIALOG here
}
if(PlayerInfo[playerid][LoggedIn] != 1)
{
//LOGIN DIALOG here
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)