PDA

View Full Version : Account system not working


shift3r
02/01/2016, 02:36 PM
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!

fuckingcruse
02/01/2016, 02:50 PM
What do you need next, i mean what you want it to show after the GENDER pickup?

shift3r
02/01/2016, 02:52 PM
After the Gender I want the Age dialog then spawn.

Sh4d0w2
02/01/2016, 03:10 PM
I don't understand what language you are using but I think the options in gender dialog is Male and Female so I think its better to defined Male as 1 and Female as 2 and 0 as no gender ( they didn't choose it yet aka not register before ) rather than make one of the gender as 0.I don't know if this will help you fix your problem or not or what Im talking about is nonsense but why don't you give it a try.If you do this I suggest you to recreate or edit carefully your OnDialogResponse at gender dialog so there will be no codes that can fuck up this dialog OnDialogResponse and it will help you understand what it do......