Account system not working
#1

Alright, my register dialogues defined:

Код:
#define DIALOG_REGISTER 1
#define DIALOG_LOGIN 2
#define DIALOG_SUCCESS_1 3
#define DIALOG_SUCCESS_2 4
#define DIALOG_AGE 5
#define DIALOG_SEX 6
my enums:

Код:
enum pInfo
{
    pPass,
    pCash,
    pAdmin,
    pKills,
    pDeaths,
    pLevel,
    pExp,
    pAdminLevel,
    pAge,
    pSex
}
my onplayerconnect:

Код:
public OnPlayerConnect(playerid)
{
	PlayerInfo[playerid][pAdminLevel] = 0;
    PlayerInfo[playerid][pLevel] = 1;
	PlayerInfo[playerid][pExp] = 0;
	SetPlayerCameraPos(playerid, 1108.7909,-839.2827,111.9381);
	SetPlayerCameraLookAt(playerid, 1109.7909,-840.2827,111.9281);
	if(fexist(UserPath(playerid)))
	{
		INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  		ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_WHITE"Prijava",""COL_WHITE"Dobrodoљli natrag na {00CED1}Evolution Gaming Roleplay!\n{FFFFFF}Molimo upiљite lozinku u polje ispod.","Prijava","Odustani");
	}
	else
	{
 		ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,""COL_WHITE"Registracija",""COL_WHITE"Pozdrav! Dobrodoљli na {00CED1}Evolution Gaming Roleplay {FFFFFF}server.\n Da biste se registrirali, molimo ukucajte ћeljenu lozinku u polje ispod. ","Potvrdi","Odustani");
	}
	return 1;
}
my ondialogresponse:

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch( dialogid )
    {
        case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, ""COL_WHITE"Registracija",""COL_RED"Upisali ste nevaћeću lozinku.\n"COL_WHITE"Molimo upiљite lozinku u polje ispod.","Potvrdi","Odustani");
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Cash",0);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_WriteInt(File,"AdminLevel",0);
                INI_Close(File);
                ShowPlayerDialog(playerid,DIALOG_SEX,DIALOG_STYLE_LIST,"Molimo odaberite spol vaљeg lika","Muљko\nЋensko","Ok","Odustani");
                
			}
  			if(dialogid == DIALOG_SEX)
  {
    if(!response) return ShowPlayerDialog(playerid,pSex,DIALOG_STYLE_LIST,"Molimo odaberite spol vaљeg lika","Muљko\nЋensko","Ok","Odustani");
    if(response)
    {
      switch(listitem)
      {
         case 0:
         {
           if(PlayerInfo[playerid][pSex] == 1)
           {
             new INI:File = INI_Open(UserPath(playerid));
             INI_SetTag(File,"data");
             INI_WriteInt(File,"Sex",1);
             INI_Close(File);
             PlayerInfo[playerid][pSex] = 1;
             ShowPlayerDialog(playerid,DIALOG_AGE,DIALOG_STYLE_INPUT,"---------Dob--------","Molimo odaberite godine vaљeg lika da bi nastavili","Ok","Odustani");
           }
           else
           {
             new INI:File = INI_Open(UserPath(playerid));
             INI_SetTag(File,"data");
             INI_WriteInt(File,"Sex",1);
             INI_Close(File);
             PlayerInfo[playerid][pSex] = 1;
           }
           return 1;
         }
         case 1:
         {
           if(PlayerInfo[playerid][pSex] == 0)
           {
             new INI:File = INI_Open(UserPath(playerid));
             INI_SetTag(File,"data");
             INI_WriteInt(File,"Sex",0);
             INI_Close(File);
             PlayerInfo[playerid][pSex] = 0;
             ShowPlayerDialog(playerid,DIALOG_AGE,DIALOG_STYLE_INPUT,"---------Dob--------","Molimo odaberite godine vaљeg lika da bi nastavili","Ok","Odustani");
           }
           else
           {
             new INI:File = INI_Open(UserPath(playerid));
             INI_SetTag(File,"data");
             INI_WriteInt(File,"Sex",0);
             INI_Close(File);
             PlayerInfo[playerid][pSex] = 0;
           }
           if(dialogid == DIALOG_AGE)
  {
    if(!response) return ShowPlayerDialog(playerid,DIALOG_AGE,DIALOG_STYLE_INPUT,"--------Dob--------","Molimo odaberite godine vaљeg lika da bi nastavili","Ok","Odustani");
    if(response)
    {
      new INI:File = INI_Open(UserPath(playerid));
      INI_SetTag(File,"data");
      INI_WriteString(File,"Age",(inputtext));
      INI_Close(File);
      SetSpawnInfo(playerid, 0, 101, 1685.8156, -2332.9292, -2.6797, 357.3618, 0, 0, 0, 0, 0, 0);
      SpawnPlayer(playerid);
      ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Dobrodoљli!",""COL_WHITE"Uspjeљno ste se registrirali na {00CED1}Evolution Gaming Roleplay.\n {FFFFFF}Ukoliko vam je potrebna pomoć, kontaktirajte admina putem komande /report.\n {00CED1}Sretno!","Ok","");
		}
    }
  }
         }
      }
    }
  }
        }

	if(dialogid == DIALOG_LOGIN)
        {
            if ( !response ) return Kick ( playerid );
            if( response )
            {
                if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                    SetSpawnInfo(playerid, 0, 101, 1685.8156, -2332.9292, -2.6797, 357.3618, 0, 0, 0, 0, 0, 0);
     				SpawnPlayer(playerid);
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_WHITE"Prijava",""COL_RED"Upisali ste netočnu lozinku.\n"COL_WHITE"Molimo upiљite točnu lozinku za prijavu.","Prijava","Odustani");
                }
                return 1;
            }
        }
    return 0;
}
When I enter the game as a new player, it only shows me the registration dialogue. When I input the password I want and hit OK, the dialogue for Sex appears. After I pick my gender and hit OK, the dialogue disappears and I'm left with the Spawn button. The info for my gender also isn't inputted (I checked later in the character file). You guys maybe know what's wrong with the code? Big thanks!
Reply


Messages In This Thread
Account system not working - by shift3r - 02.01.2016, 14:36
Re: Account system not working - by fuckingcruse - 02.01.2016, 14:50
Re: Account system not working - by shift3r - 02.01.2016, 14:52
Re: Account system not working - by Sh4d0w2 - 02.01.2016, 15:10

Forum Jump:


Users browsing this thread: 1 Guest(s)