Login Dialog - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Login Dialog (
/showthread.php?tid=102534)
Login Dialog -
Kohva - 16.10.2009
Hello, I got a little problem here with login dialog..
My script
Код:
public OnPlayerRequestClass(playerid, classid)
{
if (gPlayerAccount[playerid] != 0)
{
new s[128],pName[24];
GetPlayerName(playerid, pName, 24);
format(s,sizeof(s),"Welcome, %s!\n\nYou have to login for playing!\n\nPlease enter your password:",pName);
ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Game login:",s,"Login","Cancel");
}
return 1;
}
Dialog will open very well when i start SA:MP
but if i wrote something in the dialog i just can't login
Код:
if(dialogid == 2)
{
if(!response)
{
Kick(playerid);
}
else
{
if(strcmp(PlayerInfo[playerid][pKey],inputtext, true ) == 0)
{
SendClientMessage(playerid, COLOR_YELLOW, "You have been logged in, Welcome !");
SendClientMessage(playerid, COLOR_GREEN, "Press 'Spawn' to continue ");
gPlayerLogged[playerid] = 1;
If i now press Cancel button, then server close connection (i have been kicked) - that's correct
But if i write correct password , then i got message it's wrong password
And if i don't write anything, just press spawn button , then i have logged in..
So i can get in without password
Sorry about my bad english..
Re: Login Dialog -
Abhishek - 16.10.2009
That's probably because PlayerInfo[playerid][pKey] is blank.
You need to get the real password from the files or database (whatever you are using) and then save it in PlayerInfo[playerid][pKey] (Do that OnPlayerConnect)!
Re: Login Dialog -
Kohva - 16.10.2009
Thank you for quick answer
My real login is :
Код:
dcmd_login(playerid, params[])
{
new tmppass[64];
if(gPlayerLogged[playerid] == 1)
{
SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "You have been already logged in.");
return 1;
}
if(sscanf(params, "s", tmppass))
{
SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "KASUTUS: /login [password]");
return 1;
}
OnPlayerLogin(playerid, MD5_Hash(tmppass));
return 1;
}
How i can make that inputtext = password..
Код:
if(strcmp(MD5_Hash(tmppass),inputtext, true ) == 0)
?? Or what :S
Re: Login Dialog -
Abhishek - 16.10.2009
May be.. you could show the code of OnPlayerLogin? or just tell what it is exactly doing?
EDIT:
Well, may be... you try that in OnDialogResponse...
Quote:
if(dialogid == 2)
{
if(!response)
{
Kick(playerid);
}
else
{
if(!strlen(inputtext)) {
SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "KASUTUS: /login [password]");
return 1;
} else {
OnPlayerLogin(playerid,MD5_Has(inputtext));
return 1;
}
}
}
|
Re: Login Dialog -
Kohva - 16.10.2009
Quote:
Originally Posted by Abhishek
May be.. you could show the code of OnPlayerLogin? or just tell what it is exactly doing?
EDIT:
Well, may be... you try that in OnDialogResponse...
Quote:
if(dialogid == 2)
{
if(!response)
{
Kick(playerid);
}
else
{
if(!strlen(inputtext)) {
SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "KASUTUS: /login [password]");
return 1;
} else {
OnPlayerLogin(playerid,MD5_Has(inputtext));
return 1;
}
}
}
|
|
Thank you so so much !
(u can close the thread now)