Raised This Month: $51 Target: $400
 12% 

[INS] Guns2 menu not appearing


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Forest.74
New Member
Join Date: Aug 2016
Old 08-28-2016 , 17:16   [INS] Guns2 menu not appearing
Reply With Quote #1

I'm working on updating the !guns2 command for my server, I have it working well except for the menu set for the insurgents somehow goes to spectators, or to look at it another way, insurgents do not get a menu to choose from. I'm new to this modding coding and would love a bit of guidance. Not sure how to post code here either. Thanks all.
Forest.74 is offline
Michael Shoe Maker
Senior Member
Join Date: Apr 2016
Old 08-28-2016 , 22:44   Re: [INS] Guns2 menu not appearing
Reply With Quote #2

Use the tags [ php][/php]

Last edited by Michael Shoe Maker; 08-28-2016 at 22:45.
Michael Shoe Maker is offline
shavit
AlliedModders Donor
Join Date: Dec 2011
Location: Israel
Old 08-29-2016 , 02:51   Re: [INS] Guns2 menu not appearing
Reply With Quote #3

Quote:
Originally Posted by Michael Shoe Maker View Post
Use the tags [ php][/php]
[code]/* code */[*/code] (ignore the *)

[php] shows the wrong syntax highlighting
__________________
retired

Last edited by shavit; 08-29-2016 at 02:51.
shavit is offline
Forest.74
New Member
Join Date: Aug 2016
Old 08-29-2016 , 17:42   Re: [INS] Guns2 menu not appearing
Reply With Quote #4

Thank you, got volunteered to do this, trying my best.

Code:
pragma semicolon 1

#define PLUGIN_VERSION "1.0"

new MARINES = 1;
new INSURGENTS = 2;

public OnPluginStart()
{
    RegConsoleCmd("sm_guns2", WeaponMenu);
    RegConsoleCmd("guns2", WeaponMenu);

    CreateConVar("ins_guns2_version", PLUGIN_VERSION, "INS Gun Menu Version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
    OnMapStart();
}

public OnMapStart()
{
    decl String:mapname[64];
    GetCurrentMap(mapname, sizeof(mapname));
    if (strcmp(mapname, "ins_karam") == 0 || strcmp(mapname, "ins_baghdad") == 0)
    {
        INSURGENTS = 1;
        MARINES = 2;
    }
    else
    {
        MARINES = 1;
        INSURGENTS = 2;
    }
}

public Action:WeaponMenu(client,args)
{
    Weapons(client);
    
    return Plugin_Handled;
}

public Action:Weapons(clientId) {

    new team = GetClientTeam(clientId);
    if (team == INSURGENTS)
    {
        new Handle:menu = CreateMenu(WeaponMenuHandlerINS);
        SetMenuTitle(menu, "Marines Gun Menu");
        AddMenuItem(menu, "option1", "M4A1");
        AddMenuItem(menu, "option2", "M16A4");
        AddMenuItem(menu, "option3", "M40A1");
        AddMenuItem(menu, "option4", "M249");
        AddMenuItem(menu, "option5", "M590");
        AddMenuItem(menu, "option6", "MK18");
        AddMenuItem(menu, "option7", "MP5K");
        SetMenuExitButton(menu, true);
        DisplayMenu(menu, clientId, 15);
    }
    else if (team == MARINES)
    {
        new Handle:menu = CreateMenu(WeaponMenuHandlerUS);
        SetMenuTitle(menu, "Insurgents Gun Menu");
        AddMenuItem(menu, "option1", "AKM");
        AddMenuItem(menu, "option2", "FAL");
        AddMenuItem(menu, "option2", "AKS-74U");
        AddMenuItem(menu, "option3", "RPK");
        AddMenuItem(menu, "option4", "TOZ");
        AddMenuItem(menu, "option5", "AK-74");
        AddMenuItem(menu, "option7", "Mosin");
        SetMenuExitButton(menu, true);
        DisplayMenu(menu, clientId, 15);
    }
        return Plugin_Handled;
}

public WeaponMenuHandlerUS(Handle:menu, MenuAction:action, client, itemNum)
{
        SetConVarBool(FindConVar("sv_cheats"), true, false);

        if ( action == MenuAction_Select ) {
        
        switch (itemNum)
        {
            case 0: 
            {
                 FakeClientCommand(client, "give_weapon m4a1");
            }
            case 1: 
            {
                FakeClientCommand(client, "give_weapon m16a4");
            }
         case 2: 
            {
                FakeClientCommand(client, "give_weapon m40a1");
            }
         case 3: 
            {
                FakeClientCommand(client, "give_weapon m249");
            }
         case 4:
            {
                FakeClientCommand(client, "give_weapon m590");
            }
         case 5:
            {
                FakeClientCommand(client, "give_weapon mk18");
            }
         case 6:
            {
                FakeClientCommand(client, "give_weapon mp5k");
            }
        }
    }
        SetConVarBool(FindConVar("sv_cheats"), false, false);
}

public WeaponMenuHandlerINS(Handle:menu, MenuAction:action, client, itemNum)
{
        SetConVarBool(FindConVar("sv_cheats"), true, false);

        if ( action == MenuAction_Select ) {
        
        switch (itemNum)
        {
            case 0: 
            {
                FakeClientCommand(client, "give_weapon akm");
            }
         case 1: 
            {
                FakeClientCommand(client, "give_weapon fal");
            }
         case 2: 
            {
                FakeClientCommand(client, "give_weapon aks74u");
            }
         case 3:
            {
                FakeClientCommand(client, "give_weapon rpk");
            }
         case 4:
            {
                FakeClientCommand(client, "give_weapon toz");
            }
         case 5:
            {
                FakeClientCommand(client, "give_weapon ak74");
            }
         case 6:
            {
                FakeClientCommand(client, "give_weapon mosin");
            }
        }
    }
        SetConVarBool(FindConVar("sv_cheats"), false, false);
}
Forest.74 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:10.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode