Dialog Response Problem!!
#1

Hello guys, I need your help to fix my admin system script, so as I said when I use my filescripts like that filterscripts avs Admin_System House_Sys.. so my House system doesn't work when I put it next to Admin System beucase My Dialog Response in it, is opened at the last like return 1} at the last of it so it makes the house sys Dialog Responsse not working. and I have many scripts like that with opened dialog and I need your help here you are the Dialog response script, I tried to put
Код:
      return 0;
}
at the finish of it but I found many of errores help me to fix even when I chage return 1 to 0 nothing happenes
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid) 
    { 
        case DIALOG_REGISTER:
        { 
            if(response)
            {
           	     new
                    string[179],pFile[35];

    				format(pFile, 35, Player_File, GetName(playerid));

    			 new
        			INI:UserFile = INI_Open(pFile);

    				INI_WriteInt(UserFile, "Password", udb_hash(inputtext));
    				INI_WriteInt(UserFile, "Admin", 0);
    				INI_WriteInt(UserFile, "Money", START_MONEY);
    				INI_WriteInt(UserFile, "Score", 0);
				    INI_WriteInt(UserFile, "Skin", SKIN_ID);
				    INI_WriteInt(UserFile, "Warn", 0);
				    INI_WriteInt(UserFile, "VIP", 0);

    				INI_Close(UserFile);

    				SetPVarInt(playerid, "Registered", 1);
    				SetPVarInt(playerid, "Logged", 1);
    				SpawnPlayer(playerid);

                    format(string, 125, ""COL_YELLOW"Name: "COL_WHITE"%s "COL_YELLOW"Password: "COL_WHITE"%s "COL_YELLOW"succesfuly registerd", GetName(playerid), inputtext);
                    SCM(playerid, 0x46BA29FF, string);
                    SpawnPlayer(playerid);
            } 
            else Kick(playerid);
        } 

        case DIALOG_LOGIN: 
        { 
            if(response)
            { 
                	new
                    pFile[35],dialog[128];

    				format(pFile, 35, Player_File, GetName(playerid));

    				INI_ParseFile(pFile, "LoadPlayerData", .bExtra = true, .extra = playerid);


    				if(udb_hash(inputtext) == P_Data[playerid][pPassword])
    				{
      				SetPVarInt(playerid, "Logged", 1);
      				SCM(playerid,-1,"Succesfuly login!");
    				}
   				 	else
    				{
        			format(dialog, sizeof(dialog),""COL_YELLOW"Name "COL_WHITE"%s "COL_YELLOW"is registered\n\n{FFFFFF}Please login", GetName(playerid));
        			ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "{FF0033}Welcome on my server",dialog, "Login", "Exit");
    				}
            	}
            else Kick(playerid); 
        }
        case DIALOG_CLICK:
        {
            	if(!response) return SCM(playerid,-1,"Dialog is closed");
            	new
            	    text[128];
            	switch(listitem)
            	{
				case 0: {
				Kick(GetPVarInt(playerid,"pplayerid"));
				SetPVarInt(playerid,"pplayerid",999);
				format(text,sizeof(text),"Admin %s is kick you from server!",GetName(playerid));
				SCM(GetPVarInt(playerid,"pplayerid"),-1,text);}
				case 1: {
				Ban(GetPVarInt(playerid,"pplayerid"));
				SetPVarInt(playerid,"pplayerid",999);
				format(text,sizeof(text),"Admin %s is ban you from server!",GetName(playerid));
				SCM(GetPVarInt(playerid,"pplayerid"),-1,text);				}
				case 2: {
				ShowPlayerDialog(playerid,DIALOG_ADMIN,DIALOG_STYLE_INPUT,"Admin Control Panel","Type admin level [1-5]","Make","Лxit");
				}
			}
	  }
   			case DIALOG_ADMIN:
        	{
            if(!response) return SCM(playerid,-1,"Dialog is closed");
			new
				string[128];
            P_Data[GetPVarInt(playerid,"pplayerid")][pAdmin] = strval(inputtext);
			format(string,sizeof(string),"Now you are admin level %d",strval(inputtext));
			SCM(GetPVarInt(playerid,"pplayerid"),-1,string);
			format(string,sizeof(string),"Player %s is now admin level %d",GetName(GetPVarInt(playerid,"pplayerid")),strval(inputtext));
			SCM(playerid,-1,string);
			SetPVarInt(playerid,"pplayerid",999);
		}
   			case RCON_DIALOG:
        	{
            if(!response) return SCM(playerid,-1,"Dialog is closed");
			new
				string[128];
				switch(listitem)
				{
				case 0: {//Server name
                ShowPlayerDialog(playerid,RCON_DIALOG+1,DIALOG_STYLE_INPUT,"Server name","Type new server name","Insert","Exit");
				}
				case 1: {//Map name
                ShowPlayerDialog(playerid,RCON_DIALOG+2,DIALOG_STYLE_INPUT,"Map name","Type new map name","Insert","Exit");
				}
				case 2: {//Web adress
                ShowPlayerDialog(playerid,RCON_DIALOG+3,DIALOG_STYLE_INPUT,"Web adress","Type new web adress","Insert","Exit");
				}
				case 3: {//Unlock
				SendRconCommand("password 0");
				}
				case 4: {//lock
				ShowPlayerDialog(playerid,RCON_DIALOG+4,DIALOG_STYLE_INPUT,"LOCK server","Type password for server","Insert","Exit");
				}
				case 5: {//GMX
				format(string,sizeof(string),"Admin %s has restart server",GetName(playerid));
				SCMToAll(-1,string);
				SendRconCommand("gmx");
				}
				case 6: {//Password
				ShowPlayerDialog(playerid,RCON_DIALOG+5,DIALOG_STYLE_INPUT,"Change password","Type new RCON password","Insert","Exit");
				}
				case 7: {//Turn Off
				format(string,sizeof(string),"Admin %s has shutted down server",GetName(playerid));
				SCMToAll(-1,string);
				SendRconCommand("exit");
				}
				}
			}
		case RCON_DIALOG+1:
			{
			new string[32];
			format(string, 16, "hostname %s",inputtext);
			SendRconCommand(string);
			}
		case RCON_DIALOG+2:
			{
			new string[32];
			format(string, 16, "mapname %s",inputtext);
			SendRconCommand(string);
			}
		case RCON_DIALOG+3:
			{
			new string[32];
			format(string, 16, "weburl %s",inputtext);
			SendRconCommand(string);
			}
		case RCON_DIALOG+4:
			{
  		 	new string[32];
			format(string, 16, "password %s",inputtext);
			SendRconCommand(string);
			}
		case RCON_DIALOG+5:
			{
  		 	new string[32];
			format(string, 16, "rcon_password %s",inputtext);
			SendRconCommand(string);
			}
  	   }
	return 1;
}
Reply
#2

