AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   add CT (https://forums.alliedmods.net/showthread.php?t=324433)

jonny1990 05-16-2020 05:43

add CT
 
Hello! help add even and CT here, that would him, too, a grenade was issued if he remained one

Code:

#include <amxmodx>
#include <cstrike>
#include <fun>

#define PLUGIN        "New Nades"
#define VERSION        "0.1"
#define AUTHOR        "GloOm"

#define MENU_KEYS ( 1<<0 | 1<<1 )

new g_pNewNades;
new g_pFlashbangs;
new g_pSmokeGrenade;
new g_pHeGrenade;

new g_szNadeMenu[ 64 ];


public plugin_init()
{
          register_plugin( PLUGIN, VERSION, AUTHOR );
        g_pNewNades = register_cvar( "hns_newnades", "1" );
        g_pFlashbangs = register_cvar( "hns_flashbangs", "2" );
        g_pHeGrenade = register_cvar( "hns_hegrenade", "0" );
        g_pSmokeGrenade = register_cvar( "hns_smokegrenade", "1" );
       
        register_event( "DeathMsg", "eventDeathMsg", "a" );
}

public plugin_cfg()
{
        new iLen = charsmax( g_szNadeMenu );
       
        add( g_szNadeMenu, iLen, "\yНужна граната?^n^n" );
        add( g_szNadeMenu, iLen, "\r1. \wДа^n" );
        add( g_szNadeMenu, iLen, "\r2. \wНет" );
               
        register_menucmd( register_menuid( "NadesMenu" ), MENU_KEYS, "HandleNadeMenu" );
}

public eventDeathMsg()
{       
        if( g_pNewNades )
        {
                new iPlayers[ 32 ], iNum;
                get_players( iPlayers, iNum, "ae", "TERRORIST" );
                       
                if( iNum == 1 )
                {
                        show_menu( iPlayers[ 0 ], MENU_KEYS, g_szNadeMenu, 7, "NadesMenu" );
                }
        }
}

public HandleNadeMenu( id, iKey )
{
        if( !iKey )
        {
                GiveGrenades( id );
        }
}

GiveGrenades( const id )
{
        if( get_pcvar_num( g_pFlashbangs ) )
        {
                give_item( id, "weapon_flashbang" );
                cs_set_user_bpammo( id, CSW_FLASHBANG, get_pcvar_num( g_pFlashbangs ) );
        }
                               
        new iCvar = get_pcvar_num( g_pSmokeGrenade );
                       
        if( iCvar == 1 || iCvar == 3 )
        {
                give_item( id, "weapon_smokegrenade" );
        }
                       
        iCvar = get_pcvar_num( g_pHeGrenade );
                       
        if( iCvar == 1 || iCvar == 3 )
        {
                give_item( id, "weapon_hegrenade" );
        }
}



All times are GMT -4. The time now is 17:09.

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