Password
#1

When I finished this register login system I barely faced any problems.
Now, when the player registers to the server, his password gets hashed, but whenever the player leaves the hashed password gets the variable "0"...


system
PHP код:
public OnPlayerDisconnect(playeridreason)
{
    new 
string[75], pName[MAX_PLAYER_NAME];
    
GetPlayerName(playeridpNameMAX_PLAYER_NAME);
    
format(stringsizeof string"%s has left the server."pName);
    
SendClientMessageToAll(COLOR_GREYstring);
    
    new 
INI:File INI_Open(UserPath(playerid));
    
INI_SetTag(File"PlayerData");
    
INI_WriteInt(File"Password"PlayerInfo[playerid][Password]);
    
INI_WriteInt(File"Admin"PlayerInfo[playerid][AdminLevel]);
    
INI_WriteInt(File"Money"PlayerInfo[playerid][Money]);
    
INI_WriteInt(File"Vip"PlayerInfo[playerid][VipLevel]);
    
INI_WriteInt(File"Mechanic"PlayerInfo[playerid][Mechanic]);
    
INI_WriteInt(File"SupportMember"PlayerInfo[playerid][SupportMember]);
    
INI_WriteInt(File"Hitman"PlayerInfo[playerid][Hitman]);
    
INI_WriteInt(File"Saaf"PlayerInfo[playerid][Saaf]);
    
INI_WriteInt(File"Sapd"PlayerInfo[playerid][Sapd]);
    
INI_WriteInt(File"Drivinglicense"PlayerInfo[playerid][Drivinglicense]);
    
INI_Close(File); 
PHP код:
public OnDialogResponse()
if(
dialogid==6)
    {
        if(
response == 0)
        {
            
SendClientMessage(playeridCOLOR_RED"You have been kicked automatically.");
            
SetTimerEx("DelayedKick"50false"i"playerid);
            
Kick(playerid);
        }
        if(
response == 1)
        {
            if(
strlen(inputtext) < 3) return SendClientMessage(playeridCOLOR_RED"Error: You must create a password with atleast 3 characters.");
            
//ShowPlayerDialog(playerid, RegisterDialog, DIALOG_STYLE_PASSWORD, "Xtreme Gaming Freeroam/Roleplay - Registration", "Xtreme Gaming Freeroam/Roleplay - Fill a password to register", "Register", "Leave");
               
new INI:File INI_Open(UserPath(playerid));
            
INI_SetTag(File"PlayerData");
            
INI_WriteInt(File"Password"udb_hash(inputtext));
            
INI_WriteInt(File"Admin"0);
            
INI_WriteInt(File"Money"0);
            
INI_WriteInt(File"Vip"0);
            
INI_WriteInt(File"Mechanic"0);
            
INI_WriteInt(File"SupportMember"0);
            
INI_WriteInt(File"Hitman"0);
            
INI_WriteInt(File"Saaf"0);
            
INI_WriteInt(File"Sapd"0);
            
INI_WriteInt(File"Drivinglicense"0);
            
INI_Close(File);
            
SetSpawnInfo(playerid023, -2654.2371,608.3632,14.4531,358.4422000000);
            
SpawnPlayer(playerid);
        }
    }
    if(
dialogid==7)
    {
        if(
response == 0)
        {
            
SendClientMessage(playeridCOLOR_RED"You have been kicked automatically.");
            
SetTimerEx("DelayedKick"50false"i"playerid);
            
Kick(playerid);
        }
        if(
response == 1)
        {
            if(
udb_hash(inputtext) == PlayerInfo[playerid][Password])
            {
                new 
string[75];
                
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra true, .extra playerid);
                
GivePlayerMoney(playeridPlayerInfo[playerid][Money]);
                
format(stringsizeof string"%s has succesfully registered to our server!"PlayerName(playerid));
                 
ShowPlayerDialog(playeridLoginDialogDIALOG_STYLE_PASSWORD"Xtreme Gaming Freeroam/Roleplay - Login""Xtreme Gaming Freeroam/Roleplay - Enter your password to login""Login""Leave");
                 
SendClientMessage(playerid, -1"Your account has been succesfully restored.");
            }
            else
            {
                
SendClientMessage(playeridCOLOR_RED"Error: Incorrect password.");
                
ShowPlayerDialog(playeridLoginDialogDIALOG_STYLE_PASSWORD"Xtreme Gaming Freeroam/Roleplay - Login""Xtreme Gaming Freeroam/Roleplay - Enter your password to login""Login""Leave");
            }
        }
    } 
PHP код:
forward  LoadUser_data(playeridname[], value[]);
public 
LoadUser_data(playeridname[], value[])
{
    
INI_Int("Password"PlayerInfo[playerid][Password]);
    
INI_Int("Admin"PlayerInfo[playerid][AdminLevel]);
    
INI_Int("Money"PlayerInfo[playerid][Money]);
    
INI_Int("Vip"PlayerInfo[playerid][VipLevel]);
    
INI_Int("Mechanic"PlayerInfo[playerid][Mechanic]);
    
INI_Int("SupportMember"PlayerInfo[playerid][SupportMember]);
    
INI_Int("Hitman"PlayerInfo[playerid][Hitman]);
    
INI_Int("Saaf"PlayerInfo[playerid][Saaf]);
    
INI_Int("Sapd"PlayerInfo[playerid][Sapd]);
    
INI_Int("Drivinglicense"PlayerInfo[playerid][Drivinglicense]);
    return 
1;
}
stock UserPath(playerid)
{
    new 
string[128], pName[MAX_PLAYER_NAME];
    
GetPlayerName(playeridpNameMAX_PLAYER_NAME);
     
format(stringsizeof string"/Users/%s.txt"pName);
    return 
string;

Reply


Messages In This Thread
Password - by saffierr - 02.01.2016, 23:56
Re: Password - by AndySedeyn - 03.01.2016, 00:05
Re: Password - by saffierr - 03.01.2016, 00:07
Re: Password - by AndySedeyn - 03.01.2016, 00:21

Forum Jump:


Users browsing this thread: 2 Guest(s)