Godfather login - 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)
+--- Thread: Godfather login (
/showthread.php?tid=365019)
Godfather login -
Alex.Cone - 01.08.2012
Here is login command from GF gamemode
Code:
if (strcmp(cmd, "/login", true) ==0 )
{
if(IsPlayerConnected(playerid))
{
new tmppass[64];
if(gPlayerLogged[playerid] == 1)
{
SendClientMessage(playerid, COLOR_WHITE, "SERVER: You are already logged in.");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /login [password]");
return 1;
}
strmid(tmppass, tmp, 0, strlen(cmdtext), 255);
Encrypt(tmppass);
OnPlayerLogin(playerid,tmppass);
}
return 1;
}
And this is OnDialogReponse,(I'm trying to make it in Dialogs reg/log)
Code:
case DIALOG_LOGIN:
{
if(!response) return Kick(playerid);
if(response)
{
new tmppass[64];
if(udb_hash(tmppass) == PlayerInfo[playerid][pKey])
{
OnPlayerLogin(playerid,tmppass);
Encrypt(tmppass);
SetSpawnInfo(playerid, 0, 0, 145.0953,-1815.7118,2.1, 90, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"Godfather Roleplay - Login","Welcome back!\nType in your password!","Login","Cancel");
}
}
}
And it dosen't work, what is the problem?
Re: Godfather login -
Roko_foko - 01.08.2012
What does not work?
Respuesta: Godfather login -
Alex.Cone - 01.08.2012
I type password, an Dialog shows again, it dosen't spawn me.
Re: Godfather login -
Roko_foko - 01.08.2012
Are you sure you have entered correct password?
It looks like you haven't put right password.
Check your caps loock.
Respuesta: Godfather login -
Alex.Cone - 01.08.2012
Password was correct, i checkd it few times.
Re: Godfather login -
Aprezt - 01.08.2012
udb_hash code ??
Respuesta: Re: Godfather login -
Alex.Cone - 01.08.2012
Quote:
Originally Posted by Aprezt
udb_hash code ??
|
Code:
/*Credits to Dracoblue*/
stock udb_hash(buf[]) {
new length=strlen(buf);
new s1 = 1;
new s2 = 0;
new n;
for (n=0; n<length; n++)
{
s1 = (s1 + buf[n]) % 65521;
s2 = (s2 + s1) % 65521;
}
return (s2 << 16) + s1;
}
Respuesta: Godfather login -
Alex.Cone - 01.08.2012
Anyone?