DialogResponse Issue
#1

-delete- self fixed.
Reply
#2

add a closing brace at the very end

}
Reply
#3

I don't want to steal Jonny5's answer so credit goes to him for this one:

pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_GATE)
        {
        new i = OpeningGate[playerid];
        new password[MAX_STRING];
        if(response)
        {
            if(!strlen(inputtext))
            {
                OpeningGate[playerid] = 9999;
                TogglePlayerControllable(playerid,1);
                return 1;
            }
            strmid(password, inputtext, 0, strlen(inputtext), 255);
            if(strcmp(GateInfo[i][gGatePassword],password, true ) == 0 )
            {
                if(GateInfo[i][gGateStatus] == 0)
                {
                    OpeningGate[playerid] = 9999;
                    GateInfo[i][gGateStatus] = 1;
                    MoveDynamicObject(GateInfo[i][gGateID], GateInfo[i][gGateMoveX], GateInfo[i][gGateMoveY], GateInfo[i][gGateMoveZ], GateInfo[i][gGateSpeed], GateInfo[i][gGateMoveRX], GateInfo[i][gGateMoveRY], GateInfo[i][gGateMoveRZ]);
                    SendClientMessage(playerid,COLOR_WHITE,"You have succesfuly opened the gate.");
                    TogglePlayerControllable(playerid,1);
                    SaveGate(i);
                }
                else
                {
                    OpeningGate[playerid] = 9999;
                    GateInfo[i][gGateStatus] = 0;
                    MoveDynamicObject(GateInfo[i][gGateID], GateInfo[i][gGatePosX], GateInfo[i][gGatePosY], GateInfo[i][gGatePosZ], GateInfo[i][gGateSpeed], GateInfo[i][gGatePosRX], GateInfo[i][gGatePosRY], GateInfo[i][gGatePosRZ]);
                    SendClientMessage(playerid,COLOR_WHITE,"You have succesfuly closed the gate.");
                    TogglePlayerControllable(playerid,1);
                    SaveGate(i);
                }
            }
            else
            {
                OpeningGate[playerid] = 9999;
                TogglePlayerControllable(playerid,1);
                SendClientMessage(playerid, COLOR_GREY, "   You have typed in a wrong password.");
                return 1;
            }
        }
        else
        {
            OpeningGate[playerid] = 9999;
            TogglePlayerControllable(playerid,1);
            return 1;
        }
    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"Registering...",""COL_RED"You have entered an invalid 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,"Bank Account", 0);
                INI_WriteInt(File,"Playing Hours", 0);
                INI_WriteInt(File,"Faction", 0);
                INI_WriteInt(File,"Leader", 0);
                INI_WriteInt(File,"Job", 0);
                INI_Close(File);

                SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
                SpawnPlayer(playerid);
                ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Welcome, your account has been saved to our Database!","Ok","");
            }
        }
        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]);
                    ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
                }
                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;
            }
}
}
That's only if you're lazy :P
Reply
#4

E:\E-RP 0.3e - Copy\gamemodes\MIDORP.pwn(2843) : error 030: compound statement not closed at the end of file (started at line 2680)
Got that error.
Reply
#5

nvm.....
Reply
#6

still not fixed, no one can do so?
Reply
#7

5th page, bump.
Reply
#8

Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_GATE)
    {
        new i = OpeningGate[playerid];
        new password[MAX_STRING];
        
        if(response)
        {
            if(!strlen(inputtext))
            {
                OpeningGate[playerid] = 9999;
                TogglePlayerControllable(playerid,1);
                return 1;
            }
            strmid(password, inputtext, 0, strlen(inputtext), 255);
      	 	if(strcmp(GateInfo[i][gGatePassword],password, true ) == 0 )
            {
                if(GateInfo[i][gGateStatus] == 0)
                {
                    OpeningGate[playerid] = 9999;
                    GateInfo[i][gGateStatus] = 1;
                    MoveDynamicObject(GateInfo[i][gGateID], GateInfo[i][gGateMoveX], GateInfo[i][gGateMoveY], GateInfo[i][gGateMoveZ], GateInfo[i][gGateSpeed], GateInfo[i][gGateMoveRX], GateInfo[i][gGateMoveRY], GateInfo[i][gGateMoveRZ]);
                    SendClientMessage(playerid,COLOR_WHITE,"You have succesfuly opened the gate.");
                    TogglePlayerControllable(playerid,1);
                    SaveGate(i);
                }
                else
                {
                    OpeningGate[playerid] = 9999;
                    GateInfo[i][gGateStatus] = 0;
                    MoveDynamicObject(GateInfo[i][gGateID], GateInfo[i][gGatePosX], GateInfo[i][gGatePosY], GateInfo[i][gGatePosZ], GateInfo[i][gGateSpeed], GateInfo[i][gGatePosRX], GateInfo[i][gGatePosRY], GateInfo[i][gGatePosRZ]);
                    SendClientMessage(playerid,COLOR_WHITE,"You have succesfuly closed the gate.");
                    TogglePlayerControllable(playerid,1);
                    SaveGate(i);
                }
            }
            else
            {
                OpeningGate[playerid] = 9999;
                TogglePlayerControllable(playerid,1);
                SendClientMessage(playerid, COLOR_GREY, "   You have typed in a wrong password.");
                return 1;
            }
        }
        else
        {
            OpeningGate[playerid] = 9999;
            TogglePlayerControllable(playerid,1);
            return 1;
        }
        
    	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"Registering...",""COL_RED"You have entered an invalid 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,"Bank Account", 0);
                	INI_WriteInt(File,"Playing Hours", 0);
                	INI_WriteInt(File,"Faction", 0);
                	INI_WriteInt(File,"Leader", 0);
                	INI_WriteInt(File,"Job", 0);
                	INI_Close(File);

                	SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
                	SpawnPlayer(playerid);
                	ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Welcome, your account has been saved to our Database!","Ok","");
            	}
        	}
        	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]);
                    	ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
                	}
                	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;
            	}
			}
		}
	}
}
Reply
#9

