Dialog system not working properly [+REP for help]
#1

Hello folks
I've came across this problem with my locker system.

I made the command to enter the dialog system from the locker but as soon as I want to enter a sub-category of it, it stops doing what it should do.

This is the command:
Код:
if(strcmp(cmdtext, "/locker", true) == 0)
The dialog that should open at first with all the sub-categories is working.

The sub-categories are under
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
And here is where it goes wrong. Sub-categories underneath the public don't open and don't show in game.

This is the code for the first dialog:
Код:
if(dialogid == DIALOG_LOCKER)
 	{
  		if(response)
		{
			switch(listitem)
  			{
	              case 0: // If Utility Belt
	              {
	                ShowPlayerDialog(playerid, DIALOG_LUBELT, DIALOG_STYLE_LIST, "Welcome to the --- locker!", "Baton \nDesert Eagle \nPepperspray \nBack", "Select", "Exit");
	              }
	              case 1: // If Rifles
	              {
	                ShowPlayerDialog(playerid, DIALOG_LHEAVY, DIALOG_STYLE_LIST, "Welcome to the --- locker!", "Shotgun \nBack", "Select", "Exit");
	              }
	              case 2: // If Melee Weapons
	              {
                    ShowPlayerDialog(playerid, DIALOG_LMELEE, DIALOG_STYLE_LIST, "Welcome to the --- locker!", "Baton \nPepperspray \nBack", "Select", "Exit");
	              }
	              case 3: // If Camera
	              {
                    GivePlayerWeapon(playerid, 43, 100); // Gives Camera with 100 shots
					ShowPlayerDialog(playerid, DIALOG_LOCKER, DIALOG_STYLE_LIST, "Welcome to the --- locker!", "Utility belt \nRifles \nMelee weapons \nCamera \nFirst Aid Kit \nArmour", "Select", "Exit");
	              }
	              case 4: // If First Aid Kit
	              {
                    SetPlayerHealth(playerid, 100); //100% health
					ShowPlayerDialog(playerid, DIALOG_LOCKER, DIALOG_STYLE_LIST, "Welcome to the --- locker!", "Utility belt \nRifles \nMelee weapons \nCamera \nFirst Aid Kit \nArmour", "Select", "Exit");
	              }
	              case 5: // If Armour
	              {
                    SetPlayerArmour(playerid, 50); //50% armour for normal locker
					ShowPlayerDialog(playerid, DIALOG_LOCKER, DIALOG_STYLE_LIST, "Welcome to the --- locker!", "Utility belt \nRifles \nMelee weapons \nCamera \nFirst Aid Kit \nArmour", "Select", "Exit");
	              }
	              
    		}
 		}
  	}
Help is much appreciated!
Don't pay attention to loose indentations!
Reply
#2

Well firstly, it's indented poorly, so fix that.

Also, where are the returns?

Lastly, what activates this in your /locker command (show us the line)?
Reply
#3

The indentation is not the main problem here. The forum fucked it up a bit with the [code] tags

I changed the code to this:
Код:
if(dialogid == DIALOG_LOCKER)
	{
	    if(response)
	    {
			if(listitem == 0)
			{
				ShowPlayerDialog(playerid, DIALOG_LUBELT, DIALOG_STYLE_LIST, "Welcome to the --- locker!", "Baton \nDesert Eagle \nPepperspray \nBack", "Select", "Exit");
				return 1;
			}
			if(listitem == 1)
			{
                ShowPlayerDialog(playerid, DIALOG_LHEAVY, DIALOG_STYLE_LIST, "Welcome to the --- locker!", "Shotgun \nBack", "Select", "Exit");
                return 1;
			}
			if(listitem == 2)
			{
                ShowPlayerDialog(playerid, DIALOG_LMELEE, DIALOG_STYLE_LIST, "Welcome to the --- locker!", "Baton \nPepperspray \nBack", "Select", "Exit");
                return 1;
			}
			if(listitem == 3)
			{
				GivePlayerWeapon(playerid, 43, 100);
				ShowPlayerDialog(playerid, DIALOG_LOCKER, DIALOG_STYLE_LIST, "Welcome to the --- locker!", "Utility belt \nRifles \nMelee weapons \nCamera \nFirst Aid Kit \nArmour", "Select", "Exit");
                return 1;
			}
			if(listitem == 4)
			{
				SetPlayerHealth(playerid, 100);
				ShowPlayerDialog(playerid, DIALOG_LOCKER, DIALOG_STYLE_LIST, "Welcome to the --- locker!", "Utility belt \nRifles \nMelee weapons \nCamera \nFirst Aid Kit \nArmour", "Select", "Exit");
                return 1;
			}
			if(listitem == 5)
			{
				SetPlayerArmour(playerid, 50);
				ShowPlayerDialog(playerid, DIALOG_LOCKER, DIALOG_STYLE_LIST, "Welcome to the --- locker!", "Utility belt \nRifles \nMelee weapons \nCamera \nFirst Aid Kit \nArmour", "Select", "Exit");
				return 1;
			}
		}
	}
I added the returns but still I am experiencing the same problem.

This is the /locker command:

Код:
if(strcmp(cmdtext, "/locker", true) == 0)
	{
		if(IsPlayerInRangeOfPoint(playerid, 5.0, 253.9568,76.8493,1003.6406))
		{
			ShowPlayerDialog(playerid, DIALOG_LOCKER, DIALOG_STYLE_LIST, "Welcome to the --- locker!", "Utility belt \nRifles \nMelee weapons \nCamera \nFirst Aid Kit \nArmour", "Select", "Exit");
			return 1;
		}
		else
		{
			SendClientMessage(playerid, COLOR_RED, "[NOTE] You're not in range of the LSPD locker!");
		}
		return 1;
	}
Reply
#4

I just noticed that the responses don't work.
Everything works except for the responses.
Reply
#5

bump
Reply
#6

bump
Reply
#7

So clearly it's something to do with the responses. Debug it!
Reply
#8

Quote:
Originally Posted by Zeppo
Посмотреть сообщение
So clearly it's something to do with the responses. Debug it!
Thanks for stating the obvious.
I don't see anything wrong with my response nor my format. A step or a hint to the right direction would be appreciated.
Reply
#9

A step forward would be debugging it. Like I've already said. "Thanks for stating the obvious" I wouldn't have too if you debugged it in the first place.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)