SA-MP Forums Archive
DialogResponse Issue - 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: DialogResponse Issue (/showthread.php?tid=347013)



DialogResponse Issue - iFederal - 31.05.2012

-delete- self fixed.


Re: DialogResponse Issue - Jonny5 - 31.05.2012

add a closing brace at the very end

}


Re: DialogResponse Issue - Edward156 - 31.05.2012

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


Re: DialogResponse Issue - iFederal - 31.05.2012

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.


Re: DialogResponse Issue - Supercop - 31.05.2012

nvm.....


Re: DialogResponse Issue - iFederal - 31.05.2012

still not fixed, no one can do so?


Re: DialogResponse Issue - iFederal - 31.05.2012

5th page, bump.


Re: DialogResponse Issue - badnum23 - 31.05.2012

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;
            	}
			}
		}
	}
}



Re: DialogResponse Issue - iFederal - 31.05.2012

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.


Re: DialogResponse Issue - mati233 - 31.05.2012

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


Re: DialogResponse Issue - Edward156 - 31.05.2012

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?


Re: DialogResponse Issue - iFederal - 23.06.2012

Fixed it myself, to be locked.