DINI Saving Password Wrong
#1

Dini Is Saving My Password Like This For Every Account.

Код:
Name=HayZatic
Ip=74.88.154.91
Registered=-1
Password=0
Level=0
Wired=0
Jailed=0
Reply
#2

We have to see the code.

We can't guess.
Reply
#3

Код:
public OnPlayerConnect(playerid)
{
    new file[100],Name[MAX_PLAYER_NAME],Ip[16];
    GetPlayerName(playerid,Name,sizeof(Name));
    GetPlayerIp(playerid,Ip,sizeof(Ip));
    format(file,sizeof(file),PlayerFile,Name);

    dini_IntSet(file,"Password",0);
         SendClientMessage(playerid,COLOUR_ORANGE,"Your username is not recognized on this server. Please /register to continue.");
    }
    strcat(gPlayerInfo[playerid][PLAYER_NAME],dini_Get(file,"Name"));
    strcat(gPlayerInfo[playerid][PLAYER_IP],dini_Get(file,"Ip"));
    gPlayerInfo[playerid][PLAYER_REGGED] = dini_Int(file,"Registered");
    gPlayerInfo[playerid][PLAYER_PASS] = dini_Int(file,"Password");
    gPlayerInfo[playerid][PLAYER_LEVEL] = dini_Int(file,"Level");
    gPlayerInfo[playerid][PLAYER_WIRED] = dini_Int(file,"Wired");
    gPlayerInfo[playerid][PLAYER_JAILED] = dini_Int(file,"Jailed");
    if(gPlayerInfo[playerid][PLAYER_REGGED] == 0) SendClientMessage(playerid,COLOUR_ORANGE,"You're username is recognised on this server, but you have not registered. Please /register to continue.");
    else if(gPlayerInfo[playerid][PLAYER_REGGED] == 1)SendClientMessage(playerid,COLOUR_ORANGE,"You're username is recognised on this server. Please /login to continue.");
    gPlayerInfo[playerid][PLAYER_REGGED] = 0;
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    new file[100];
    format(file,sizeof(file),PlayerFile,gPlayerInfo[playerid][PLAYER_NAME]);
    dini_Set(file,"Name",gPlayerInfo[playerid][PLAYER_NAME]);
    dini_Set(file,"Ip",gPlayerInfo[playerid][PLAYER_IP]);
    dini_IntSet(file,"Registered",gPlayerInfo[playerid][PLAYER_REGGED]);
    dini_IntSet(file,"Password",gPlayerInfo[playerid][PLAYER_PASS]);
    dini_IntSet(file,"Level",gPlayerInfo[playerid][PLAYER_LEVEL]);
    dini_IntSet(file,"Wired",gPlayerInfo[playerid][PLAYER_WIRED]);
    dini_IntSet(file,"Jailed",gPlayerInfo[playerid][PLAYER_JAILED]);
    gPlayerInfo[playerid][PLAYER_NAME] = 0;
    gPlayerInfo[playerid][PLAYER_IP] = 0;
    gPlayerInfo[playerid][PLAYER_REGGED] = 0;
    gPlayerInfo[playerid][PLAYER_LOGGED] = 0;
    gPlayerInfo[playerid][PLAYER_PASS] = 0;
    gPlayerInfo[playerid][PLAYER_LEVEL] = 0;
    gPlayerInfo[playerid][PLAYER_WIRED] = 0;
    gPlayerInfo[playerid][PLAYER_JAILED] = 0;
    return 1;
}

COMMAND:test(playerid, params[])
{
	SendClientMessage(playerid,COLOUR_ORANGE,"Test");
	return 1;
}
COMMAND:register(playerid, params[])
{
    if(gPlayerInfo[playerid][PLAYER_REGGED] == 1)
    return SendClientMessage(playerid, COLOUR_ORANGE, "ERROR: You have already registered!");
    else if(!params[0])
    return SendClientMessage(playerid, COLOUR_ORANGE, "USAGE: /register [password]");
    else if(strlen(params) < gSettings[PASS_MIN] || strlen(params) > gSettings[PASS_MAX])
    {
    new string[128];
        format(string, sizeof(string), "ERROR: Password must be between %d and $d characters long!", gSettings[PASS_MIN], gSettings[PASS_MAX]);
    return SendClientMessage(playerid, COLOUR_ORANGE, string);
    }
    else
    {
    new password = num_hash(params);
    gPlayerInfo[playerid][PLAYER_PASS] = password;
    gPlayerInfo[playerid][PLAYER_REGGED] = 1;
        gPlayerInfo[playerid][PLAYER_LOGGED] = 1;
    GetPlayerIp(playerid, gPlayerInfo[playerid][PLAYER_IP], 16);
    new string[128]; format(string, sizeof(string), "You have successfully registered your account with the password \'%s\'. You have been automatically logged in.", params);
    return SendClientMessage(playerid, COLOUR_LIGHTBLUE, string);
    }
}
Reply
#4

