Need helpwith multiple dialogs after regstration.. -
Scrillex - 28.10.2013
Hello dear samp members maybe you could help me out..
Making script from scrach..
Ohh and yeah it is gf.. But I need help.
So here is dialogs:
pawn Код:
ShowMainMenuDialog(playerid, frame)
{
new titlestring[64];
new string[256];
switch(frame)
{
case 1:
{
new ip[32];
GetPlayerIp(playerid, ip, 32);
format(titlestring, sizeof(titlestring), "Login - %s", GetPlayerNameEx(playerid));
format(string, sizeof(string), "Welcome to Golden Power Roleplay, %s.\n\nIP Address: *<*<*<*<*<*<*<\n\nThe name that you are using is registered, please enter a password to login:", GetPlayerNameEx(playerid), ip);
ShowPlayerDialog(playerid,MAINMENU,DIALOG_STYLE_PASSWORD,titlestring,string,"Login","Exit");
}
case 2:
{
new ip[32];
GetPlayerIp(playerid, ip, 32);
format(titlestring, sizeof(titlestring), "Register - %s", GetPlayerNameEx(playerid));
format(string, sizeof(string), "Welcome to Golden Power Roleplay, %s.\n\nIP Address: %s\n\nYou may register an account by entering a desired password here:", GetPlayerNameEx(playerid), ip);
ShowPlayerDialog(playerid,MAINMENU2,DIALOG_STYLE_PASSWORD,titlestring,string,"Register","Exit");
}
case 3:
{
new ip[32];
GetPlayerIp(playerid, ip, 32);
format(titlestring, sizeof(titlestring), "Login - %s", GetPlayerNameEx(playerid));
format(string, sizeof(string), "Invalid Password!\n\nWelcome to Golden Power Roleplay, %s.\n\nIP Address: %s\n\nThe name that you are using is registered, please enter a password to login:", GetPlayerNameEx(playerid), ip);
ShowPlayerDialog(playerid,MAINMENU,DIALOG_STYLE_PASSWORD,titlestring,string,"Login","Exit");
}
}
}
I want to get SEX dialog shows after registration....
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == MAINMENU || dialogid == MAINMENU2)
{
if(dialogid == MAINMENU)
{
if( response == 0 )
{
SendClientMessageEx(playerid, COLOR_RED, "SERVER: You have been kicked out automatically.");
Kick(playerid);
}
else
{
if(strlen(inputtext))
{
new tmppass[64];
strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
Encrypt(tmppass);
OnPlayerLogin(playerid,tmppass);
}
else
{
new loginname[64];
GetPlayerName(playerid,loginname,sizeof(loginname));
ShowPlayerDialog(playerid,MAINMENU,DIALOG_STYLE_INPUT,"Login","Incorrect password. \n \nThat name is registered, you may now enter your password.","Login","Exit");
gPlayerLogTries[playerid] += 1;
if(gPlayerLogTries[playerid] == 2) { SendClientMessageEx(playerid, COLOR_RED, "SERVER: Wrong password, you have been kicked out automatically."); Kick(playerid); }
}
}
}
if(dialogid == MAINMENU2)
{
if(strlen(inputtext))
{
GetPlayerName(playerid, sendername, sizeof(sendername));
if(doesAccountExist(sendername))
{
SendClientMessageEx(playerid, COLOR_YELLOW, "That username is already taken, please choose a different one.");
return 1;
}
new tmppass[64];
strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
Encrypt(tmppass);
OnPlayerRegister(playerid,tmppass);
}
}
}
if(dialogid == SEX)
{
if(response)
{
if(listitem == 0)//male
{
PlayerInfo[playerid][pSex] = 1;
}
if(listitem == 1)//female
{
PlayerInfo[playerid][pSex] = 2;
}
}
}
SafeLogin:
pawn Код:
public SafeLogin(playerid)
{
// Main Menu Features.
SetPlayerJoinCamera(playerid);
ClearChatbox(playerid);
SetPlayerVirtualWorld(playerid, 0);
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
if(doesAccountExist(playername))
{
gPlayerAccount[playerid] = 1;
ShowMainMenuDialog(playerid, 1);
return 1;
}
else
{
if( strfind( playername, "_", true) == -1 )
{
SendClientMessageEx( playerid, COLOR_WHITE, "Connection rejected. Please get a name in the correct format: Firstname_Lastname." );
}
else
{
gPlayerAccount[playerid] = 0;
ShowMainMenuDialog(playerid, 2);
}
return 1;
}
}
Thank you very much for your help and your time.
With best regards Scrillex.
Re: Need helpwith multiple dialogs after regstration.. -
Danialdano - 28.10.2013
EDIT: Where's the sex dialog?
Re: Need helpwith multiple dialogs after regstration.. -
Scrillex - 28.10.2013
So basically to put all together? In one dialog right? And under OnPlayerConnect to checkif the player has an accound right?
Sex dialog is under if(dialogid == MAINMENU2) just need to scroll down.
Re: Need helpwith multiple dialogs after regstration.. -
Danialdano - 28.10.2013
The sex dialog could you show em to me?
Re: Need helpwith multiple dialogs after regstration.. -
Scrillex - 28.10.2013
pawn Код:
ShowPlayerDialog(playerid, SEX, DIALOG_STYLE_LIST, "Please select your sex:", "Male\nFemale", "Ok", "Quit");
pawn Код:
if(dialogid == SEX)
{
if(response)
{
if(listitem == 0)//male
{
PlayerInfo[playerid][pSex] = 1;
}
if(listitem == 1)//female
{
PlayerInfo[playerid][pSex] = 2;
}
}
}
Re: Need helpwith multiple dialogs after regstration.. -
Danialdano - 28.10.2013
Try this
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == MAINMENU || dialogid == MAINMENU2)
{
if(dialogid == MAINMENU)
{
if( response == 0 )
{
SendClientMessageEx(playerid, COLOR_RED, "SERVER: You have been kicked out automatically.");
Kick(playerid);
}
else
{
if(strlen(inputtext))
{
new tmppass[64];
strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
Encrypt(tmppass);
OnPlayerLogin(playerid,tmppass);
}
else
{
new loginname[64];
GetPlayerName(playerid,loginname,sizeof(loginname));
ShowPlayerDialog(playerid,MAINMENU,DIALOG_STYLE_INPUT,"Login","Incorrect password. \n \nThat name is registered, you may now enter your password.","Login","Exit");
gPlayerLogTries[playerid] += 1;
if(gPlayerLogTries[playerid] == 2) { SendClientMessageEx(playerid, COLOR_RED, "SERVER: Wrong password, you have been kicked out automatically."); Kick(playerid); }
}
}
}
if(dialogid == MAINMENU2)
{
if(strlen(inputtext))
{
GetPlayerName(playerid, sendername, sizeof(sendername));
if(doesAccountExist(sendername))
{
SendClientMessageEx(playerid, COLOR_YELLOW, "That username is already taken, please choose a different one.");
return 1;
}
new tmppass[64];
strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
Encrypt(tmppass);
OnPlayerRegister(playerid,tmppass);
ShowDialog(playerid, SEX);
}
}
}
if(dialogid == SEX)
{
if(response)
{
if(listitem == 0)//male
{
PlayerInfo[playerid][pSex] = 1;
}
if(listitem == 1)//female
{
PlayerInfo[playerid][pSex] = 2;
}
}
}
Re: Need helpwith multiple dialogs after regstration.. -
Scrillex - 28.10.2013
Thank you for your response.
Umm that willnot work.. because it checks only if the player is loging registring correctly.. thats why Iasked for help.. I knw something ain't right.. there is needed to be much easyier way..
Re: Need helpwith multiple dialogs after regstration.. -
Danialdano - 28.10.2013
Well i put this ShowDialog(playerid, SEX); under the registration part so when he registers it comes directly to the sex dialog.
Re: Need helpwith multiple dialogs after regstration.. -
Scrillex - 28.10.2013
For got about this part.. where is showing the part how is checking going.
pawn Код:
public SafeLogin(playerid)
{
// Main Menu Features.
SetPlayerJoinCamera(playerid);
ClearChatbox(playerid);
SetPlayerVirtualWorld(playerid, 0);
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
if(doesAccountExist(playername))
{
gPlayerAccount[playerid] = 1;
ShowMainMenuDialog(playerid, 1);
return 1;
}
else
{
if( strfind( playername, "_", true) == -1 )
{
SendClientMessageEx( playerid, COLOR_WHITE, "Connection rejected. Please get a name in the correct format: Firstname_Lastname." );
}
else
{
gPlayerAccount[playerid] = 0;
ShowMainMenuDialog(playerid, 2);
}
return 1;
}
}
Re: Need helpwith multiple dialogs after regstration.. -
Danialdano - 28.10.2013
That has nothing to do with the part where he registers? it only detects if he have a _ in his name.