[HELP] menu's
#1

ok how do i make like 3 menu's in the same script?
with out getting any warning/errors?
srry iam a noob at menu's.
Код:
#include <a_samp>

#define FILTERSCRIPT
#define COLOR_RED 0xAA3333AA

#if defined FILTERSCRIPT

new Menu:desertdm;
new Menu:classes;


new SasRandomSkins[4] = {
287,286,285,164
};

new RusRandomSkins[4] = {
127,124,112,111
};


public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print("       Desert dm         ");
	print("--------------------------------------\n");

	classes = CreateMenu("Pick A Class", 1, 50.0, 180.0, 200.0, 200.0);

	AddMenuItem(classes, 0, "Assault");
	AddMenuItem(classes, 0, "SMG");
	AddMenuItem(classes, 0, "Demolition");

	desertdm = CreateMenu("Who Will You Join?", 1, 50.0, 180.0, 200.0, 200.0);

	AddMenuItem(desertdm, 0, "SAS");
	AddMenuItem(desertdm, 0, "Russians");
	
	return 1;
}
public OnFilterScriptExit()
{
	return 1;
}



public OnPlayerSelectedMenuRow(playerid, row)
{
  new Menu:current;
  current = GetPlayerMenu(playerid);
  if(current == desertdm)
  {
    switch(row)
    {
    case 0: //Pistol
		{
			new rand = random(sizeof(SasRandomSkins));
			SetPlayerSkin(playerid, SasRandomSkins[rand]);
		  SetPlayerPos(playerid, 3515.6499,-1556.9915,17.1419);
			SendClientMessage(playerid, COLOR_RED, "Leave No Survivors!");
			}

     case 1: //Deagle
		{
			new rand = random(sizeof(RusRandomSkins));
			SetPlayerSkin(playerid, RusRandomSkins[rand]);
			SetPlayerPos(playerid, 3767.9978,-1576.7815,19.5032);
			SendClientMessage(playerid, COLOR_RED, "Come On Comrads");
			ShowMenuForPlayer(classes, playerid);
			}
 		 case 9: //ExitMenu
	 	{
      TogglePlayerControllable(playerid, true);
			HideMenuForPlayer(desertdm, playerid);
      }

    }
  }
  return 1;
}
public OnPlayerSelectedMenuRow(playerid, row)
{
  new Menu:current;
  current = GetPlayerMenu(playerid);
  if(current == classes)
  {
    switch(row)
    {
    case 0: //Assault
		{
      GivePlayerWeapon(playerid, 23, 50);
      GivePlayerWeapon(playerid, 31, 250);
      GivePlayerWeapon(playerid, 16, 1);
      GivePlayerWeapon(playerid, 4, 1);
      TogglePlayerControllable(playerid, true);
			}

     case 1: //Smg
		{
      GivePlayerWeapon(playerid, 29, 250);
      GivePlayerWeapon(playerid, 23, 50);
      GivePlayerWeapon(playerid, 16, 5);
      GivePlayerWeapon(playerid, 4, 1);
      TogglePlayerControllable(playerid, true);
			}
 		 case 2: //Demolition
	 	{
      GivePlayerWeapon(playerid, 25, 150);
      GivePlayerWeapon(playerid, 23, 50);
      GivePlayerWeapon(playerid, 16, 1);
      GivePlayerWeapon(playerid, 4, 1);
      GivePlayerWeapon(playerid, 35, 5);
      TogglePlayerControllable(playerid, true);
      }

    }
  }
  return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	if(strcmp(cmdtext, "/desertdm", true) == 0)
	{
	  ShowMenuForPlayer(desertdm, playerid);
	  TogglePlayerControllable(playerid, false);
	  return 1;
 	}
	if(strcmp(cmdtext, "/classes", true) == 0)
	{
	  ShowMenuForPlayer(classes, playerid);
	  TogglePlayerControllable(playerid, false);
	  return 1;
	}
	return 0;
}
#endif
Reply
#2

I would recomend http://forum.sa-mp.com/index.php?topic=44596.0 for you.

pawn Код:
#include <a_samp>

#define FILTERSCRIPT
#define COLOR_RED 0xAA3333AA

#if defined FILTERSCRIPT

new Menu:desertdm;
new Menu:classes;


new SasRandomSkins[4] = {
287,286,285,164
};

new RusRandomSkins[4] = {
127,124,112,111
};


public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print("       Desert dm         ");
    print("--------------------------------------\n");

    classes = CreateMenu("Pick A Class", 1, 50.0, 180.0, 200.0, 200.0);

    AddMenuItem(classes, 0, "Assault");
    AddMenuItem(classes, 0, "SMG");
    AddMenuItem(classes, 0, "Demolition");

    desertdm = CreateMenu("Who Will You Join?", 1, 50.0, 180.0, 200.0, 200.0);

    AddMenuItem(desertdm, 0, "SAS");
    AddMenuItem(desertdm, 0, "Russians");
   
    return 1;
}
public OnFilterScriptExit()
{
    return 1;
}



public OnPlayerSelectedMenuRow(playerid, row)
{
  new Menu:current;
  current = GetPlayerMenu(playerid);
  if(current == desertdm)
  {
    switch(row)
    {
    case 0: //Pistol
        {
            new rand = random(sizeof(SasRandomSkins));
            SetPlayerSkin(playerid, SasRandomSkins[rand]);
          SetPlayerPos(playerid, 3515.6499,-1556.9915,17.1419);
            SendClientMessage(playerid, COLOR_RED, "Leave No Survivors!");
            }

     case 1: //Deagle
        {
            new rand = random(sizeof(RusRandomSkins));
            SetPlayerSkin(playerid, RusRandomSkins[rand]);
            SetPlayerPos(playerid, 3767.9978,-1576.7815,19.5032);
            SendClientMessage(playerid, COLOR_RED, "Come On Comrads");
            ShowMenuForPlayer(classes, playerid);
            }
         case 9: //ExitMenu
        {
      TogglePlayerControllable(playerid, true);
            HideMenuForPlayer(desertdm, playerid);
      }

    }
  }
  if(current == classes)
  {
    switch(row)
    {
    case 0: //Assault
        {
      GivePlayerWeapon(playerid, 23, 50);
      GivePlayerWeapon(playerid, 31, 250);
      GivePlayerWeapon(playerid, 16, 1);
      GivePlayerWeapon(playerid, 4, 1);
      TogglePlayerControllable(playerid, true);
            }

     case 1: //Smg
        {
      GivePlayerWeapon(playerid, 29, 250);
      GivePlayerWeapon(playerid, 23, 50);
      GivePlayerWeapon(playerid, 16, 5);
      GivePlayerWeapon(playerid, 4, 1);
      TogglePlayerControllable(playerid, true);
            }
         case 2: //Demolition
        {
      GivePlayerWeapon(playerid, 25, 150);
      GivePlayerWeapon(playerid, 23, 50);
      GivePlayerWeapon(playerid, 16, 1);
      GivePlayerWeapon(playerid, 4, 1);
      GivePlayerWeapon(playerid, 35, 5);
      TogglePlayerControllable(playerid, true);
      }

    }
  }
  return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/desertdm", true) == 0)
    {
      ShowMenuForPlayer(desertdm, playerid);
      TogglePlayerControllable(playerid, false);
      return 1;
    }
    if(strcmp(cmdtext, "/classes", true) == 0)
    {
      ShowMenuForPlayer(classes, playerid);
      TogglePlayerControllable(playerid, false);
      return 1;
    }
    return 0;
}
#endif
Reply
#3

nvm got it thx for da help
Reply
#4

tx log back in xfire, why did u disappear!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)