Edit - Ignore this.
Reply
#5

Код:
public OnPlayerConnect(playerid)
{
    new file[100],Name[MAX_PLAYER_NAME],Ip[16];
    GetPlayerName(playerid,Name,sizeof(Name));
    GetPlayerIp(playerid,Ip,sizeof(Ip));
    format(file,sizeof(file),PlayerFile,Name);

    dini_IntSet(file,"Password",0);
         SendClientMessage(playerid,COLOUR_ORANGE,"Your username is not recognized on this server. Please /register to continue.");    }
    strcat(gPlayerInfo[playerid][PLAYER_NAME],dini_Get(file,"Name"));
    strcat(gPlayerInfo[playerid][PLAYER_IP],dini_Get(file,"Ip"));
    gPlayerInfo[playerid][PLAYER_REGGED] = dini_Int(file,"Registered");
    gPlayerInfo[playerid][PLAYER_PASS] = dini_Int(file,"Password");
    gPlayerInfo[playerid][PLAYER_LEVEL] = dini_Int(file,"Level");
    gPlayerInfo[playerid][PLAYER_WIRED] = dini_Int(file,"Wired");
    gPlayerInfo[playerid][PLAYER_JAILED] = dini_Int(file,"Jailed");
    if(gPlayerInfo[playerid][PLAYER_REGGED] == 0) SendClientMessage(playerid,COLOUR_ORANGE,"You're username is recognised on this server, but you have not registered. Please /register to continue.");
    else if(gPlayerInfo[playerid][PLAYER_REGGED] == 1)SendClientMessage(playerid,COLOUR_ORANGE,"You're username is recognised on this server. Please /login to continue.");
    gPlayerInfo[playerid][PLAYER_REGGED] = 0;
    return 1;
}
To me it looks like you set their password to 0 when they connect?
Reply
#6

Quote:
Originally Posted by Jack_Leslie
Посмотреть сообщение
Код:
public OnPlayerConnect(playerid)
{
    new file[100],Name[MAX_PLAYER_NAME],Ip[16];
    GetPlayerName(playerid,Name,sizeof(Name));
    GetPlayerIp(playerid,Ip,sizeof(Ip));
    format(file,sizeof(file),PlayerFile,Name);

    dini_IntSet(file,"Password",0);
         SendClientMessage(playerid,COLOUR_ORANGE,"Your username is not recognized on this server. Please /register to continue.");    }
    strcat(gPlayerInfo[playerid][PLAYER_NAME],dini_Get(file,"Name"));
    strcat(gPlayerInfo[playerid][PLAYER_IP],dini_Get(file,"Ip"));
    gPlayerInfo[playerid][PLAYER_REGGED] = dini_Int(file,"Registered");
    gPlayerInfo[playerid][PLAYER_PASS] = dini_Int(file,"Password");
    gPlayerInfo[playerid][PLAYER_LEVEL] = dini_Int(file,"Level");
    gPlayerInfo[playerid][PLAYER_WIRED] = dini_Int(file,"Wired");
    gPlayerInfo[playerid][PLAYER_JAILED] = dini_Int(file,"Jailed");
    if(gPlayerInfo[playerid][PLAYER_REGGED] == 0) SendClientMessage(playerid,COLOUR_ORANGE,"You're username is recognised on this server, but you have not registered. Please /register to continue.");
    else if(gPlayerInfo[playerid][PLAYER_REGGED] == 1)SendClientMessage(playerid,COLOUR_ORANGE,"You're username is recognised on this server. Please /login to continue.");
    gPlayerInfo[playerid][PLAYER_REGGED] = 0;
    return 1;
}
To me it looks like you set their password to 0 when they connect?
Well Right now it thinks that in general i never registered
Reply
#7

You should probably make it check whether the user is registered or not and based on that, make it show a dialog of logging in or registering. That would prevent some of these mishaps.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)