How to add GivePlayerWeapon to menus
#5

Quote:
Originally Posted by troy52192
This goes at the top:
pawn Код:
new Menu:XWeapons, Menu:XWeaponsBig, Menu:XWeaponsSmall, Menu:XWeaponsMore;
This goes in OnFilterScriptInit or OnGameModeInit:
pawn Код:
XWeapons = CreateMenu("~b~Weapons ~g~Main Menu",2, 55.0, 200.0, 100.0, 80.0);
    SetMenuColumnHeader(XWeapons, 0, "Choose a weapon");
    AddMenuItem(XWeapons,0,"Desert Eagle");//0
    AddMenuItem(XWeapons,0,"M4");
    AddMenuItem(XWeapons,0,"Sawnoff Shotgun");
    AddMenuItem(XWeapons,0,"Combat Shotgun");
    AddMenuItem(XWeapons,0,"UZI");
    AddMenuItem(XWeapons,0,"Rocket Launcher");
    AddMenuItem(XWeapons,0,"Minigun");//6
    AddMenuItem(XWeapons,0,"Sniper Rifle");
    AddMenuItem(XWeapons,0,"Big Weapons");
    AddMenuItem(XWeapons,0,"Small Weapons");//9
    AddMenuItem(XWeapons,0,"More");
    AddMenuItem(XWeapons,0,"Return");//11

    XWeaponsBig = CreateMenu("~b~Weapons ~g~Big Weapons",2, 55.0, 200.0, 100.0, 80.0);
    SetMenuColumnHeader(XWeaponsBig, 0, "Choose a weapon");
    AddMenuItem(XWeaponsBig,0,"Shotgun");
    AddMenuItem(XWeaponsBig,0,"AK-47");
    AddMenuItem(XWeaponsBig,0,"Country Rifle");
    AddMenuItem(XWeaponsBig,0,"HS Rocket Launcher");
    AddMenuItem(XWeaponsBig,0,"Flamethrower");
    AddMenuItem(XWeaponsBig,0,"SMG");
    AddMenuItem(XWeaponsBig,0,"TEC9");
    AddMenuItem(XWeaponsBig,0,"Return");

    XWeaponsSmall = CreateMenu("~b~Weapons ~g~Small Weapons",2, 55.0, 200.0, 100.0, 80.0);
    SetMenuColumnHeader(XWeaponsBig, 0, "Choose a weapon");
    AddMenuItem(XWeaponsSmall,0,"9mm");
    AddMenuItem(XWeaponsSmall,0,"Silenced 9mm");
    AddMenuItem(XWeaponsSmall,0,"Molotov Cocktail");
    AddMenuItem(XWeaponsSmall,0,"Fire Extinguisher");
    AddMenuItem(XWeaponsSmall,0,"Spraycan");
    AddMenuItem(XWeaponsSmall,0,"Frag Grenades");
    AddMenuItem(XWeaponsSmall,0,"Katana");
    AddMenuItem(XWeaponsSmall,0,"Chainsaw");
    AddMenuItem(XWeaponsSmall,0,"Return");

    XWeaponsMore = CreateMenu("~b~Weapons ~g~More Weapons",2, 55.0, 200.0, 100.0, 80.0);
    SetMenuColumnHeader(XWeaponsBig, 0, "Choose a weapon");
    AddMenuItem(XWeaponsMore,0,"Jetpack");
    AddMenuItem(XWeaponsMore,0,"Knife");
    AddMenuItem(XWeaponsMore,0,"Flowers");
    AddMenuItem(XWeaponsMore,0,"Camera");
    AddMenuItem(XWeaponsMore,0,"Pool Cue");
    AddMenuItem(XWeaponsMore,0,"Baseball Bat");
    AddMenuItem(XWeaponsMore,0,"Golf Club");
    AddMenuItem(XWeaponsMore,0,"MAX AMMO");
    AddMenuItem(XWeaponsMore,0,"Return");
