Godfather login
#1

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?
Reply
#2

What does not work?
Reply
#3

I type password, an Dialog shows again, it dosen't spawn me.
Reply
#4

Are you sure you have entered correct password?
It looks like you haven't put right password.
Check your caps loock.
Reply
#5

Password was correct, i checkd it few times.
Reply
#6

udb_hash code ??
Reply
#7

Quote:
Originally Posted by Aprezt
View Post
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;
}
Reply
#8

Anyone?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)