SA-MP Forums Archive
menu Help -- - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: menu Help -- (/showthread.php?tid=111900)



menu Help -- - Rick_Guiy - 04.12.2009

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 ?!?!


Re: menu Help -- - Niixie - 04.12.2009

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


Re: menu Help -- - Niixie - 04.12.2009

deleted