Problem to update menus
#1

Код:
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...
Reply
#2

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;
}
Reply
#3

Just destroy and recreate it
Reply
#4

Код:
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
Reply
#5

Does anyone know why ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)