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

[INS] Guns Menu - modifacation


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
puma133
Member
Join Date: Jun 2009
Old 02-12-2018 , 02:57   [INS] Guns Menu - modifacation
Reply With Quote #1

Hello guys!
I have this plugin for Insurgency, and i want to make different weapon modifications, for example: suppressor to M249 or armor-piercing bullets, or optic. Please show the sample code, help me pls

Code:
#pragma semicolon 1
#include <sourcemod>

#define PLUGIN_VERSION "1.0"

new MARINES = 1;
new INSURGENTS = 2;

public OnPluginStart()
{
    RegConsoleCmd("sm_guns", WeaponMenu);
    RegConsoleCmd("guns", 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);
}

Last edited by puma133; 02-12-2018 at 03:01.
puma133 is offline
 



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 23:18.


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