This goes in OnPlayerSelectedMenuRow:
pawn Код:
new Menu:Current = GetPlayerMenu(playerid);
    if(Current==XWeapons)
    {
        switch(row)
        {
            case 0: { GivePlayerWeapon(playerid,24,500); }
            case 1: { GivePlayerWeapon(playerid,31,500); }
            case 2: { GivePlayerWeapon(playerid,26,500); }
            case 3: { GivePlayerWeapon(playerid,27,500); }
            case 4: { GivePlayerWeapon(playerid,28,500); }
            case 5: { GivePlayerWeapon(playerid,35,500); }
            case 6: { GivePlayerWeapon(playerid,38,1000); }
            case 7: { GivePlayerWeapon(playerid,34,500); }
            case 8: return ChangeMenu(playerid,Current,XWeaponsBig);
            case 9: return ChangeMenu(playerid,Current,XWeaponsSmall);
            case 10: return ChangeMenu(playerid,Current,XWeaponsMore);
            case 11: return ChangeMenu(playerid,Current,LMainMenu);
        }
        return TogglePlayerControllable(playerid,true);
    }

    if(Current==XWeaponsBig)
    {
        switch(row)
        {
            case 0: { GivePlayerWeapon(playerid,25,500); }
            case 1: { GivePlayerWeapon(playerid,30,500); }
            case 2: { GivePlayerWeapon(playerid,33,500); }
            case 3: { GivePlayerWeapon(playerid,36,500); }
            case 4: { GivePlayerWeapon(playerid,37,500); }
            case 5: { GivePlayerWeapon(playerid,29,500); }
            case 6: { GivePlayerWeapon(playerid,32,1000); }
            case 7: return ChangeMenu(playerid,Current,XWeapons);
        }
        return TogglePlayerControllable(playerid,true);
    }

    if(Current==XWeaponsSmall)
    {
        switch(row)
        {
            case 0: { GivePlayerWeapon(playerid,22,500); }//9mm
            case 1: { GivePlayerWeapon(playerid,23,500); }//s9
            case 2: { GivePlayerWeapon(playerid,18,500); }// MC
            case 3: { GivePlayerWeapon(playerid,42,500); }//FE
            case 4: { GivePlayerWeapon(playerid,41,500); }//spraycan
            case 5: { GivePlayerWeapon(playerid,16,500); }//grenade
            case 6: { GivePlayerWeapon(playerid,8,500); }//Katana
            case 7: { GivePlayerWeapon(playerid,9,1000); }//chainsaw
            case 8: return ChangeMenu(playerid,Current,XWeapons);
        }
        return TogglePlayerControllable(playerid,true);
    }

    if(Current==XWeaponsMore)
    {
        switch(row)
        {
            case 0: SetPlayerSpecialAction(playerid, 2);
            case 1: GivePlayerWeapon(playerid,4,500);
            case 2: GivePlayerWeapon(playerid,14,500);
            case 3: GivePlayerWeapon(playerid,43,500);
            case 4: GivePlayerWeapon(playerid,7,500);
            case 5: GivePlayerWeapon(playerid,5,500);
            case 6: GivePlayerWeapon(playerid,2,1000);
            case 7: MaxAmmo(playerid);
            case 8: return ChangeMenu(playerid,Current,XWeapons);
        }
        return TogglePlayerControllable(playerid,true);
    }
This goes in OnPlayerCommandText:
pawn Код:
if (strcmp(cmdtext, "/weapons", true) == 0)
    {
        ShowMenuForPlayer(XWeapons,playerid);
        return 1;
    }
Reply


Messages In This Thread
How to add GivePlayerWeapon to menus - by killdahobo99 - 08.07.2009, 01:51
Re: How to add GivePlayerWeapon to menus - by troy52192 - 08.07.2009, 06:06
Re: How to add GivePlayerWeapon to menus - by killdahobo99 - 08.07.2009, 15:12
Re: How to add GivePlayerWeapon to menus - by killdahobo99 - 08.07.2009, 16:24
Re: How to add GivePlayerWeapon to menus - by Marcel - 08.07.2009, 17:07

Forum Jump:


Users browsing this thread: 2 Guest(s)