Try to explain it better and post the code only for the thing you need fixed please.
Reply
#3

Quote:
Originally Posted by willbedie
Посмотреть сообщение
Try to explain it better and post the code only for the thing you need fixed please.
I want to finish this Dialog with return 0! because return 1 makes the next filescripts not working, You know something like
Код:
        return 1

}
        return 0

}
Reply
#4

Take a look at both scripts.
On the top of the script dialogs are defined.
For example #define DIALOG 10
Each define must be an Unique number.
You are probably using the same number for multiple dialogs.
So if both scripts have a dialog defined on number 10, it Will interfere. Change the Numbers.
Reply
#5

Return Values for Dialogs:
1: The function executed successfully.
0: The function failed to execute. This means the player is not connected.

so problem must be at code in other Filterscript, show us that code.
Reply
#6

Quote:
Originally Posted by Mugalito
Посмотреть сообщение
Return Values for Dialogs:
1: The function executed successfully.
0: The function failed to execute. This means the player is not connected.

so problem must be at code in other Filterscript, show us that code.
It HAS to be return 0 for the callback, otherwise no other scripts OnDialogResponse will be called.

Quote:
Originally Posted by wiki
Return Values:
Returning 0 in this callback will pass the dialog to another script in case no matching code were found in your gamemode's callback.
It is always called first in filterscripts so returning 1 there blocks other filterscripts from seeing it.
Nothing at all to do with the player, not being connected.
Reply
#7

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
It HAS to be return 0 for the callback, otherwise no other scripts OnDialogResponse will be called.



Nothing at all to do with the player, not being connected.
Exactly what can I do to retuurn it to 0?? Do you want all my script?
Reply
#8

return 0, just needs to be at the end of the callback in your gamemode.

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if all this stuff in here
    {
        Extra stuff and bits and bobs
    }
    return 0;    //<<===
}
If you use return 1, it'll stop looking as it's almost like 'result found' when you return one, being 'true', and where you have the return 0, it's like it says 'result not found, need to proceed to the next section' where it will keep going through each filterscript of this one callback, until it finds a confirmation, or runs out of things to check.


Mess about with it, and see what goes on. The more you look at things, and process it, the more you will learn over it.
Reply
#9

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
return 0, just needs to be at the end of the callback in your gamemode.

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if all this stuff in here
    {
        Extra stuff and bits and bobs
    }
    return 0;    //<<===
}
If you use return 1, it'll stop looking as it's almost like 'result found' when you return one, being 'true', and where you have the return 0, it's like it says 'result not found, need to proceed to the next section' where it will keep going through each filterscript of this one callback, until it finds a confirmation, or runs out of things to check.


Mess about with it, and see what goes on. The more you look at things, and process it, the more you will learn over it.
Listen, I am actually not great at these things, can you just copy my codes and post the right one with return 0? Because it gives me many of errors..
Reply
#10

Post your code and your errors and I'll explain why it is... Then you'll get better at it.

If you get given it, then you won't learn from it.


Especially post up what you attempted that gave you the errors, along with those errors.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)