SA-MP Forums Archive
Dialog problem. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Dialog problem. (/showthread.php?tid=310807)



Dialog problem. - Nicholas. - 13.01.2012

Okay, I've add two new dialogs to my script. After registering your account you should receive these two dialogs, Sex and Age, dialogs. But the dialogs aren't loading after registration.

Here's what I have.

Quote:

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_AGE)
{
if(!response)
{
Kick(playerid);
}
else
{
if(strlen(inputtext))
{
new age = strval(inputtext);
if(age > 100 || age < 16)
{
ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "- Age -","How old are you??\n{FF0000}(( 16 - 100 ))","Answer","Quit");
}
else
{
PlayerInfo[playerid][pAge] = age;
new
string[ 64 ]
;
format(string, sizeof(string), "INFO: You're {3BB9FF}%d years old.",age);
SendClientMessage(playerid, -1, string);
SpawnPlayer(playerid);
}
}
else
{
return 0;
}
}
}
if(dialogid == DIALOG_SEX)
{
if(response)
{
PlayerInfo[playerid][pSex] = 1;
SendClientMessage(playerid, -1, "INFO: You are {3BB9FF}male.");
SetPlayerSkin(playerid, 60);
PlayerInfo[playerid][pSkin] = 60;
ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "- Age -","How old are you??\n{FF0000}(( 16 - 100 ))","Answer","Quit");
}
else
{
PlayerInfo[playerid][pSex] = 2;
SendClientMessage(playerid, -1, "INFO: You are {3BB9FF}female.");
SetPlayerSkin(playerid, 233);
PlayerInfo[playerid][pSkin] = 233;
ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "- Age -","How old are you??\n{FF0000}(( 16 - 100 ))","Answer","Quit");
}
}
switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"[Register]",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
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,"Sex",0);
INI_WriteInt(File,"Age",0);
INI_WriteInt(File,"Skin",0);
INI_Close(File);

ShowPlayerDialog(playerid, DIALOG_SEX, DIALOG_STYLE_MSGBOX, "- Sex -","What gender are you?","Male","Female");
}
}

case 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]);
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"[Login]",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
}
return 1;
}
}
}
return 1;
}




Re: Dialog problem. - iGetty - 14.01.2012

Add [pawn] [/pawn ] tags to clear it up a bit, because I can't understand a thing on there.


Re: Dialog problem. - EmpireSk - 02.02.2014

Please link to the download for this register