menu Help --
#1

Hi all,
i need help with a menu
i wanna make if you typ a cmd example: /menu - then there comes a menu with 2 buttons :

button 1:Open gate
button 2:Close gate

Button 1 : MoveObject(menugate,0, -0, 0, 6.5);
Button 2: MoveObject(menugate,,0, -0, 0, 6.5);

can someone help me ?!?!
Reply
#2

put this under OnPlayerCommandText
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/menu", cmdtext, true, 10) == 0)
	{
		ShowPlayerDialog(playerid, 1234, DIALOG_STYLE_MSGBOX, "Gate funcion", "You have the rights to open or close the gate.\n\nPress Open for opening the gate\nPress Close the close the gate", "Open", "Close");
		return 1;
	}
	return 0;
}
And

This under OnDialogResponse
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
  if(dialogid == 1234)
	{
		if(response)
		{
			//where the object should be when open
		}
		else
		{
			//where the object should be when closed
		}
	}
	return 1;
}
Here you have it with dcmd

Top of script
Код:
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
under OnPlayerCommandText
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
 	dcmd(menu, 4, cmdtext);
	return 1;
}

dcmd_menu(playerid, params[])
{
	#pragma unused params
    ShowPlayerDialog(playerid, 1234, DIALOG_STYLE_MSGBOX, "Gate funcion", "You have the rights to open or close the gate.\n\nPress Open for opening the gate\nPress Close the close the gate", "Open", "Close");
	return 0;

}
Under OnDialogResponse
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
  if(dialogid == 1234)
	{
		if(response)
		{
			//where the object should be when open
		}
		else
		{
			//where the object should be when closed
		}
	}
	return 1;
}
UNTESTED
Reply
#3

deleted
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)