SA-MP Forums Archive
Problem to update menus - 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: Problem to update menus (/showthread.php?tid=116140)



Problem to update menus - Alice[WS] - 27.12.2009

Код:
stock UpdateMenu(Menu: MenuID, function[])
{
	for(new j = 0; j < MAX_SERVER_PLAYERS; j++)
	{
	  if(Spawned[j] == 1)
	  {
		  if(GetPlayerMenu(j) == MenuID)
		  {
		    SendClientMessage(j, 0xff0000ff, "This Menu Will Be Updated");
		  	HideMenuForPlayer(MenuID, j);          // not working
				format(OldMenu[j], 60, "%s", function);
			}
		}
	}
	CallLocalFunction(function,"");
	for(new l = 0; l < MAX_SERVER_PLAYERS; l++)
	{
		if(Spawned[l] == 1)
	  {
	    if(strmatch(OldMenu[l],function))
	    {
	      SendClientMessage(l, 0xff0000ff, "Menu Updated");
	      ShowMenuForPlayer(MenuID, l);          // not working
				OldMenu[l] = 0;
			}
		}
	}
}
It sends The Messages but the menus are not hidden and Showed back. I don't know why...


Re: Problem to update menus - Alice[WS] - 28.12.2009

And i forgot to say, the function which is called is a CreateBlaBlaMenus.

For exemple:

Код:
public OnPlayerSelectedMenuRow(playerid, row)
{
new Menu: Current = GetPlayerMenu(playerid);
if(Current == AK47)
{
UpdateMenu(AK47, "CreateAK47Menus")        <== not working
return 1;
}
return 1;
}



Re: Problem to update menus - dice7 - 28.12.2009

Just destroy and recreate it


Re: Problem to update menus - Alice[WS] - 28.12.2009

Код:
public OnPlayerSelectedMenuRow(playerid, row)
{
new Menu: Current = GetPlayerMenu(playerid);
if(Current == AK47)
{
for(new j = 0; j < MAX_SERVER_PLAYERS; j++)
{
if(Spawned[j] == 1)
{
if(GetPlayerMenu(j) == AK47)
{
HideMenuForPlayer(AK47, j);
format(OldMenu[j], 60, "%s", "CreateAK47Menus");
}
}
}
CallLocalFunction("CreateAK47Menus","");
for(new l = 0; l < MAX_SERVER_PLAYERS; l++)
{
if(Spawned[l] == 1)
{
if(strmatch(OldMenu[l],"CreateAK47Menus"))
{
ShowMenuForPlayer(AK47, l);
OldMenu[l] = 0;
}
}
}	
return 1;
}
return 1;
}
This code works. So the problem isn't because the menu isn't destroyed


Re: Problem to update menus - Alice[WS] - 28.12.2009

Does anyone know why ?