Dialog Box Registration
#1

I want to make a registration system based on dialog boxes, so here is my code:
Код:
public SetPlayerSpawn(playerid) 
{
	if(IsPlayerConnected(playerid))
	{
	    if(PlayerInfo[playerid][pTut] == 0)
	    {
			gOoc[playerid] = 1; gNews[playerid] = 1; gFam[playerid] = 1;
			TogglePlayerControllable(playerid, 0);
      		RegistrationStep[playerid] = 1;
			ShowPlayerDialog(playerid,1,DIALOG_STYLE_MSGBOX,"Registration","Let's get started, what is your sex?","Male","Female");
			return 1;
	    }
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
        if(RegistrationStep[playerid] > 0)
	{
	    new sendername[MAX_PLAYER_NAME];
		new string[256];
	    if(RegistrationStep[playerid] == 1)
	    {
		    if(dialogid==1 && response==1)
			{
                GetPlayerName(playerid, sendername, sizeof(sendername));
			    PlayerInfo[playerid][pSex] = 1;
			    format(string, sizeof(string), "So %s, You are a male.", sendername);
			    SendClientMessage(playerid, COLOR_WHITE, string);
			    RegistrationStep[playerid] = 2;
			    SetPlayerSkin(playerid, 60);
			    ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Registration","When were you born?","Next Step","");
			    return 0;
			}
			else if(dialogid=1 && response==0)
			{
                GetPlayerName(playerid, sendername, sizeof(sendername));
			    PlayerInfo[playerid][pSex] = 2;
			    format(string, sizeof(string), "So %s, You are a female.", sendername);
			    SendClientMessage(playerid, COLOR_WHITE, string);
			    RegistrationStep[playerid] = 2;
			    SetPlayerSkin(playerid, 91);
			    ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Registration","When were you born?","Next Step","");
			    return 0;
			}
		}
		else if(RegistrationStep[playerid] == 2)
	    {
	        new year, month,day;
			getdate(year, month, day);
	        new DateInfo[3][20];
			split(DateInfo, '/');
			if(dialogid==2 && response==strvalEx(DateInfo[1]) == month && strvalEx(DateInfo[0]) > day)
			{
			    check -= 1;
			}
			PlayerInfo[playerid][pAge] = check;
			GetPlayerName(playerid, sendername, sizeof(sendername));
			format(string, sizeof(string), "So %s, You have %d years old.", sendername, PlayerInfo[playerid][pAge]);
			SendClientMessage(playerid, COLOR_WHITE, string);
			RegistrationStep[playerid] = 3;
      		ShowPlayerDialog(playerid,3,DIALOG_STYLE_MSGBOX,"Registration","Where do you wish to be spawned?","Los Santos","San Fierro");
			return 0;
	    }
	    else if(RegistrationStep[playerid] == 3)
	    {
		    if((dialogid==3 && response==1)
			{
			    PlayerInfo[playerid][pOrigin] = 1;
			    SendClientMessage(playerid, COLOR_WHITE, "Ok, so you were been spawned in Los Santos.");
			    SendClientMessage(playerid, COLOR_1GREEN, "*** Now it's time for tutorial.");
				RegistrationStep[playerid] = 0;
			    TutTime[playerid] = 1;
			    return 0;
			}
			else if(dialogid==3 && response==0)
			{
			    PlayerInfo[playerid][pOrigin] = 2;
			    SendClientMessage(playerid, COLOR_WHITE, "Ok, so you were been spawned in San Fierro.");
			    SendClientMessage(playerid, COLOR_1GREEN, "*** Now it's time for tutorial.");
				RegistrationStep[playerid] = 0;
			    TutTime[playerid] = 1;
			    return 0;
			}

		}
		return 1;
	}
but i get a bunch of errors and warnings, and i don't figure it out where could be the problem. Please don't give me responses from wiki. Thanks in advance.
Reply
#2

That Code is VERY messed up! You don't go "
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
        if(RegistrationStep[playerid] > 0)
It should be: "
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
        if(dialogid == 1)
        {
         if(RegistrationStep[playerid] == 3)
Just thought I should point that out.
Reply
#3

Do you want to make register system with dialogs in LARP? Tell me if so I can help you out, because I made one
Reply
#4

@[UG]Scripter still doesn't work...
@GangsTa[MD] no i want to make the system in a GF edit

I need at born date response some help...
Reply
#5

Quote:
Originally Posted by GAGS25
Посмотреть сообщение
@[UG]Scripter still doesn't work...
@GangsTa[MD] no i want to make the system in a GF edit

I need at born date response some help...
I was saying thats how it should be formatted. I'm not going to rewrite all your code for you.

use the starting point I have given you and work from there it won't take you that long.
Reply
#6

Thanks [UG]Scripter!
I rewrote the system, it works fine.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)