Quote:
Originally Posted by badnum23
View Post
Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_GATE)
    {
        new i = OpeningGate[playerid];
        new password[MAX_STRING];
        
        if(response)
        {
            if(!strlen(inputtext))
            {
                OpeningGate[playerid] = 9999;
                TogglePlayerControllable(playerid,1);
                return 1;
            }
            strmid(password, inputtext, 0, strlen(inputtext), 255);
      	 	if(strcmp(GateInfo[i][gGatePassword],password, true ) == 0 )
            {
                if(GateInfo[i][gGateStatus] == 0)
                {
                    OpeningGate[playerid] = 9999;
                    GateInfo[i][gGateStatus] = 1;
                    MoveDynamicObject(GateInfo[i][gGateID], GateInfo[i][gGateMoveX], GateInfo[i][gGateMoveY], GateInfo[i][gGateMoveZ], GateInfo[i][gGateSpeed], GateInfo[i][gGateMoveRX], GateInfo[i][gGateMoveRY], GateInfo[i][gGateMoveRZ]);
                    SendClientMessage(playerid,COLOR_WHITE,"You have succesfuly opened the gate.");
                    TogglePlayerControllable(playerid,1);
                    SaveGate(i);
                }
                else
                {
                    OpeningGate[playerid] = 9999;
                    GateInfo[i][gGateStatus] = 0;
                    MoveDynamicObject(GateInfo[i][gGateID], GateInfo[i][gGatePosX], GateInfo[i][gGatePosY], GateInfo[i][gGatePosZ], GateInfo[i][gGateSpeed], GateInfo[i][gGatePosRX], GateInfo[i][gGatePosRY], GateInfo[i][gGatePosRZ]);
                    SendClientMessage(playerid,COLOR_WHITE,"You have succesfuly closed the gate.");
                    TogglePlayerControllable(playerid,1);
                    SaveGate(i);
                }
            }
            else
            {
                OpeningGate[playerid] = 9999;
                TogglePlayerControllable(playerid,1);
                SendClientMessage(playerid, COLOR_GREY, "   You have typed in a wrong password.");
                return 1;
            }
        }
        else
        {
            OpeningGate[playerid] = 9999;
            TogglePlayerControllable(playerid,1);
            return 1;
        }
        
    	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"Registering...",""COL_RED"You have entered an invalid 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,"Bank Account", 0);
                	INI_WriteInt(File,"Playing Hours", 0);
                	INI_WriteInt(File,"Faction", 0);
                	INI_WriteInt(File,"Leader", 0);
                	INI_WriteInt(File,"Job", 0);
                	INI_Close(File);

                	SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
                	SpawnPlayer(playerid);
                	ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Welcome, your account has been saved to our Database!","Ok","");
            	}
        	}
        	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]);
                    	ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
                	}
                	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;
            	}
			}
		}
	}
}
the same error.
Reply
#10

Remove your OnDialogResponse and check if the error is the same, probably you have a missing brace somewhere else on your gamemode.
Reply
#11

Quote:
Originally Posted by iFederal
View Post
E:\E-RP 0.3e - Copy\gamemodes\MIDORP.pwn(2843) : error 030: compound statement not closed at the end of file (started at line 2680)
Got that error.
Can you show me just line number 2680 and 2843?
Reply
#12

Fixed it myself, to be locked.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)