Jump to content

[LEAGUECS] Plugin VIP CSGO REMAKE


Shadows Adi

Recommended Posts

  • Scripters

VIP CSGO REMAKE - LEAGUECS.RO

(Versiune curenta 1.3 | Autor Shadows Adi)

  • Descriere: Acest plugin este dedicat pentru serverele de CSGO REMAKE ; ofera jucatorile diferite avantaje + meniu arme personalizat.

 

 

  • Comenzi: 
    /vmenu - deschide meniul V.I.P
    /vips - arata V.I.P.-urile ONLINE (hud)
    /arme - arata un meniu cu arme pentru V.I.P.

 

 

  • Cvar-uri:
	vip_bulletdamage "1"  // BulletDamage - afiseaza dmg-ul facut unui jucator
	vip_hud "1" // Arata Vip-urile online in HUD prin scrierea in chat a comenzii /vips
	vip_hp_kill "10" // Hp primit pe un kill  
	vip_hp_hs "25" // Hp primit pe un hs
	vip_hp_max "100" // Valoarea maxima a hp-ului pe care o poate avea Vip-ul
	vip_money_damage "3" // Banii primiti pe 1 damage
	vip_money_kill "500" // Banii primiti pe un kill
	vip_money_hs "1000" // Banii primiti pe un hs
	vip_gun_menu "1" // Guns Menu - afiseaza meniul cu arme // Pe hartile de tip AWP, acest meniu va fi automat dezactivat
	vip_items_round "abdef" // Items per round - primiti diverse obiecte la inceputul fiecarei runde ( a - He Grenade; b - Flashbang (x2); c - Smoke Grenade; d - Deagle; e - Vest + Helm;  f - Defuse Kit (Doar CT); g - NightVision
	vip_jumps "1" // Jumps - Salturi // 1 - Activat   0 - Dezactivat
	vip_maxjumps "1" // Cate sarituri in plus poate sa faca deodata

 

  • Module necesare: 
	cstrike
	fun
	hamsandwich
	engine
	fakemeta
	csx

 

 

  • Instalare:
  • Copiem fisierul csgo_vip_leaguecs.amxx in addons\amxmodx\plugins
  • Copiem fisierul csgo_vip_leaguecs.sma in addons\amxmodx\scripting
  • Deschidem addons\amxmodx\configs\plugins.ini si adaugam la urma :
csgo_vip_leaguecs.amxx

 

  • Informatii suplimentare:

Vip-ul se dezactiveaza pe mapele de awp. 

 VIP-ul se adauga in fisierul configs/VIP/Lista_VIP.ini (numele de pe server)

 Pentru orice modificare dorita / nelamurire postati aici / PM

 

  • Sursa:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#include <engine>

static const PLUGIN[]	= "Vip CSGO Remake - Leaguecs.ro"
static const VERSION[]	= "1.3"
static const AUTHOR[]	= "Shadows Adi"

#define ITEM_HE (1<<0) 
#define ITEM_FS (1<<1) 
#define ITEM_SG (1<<2) 
#define ITEM_DG (1<<3) 
#define ITEM_VH (1<<4) 
#define ITEM_DF (1<<5) 
#define ITEM_NV (1<<6) 

#define VIP_LEVEL_ACCES ADMIN_LEVEL_H

#define SCOREATTRIB_NONE    0
#define SCOREATTRIB_DEAD    ( 1 << 0 )
#define SCOREATTRIB_BOMB    ( 1 << 1 )
#define SCOREATTRIB_VIP     ( 1 << 2 )

new const Float: g_flCoords[][] = 
{
	{ 0.50, 0.40 },
	{ 0.56, 0.44 },
	{ 0.60, 0.50 },
	{ 0.56, 0.56 },
	{ 0.50, 0.60 },
	{ 0.44, 0.56 },
	{ 0.40, 0.50 },
	{ 0.44, 0.44 }
};

new g_iPosition[33]
new jumpnum[33] = 0
new bool:dojump[33] = false
new hk_File4[ 128 ];
new hk_VipsList[ 128 ][ 32 ], hk_TotalLines;
new hk_IsUserVip[ 33 ];
new hk_viplist[ ] = "VIP_List.ini";
new hk_Folder[ ] = "CSGO_VIP";
new hk_cfg[ ] = "Setari_vip";
new hk_File[ 128 ];
new hk_File1[ 128 ];
new g_type, g_hudmsg
new vip_hud
new maxplayers
new mpd, mkb, mhb
new health_add
new health_hs_add
new health_max
new hk_Killer
new hk_KillerHp
new hk_HpAdd
new hk_HpMax
new cvar_vip_bulletdmg
new jumps, items
new hk_iRoundCount
new bool:hk_IsRestarting
new gun_menu
new g_iSize


enum
{
    Primary = 1
    , Secondary
    , Knife
    , Grenades
    , C4
};

const PRIMARY_WEAPONS_BIT_SUM = (1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_AUG)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90);
const SECONDARY_WEAPONS_BIT_SUM = (1<<CSW_P228)|(1<<CSW_ELITE)|(1<<CSW_FIVESEVEN)|(1<<CSW_USP)|(1<<CSW_GLOCK18)|(1<<CSW_DEAGLE);

public plugin_init() 
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_cvar("VipCsgoLeague", VERSION, FCVAR_SERVER | FCVAR_SPONLY);
	
    register_concmd("say /vips", "showAdmin", ADMIN_ALL, "")
    register_concmd("amx_addvips", "addvips", ADMIN_RCON, "<Nume sau SteamID>")
    register_concmd("amx_vips", "vips", ADMIN_RCON, "Vip list")
    register_clcmd("say /vmenu", "vmenu");
    register_clcmd("say /arme", "vmenu2");
    RegisterHam ( Ham_Spawn, "player", "Hook_PlayerSpawn", 1 )
    register_event("Damage", "Damage", "b", "2!0", "3=0", "4!0")
    register_event("DeathMsg", "hook_death", "a", "1>0")
    register_event("DeathMsg","death_msg","a")
    register_event("TextMsg", "Event_TextMsg_Restart", "a", "2&#Game_C", "2&#Game_w")
    register_event("HLTV", "Event_HLTV_New_Round", "a", "1=0", "2=0")
    register_message(get_user_msgid( "ScoreAttrib" ), "MessageScoreAttrib");
    
    register_cvar("vip_maxjumps","1")
    cvar_vip_bulletdmg = register_cvar("vip_bulletdmg", "1");
    jumps = register_cvar("vip_jumps","1")
    vip_hud = register_cvar("vip_hud","1")
    g_type = register_cvar("vip_bulletdamage","1")
    health_add = register_cvar("vip_hp_kill", "10")
    health_hs_add = register_cvar("vip_hp_hs", "25")
    health_max = register_cvar("vip_hp_max", "100")
    mpd = register_cvar("vip_money_damage","3")
    mkb = register_cvar("vip_money_kill","500")
    mhb = register_cvar("vip_money_hs","1000")
    items = register_cvar("vip_items_round", "abcdefg")
    gun_menu = register_cvar("vip_gun_menu","1")
    g_hudmsg = CreateHudSyncObj()
    g_iSize = sizeof(g_flCoords);
    maxplayers = get_maxplayers()
    
    
}

public plugin_cfg()
{    
    
    
    new Dir[ 64 ];
    get_configsdir(Dir,charsmax(Dir));
    formatex ( hk_File, charsmax ( hk_File ), "%s/%s", Dir, hk_Folder );
    formatex ( hk_File1, charsmax ( hk_File1 ), "%s/%s.cfg", hk_File, hk_cfg );
    if(!dir_exists(hk_File))
    mkdir(hk_File);

    formatex ( hk_File4, charsmax ( hk_File4 ), "%s/%s", hk_File, hk_viplist );
    
    if (!file_exists(hk_File4))
    write_file(hk_File4,"; -->VIP List<--");
    
    new hk_Buffer[ 192 ], hk_Line, hk_Len;
    while ( ( hk_Line = read_file ( hk_File4, hk_Line, hk_Buffer, charsmax ( hk_Buffer ), hk_Len ) ) )
    {
        if ( ! strlen ( hk_Buffer ) || hk_Buffer[ 0 ] == ';' || ( hk_Buffer[ 0 ] == '/' && hk_Buffer[ 1 ] == '/' ) )
            continue;
            
        copy ( hk_VipsList[ hk_TotalLines++ ], 32, hk_Buffer );

    }    
    
    if(!file_exists(hk_File1))
    {
    write_file(hk_File1,"// Vip Configuration File")
    write_file(hk_File1,"")
    write_file(hk_File1,"")
    write_file(hk_File1,"// Vips Online")
    write_file(hk_File1,"// Show VIPs online in hud through /vips chat command")
    write_file(hk_File1,"// 1 - Enabled   0 - Disabled")
    write_file(hk_File1,"vip_hud ^"1^"")
    write_file(hk_File1,"")
    write_file(hk_File1,"// HP per kill  ")
    write_file(hk_File1,"vip_hp_kill ^"10^"")
    write_file(hk_File1,"")
    write_file(hk_File1,"// HP per HS")
    write_file(hk_File1,"vip_hp_hs ^"25^"")
    write_file(hk_File1,"")
    write_file(hk_File1,"// Maxmimum HP that a VIP can have")
    write_file(hk_File1,"vip_hp_max ^"100^"")
    write_file(hk_File1,"")
    write_file(hk_File1,"// VIP bullet Damage // 1 = Enabled; 0 = Disabled")
    write_file(hk_File1,"vip_bulletdamage ^"1^"")
    write_file(hk_File1,"")
    write_file(hk_File1,"// Money per damage")
    write_file(hk_File1,"vip_money_damage ^"3^"")
    write_file(hk_File1,"")
    write_file(hk_File1,"// Money per kill")
    write_file(hk_File1,"vip_money_kill ^"500^"")
    write_file(hk_File1,"")
    write_file(hk_File1,"// Money per HS")
    write_file(hk_File1,"vip_money_hs ^"1000^"")
    write_file(hk_File1,"")
    write_file(hk_File1,"// Guns Menu ")
    write_file(hk_File1,"// On Awp maps this will be disabled")
    write_file(hk_File1,"// 1 - Enabled   0 - Disabled")
    write_file(hk_File1,"vip_gun_menu ^"1^"")
    write_file(hk_File1,"")
    write_file(hk_File1,"// Items per round ")
    write_file(hk_File1,"// a - He Grenade")
    write_file(hk_File1,"// b - Flashbang (x2)")
    write_file(hk_File1,"// c - Smoke Grenade ")
    write_file(hk_File1,"// d - Deagle")
    write_file(hk_File1,"// e - Vest + Helm")
    write_file(hk_File1,"// f - Defuse Kit (Doar CT)")
    write_file(hk_File1,"// g - NightVision")
    write_file(hk_File1,"vip_items_round ^"abcdef^"")
    write_file(hk_File1,"")
    write_file(hk_File1,"// Jumps ")
    write_file(hk_File1,"// 1 - Enabled   0 - Disabled")
    write_file(hk_File1,"vip_jumps ^"1^"")
    write_file(hk_File1,"")
    write_file(hk_File1,"// How much extra jumps does vip have")
    write_file(hk_File1,"vip_maxjumps ^"1^"")
    write_file(hk_File1,"")
    
    }
    
    server_cmd("exec %s",hk_File1)
}

public client_putinserver(id)
{
    
    hk_IsUserVip[ id ] = 0;
    jumpnum[id] = 0
    dojump[id] = false
}

public client_disconnect(id)
{
    
    hk_IsUserVip[ id ] = 0;
    jumpnum[id] = 0
    dojump[id] = false
}
public addvips(id, level, cid)
{
    if (!cmd_access(id, level, cid, 2))
        return PLUGIN_HANDLED

    new arg[32]    
    
    read_argv(1, arg, 31)
    
    new szLog[256];
    formatex(szLog,255,"%s",arg);
    write_file(hk_File4,szLog,-1);
    console_print(id, "[CSGO] VIP-ul a fost adaugat in lista")
    
    return PLUGIN_HANDLED
    
}

public vmenu(id)
{
    if(is_user_alive(id) || get_user_flags(id) & VIP_LEVEL_ACCES)
    {
        GameMenu(id);
    }
    else
    {
        ColorChat( id,  "^4[CSGO REMAKE] ^1Acest meniu este doar pentru ^4VIP ^1!");
    }
    return 0;
}

public vmenu2(id)
{
    if(is_user_alive(id) || get_user_flags(id) & VIP_LEVEL_ACCES)
    {
        Showrod( id );
    }
    else
    {
        ColorChat(id, "^4[CSGO.KRIPT.RO] ^1Acest meniu este doar pentru ^4VIP ^3!");
    }
    return 0;
}

public GameMenu(id)
{
    new Menu = menu_create("\r[CSGO REMAKE]  \yMeniu \rVIP", "GameMenuCmd");
    menu_additem(Menu, "\rArme", "", 0);
    menu_additem(Menu, "\yCumpara \rZeus x27-\w2500$", "", 0);
    menu_additem(Menu, "\yCumpara \rMolotov-\w1200$", "", 0);
    menu_additem(Menu, "\yV.I.P \rModels", "", 0);
    menu_setprop(Menu, 6, 1);
    menu_display(id, Menu, 0);
    return 1;
}

public GameMenuCmd(id, menu, item)
{
    switch (item)
    {
        case 0:
        {
            client_cmd(id, "say /arme");
        }
        case 1:
        {
            client_cmd(id, "say /zeus");
        }
        case 2:
        {
            client_cmd(id, "say /molotov");
        }
        case 3:
        {
            client_cmd(id, "say /models");
        }
    }
    
    if (item == MENU_EXIT)
    {
    menu_destroy( menu );
    return PLUGIN_CONTINUE;
    }
    return 1
}

public vips(id, level, cid)
{
    if (!cmd_access(id, level, cid, 1))
        return PLUGIN_HANDLED
    
    new s_Name[ 32 ], s_AuthID[ 32 ];
    get_user_name ( id, s_Name, 31 );
    get_user_authid ( id, s_AuthID, 31 );
    
    console_print(id, "========= .::CSGO REMAKE::. ==========")
    for ( new i; i < hk_TotalLines; i++ )
    {
        if (  strcmp ( s_Name, hk_VipsList[ i ] ) || strcmp ( s_AuthID, hk_VipsList[ i ] ) )
        console_print(id, " - %s", hk_VipsList[ i ])    
            
        
    }
    console_print(id, "========== .::CSGO REMAKE::. ============")
    return PLUGIN_HANDLED
}


public Event_TextMsg_Restart()
{
    hk_IsRestarting = true
}
 
public Event_HLTV_New_Round()
{
    if( hk_IsRestarting )
    {
        hk_IsRestarting = false
        hk_iRoundCount = 0
    }
}

public Hook_PlayerSpawn ( const id )
{
    if ( ! is_user_alive ( id ) )
        return HAM_IGNORED;
    if ( ! is_user_vip ( id ) )
    {
        hk_IsUserVip[ id ] = 0;
        return HAM_IGNORED;
    }
    
    hk_IsUserVip[ id ] = 1;
    hk_iRoundCount++
    new map[32];
    get_mapname(map,31);
    
    if(equali(map, "awp_", 3))
    return HAM_IGNORED;
    
    if (get_pcvar_num(gun_menu) == 1)
    if(hk_iRoundCount>=4)
    Showrod(id);
    
    return HAM_IGNORED;
}

public on_damage(id)
{
    if(get_pcvar_num(g_type))
    {
        static attacker; attacker = get_user_attacker(id)
        static damage; damage = read_data(2)    

        if ( is_user_vip ( attacker ) )
        {
            hk_IsUserVip[ id ] = 1;
        
            if(is_user_connected(attacker))
            {
                if(fm_is_ent_visible(attacker,id))
                {
                    set_hudmessage(0, 100, 200, -1.0, 0.55, 2, 0.1, 4.0, 0.02, 0.02, -1)
                    ShowSyncHudMsg(attacker, g_hudmsg, "%i^n", damage)                
                }
                    
                
            }
        }else hk_IsUserVip[ id ] = 0;
    }
}

public Damage(id)
{
    new weapon, hitpoint, attacker = get_user_attacker(id,weapon,hitpoint)
    if(attacker<=maxplayers && is_user_alive(attacker) && attacker!=id)
    
    if ( is_user_vip ( id ) )
    {
        hk_IsUserVip[ id ] = 1;
        new money = read_data(2) * get_pcvar_num(mpd)
        if(hitpoint==1) money += get_pcvar_num(mhb)
        cs_set_user_money(attacker,cs_get_user_money(attacker) + money)
    }else hk_IsUserVip[ id ] = 0;
}

public death_msg()
{
    if(read_data(1)<=maxplayers && read_data(1) && read_data(1)!=read_data(2)) 
    cs_set_user_money(read_data(1),cs_get_user_money(read_data(1)) + get_pcvar_num(mkb) - 300)
}

public MessageScoreAttrib(iMsgID, iDest, iReceiver)
{
    new iPlayer = get_msg_arg_int(1);
    if(is_user_connected(iPlayer) && (get_user_flags(iPlayer) & VIP_LEVEL_ACCES))
	{
        set_msg_arg_int(2, ARG_BYTE, is_user_alive(iPlayer) ? SCOREATTRIB_VIP : SCOREATTRIB_DEAD);
    }
}

public hook_death()
{
    hk_Killer = read_data(1)
   
    if ( (read_data(3) == 1) && (read_data(5) == 0) )
    {
        hk_HpAdd = get_pcvar_num (health_hs_add)
    }
    else
    hk_HpAdd = get_pcvar_num (health_add)
    
    hk_HpMax = get_pcvar_num (health_max)
   
   
    if ( ! is_user_vip ( hk_Killer ) )
    {
        hk_IsUserVip[ hk_Killer ] = 0;
        return;
    }
    hk_IsUserVip[ hk_Killer ] = 1;
    
    hk_KillerHp = get_user_health(hk_Killer)
    hk_KillerHp += hk_HpAdd
   
    if (hk_KillerHp > hk_HpMax) hk_KillerHp = hk_HpMax
    set_user_health(hk_Killer, hk_KillerHp)

}

public vip_damage(id)
{
    static iAttacker; iAttacker = get_user_attacker(id)
    static iDamage; iDamage = read_data(2)

    if(!(get_user_flags(iAttacker) & VIP_LEVEL_ACCES))
        return PLUGIN_HANDLED;
        
    if(get_pcvar_num(cvar_vip_bulletdmg) == 1)
    {
        if(++g_iPosition[iAttacker] == g_iSize)
            g_iPosition[iAttacker] = 0;
    
        set_dhudmessage(random_num(0, 255), random_num(0, 255), random_num(0, 255), Float: g_flCoords[g_iPosition[iAttacker]][0], Float: g_flCoords[g_iPosition[iAttacker]][1], 0, 0.1, 2.5, 0.02, 0.02);
        show_dhudmessage(iAttacker, "%i", iDamage);
    }
    
    return PLUGIN_HANDLED;
} 

public showAdmin(id)
{
    if(get_pcvar_num(vip_hud) == 1)
    {
            
        
        new num, iLen, admin
        static pl[32], name[32], szBuff[2048]
    
        get_players(pl, num, "c")
    
        for(new i = 0; i < num; i++)
        {
            if (  is_user_vip ( pl[i] ) )
            {
            hk_IsUserVip[ pl[i] ] = 1;
            get_user_name(pl[i], name, 31)
            iLen += format(szBuff[iLen], 2048 - iLen, "%d. %s^n", admin + 1, name)
            admin++
            }
            
        }

    
        set_hudmessage(0, 255, 0, 0.02, 0.2, 0, 6.0, 7.0 )
        show_hudmessage(id, " %s online:^n%s", admin > 1 ? "Vips" : "Vips", szBuff)
    
        arrayset(szBuff, 0, 2048)
    }
    return PLUGIN_HANDLED
}

public client_PreThink(id)
{
        if(!is_user_alive(id)) return PLUGIN_CONTINUE
        if(get_pcvar_num(jumps) == 0) return PLUGIN_CONTINUE
    
        if ( ! is_user_vip ( id ) )
        {
            hk_IsUserVip[ id ] = 0;
            return PLUGIN_CONTINUE
        }
    
    
        hk_IsUserVip[ id ] = 1;
        new nbut = get_user_button(id)
        new obut = get_user_oldbutton(id)
        if((nbut & IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !(obut & IN_JUMP))
        {
            if(jumpnum[id] < get_cvar_num("vip_maxjumps"))
            {
                dojump[id] = true
                jumpnum[id]++
                return PLUGIN_CONTINUE
            }
        }
        if((nbut & IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND))
        {
            jumpnum[id] = 0
            return PLUGIN_CONTINUE
        }
    
        return PLUGIN_CONTINUE
}

public client_PostThink(id)
{
    if(!is_user_alive(id)) return PLUGIN_CONTINUE
    if(get_pcvar_num(jumps) == 0) return PLUGIN_CONTINUE
    
    if ( ! is_user_vip ( id ) )
    {
        hk_IsUserVip[ id ] = 0;
        return PLUGIN_CONTINUE
    }
    
    
    hk_IsUserVip[ id ] = 1;
    if(dojump[id] == true)
    {
        new Float:velocity[3]    
        entity_get_vector(id,EV_VEC_velocity,velocity)
        velocity[2] = random_float(265.0,285.0)
        entity_set_vector(id,EV_VEC_velocity,velocity)
        dojump[id] = false
        return PLUGIN_CONTINUE
    }
    
    return PLUGIN_CONTINUE
}

public Showrod( id ) 
{
    if(is_user_alive(id) || !(get_user_flags(id) & VIP_LEVEL_ACCES))
        return 1;
    new menu = menu_create( "\r[CSGO REMAKE] \yMeniu \yArme", "Pressedrod" );
    menu_additem(menu, "\yM4A1+Deagle+Grenazi", "", 0 );
    menu_additem(menu, "\yAK47+Deagle+Grenazi", "", 0 );
    menu_additem(menu, "\yAWP+Deagle+Grenazi", "", 0 );
    menu_display( id, menu, 0);
    return 1;
}

public Pressedrod(id, menu, item) 
{
    switch (item) 
    {
        case 0: 
        { 
            drop_weapons(id, 1)
            drop_weapons(id, 2)
            give_item(id, "weapon_knife");    
            give_item(id, "weapon_m4a1");
            give_item(id, "weapon_deagle");
            give_item(id, "weapon_hegrenade");
            give_item(id, "weapon_flashbang");
            set_user_armor(id, 100);
            cs_set_user_bpammo(id, CSW_HEGRENADE, 1);
            cs_set_user_bpammo(id, CSW_FLASHBANG, 2);
            cs_set_user_bpammo(id, CSW_M4A1, 90);
            cs_set_user_bpammo(id, CSW_DEAGLE, 35);
            ColorChat (id, "^4[CSGO] ^1Ai ales ^4M4A1^1+Deagle+^4Grenazi.");
            }

        case 1:
    {
            drop_weapons(id, 1)
            drop_weapons(id, 2)
            give_item(id, "weapon_knife");
            give_item(id, "weapon_ak47");
            give_item(id, "weapon_deagle");
            give_item(id, "weapon_hegrenade");
            give_item(id, "weapon_flashbang");
            set_user_armor(id, 100);
            cs_set_user_bpammo(id, CSW_HEGRENADE, 1);
            cs_set_user_bpammo(id, CSW_FLASHBANG, 2);
            cs_set_user_bpammo(id, CSW_FAMAS, 90);
            cs_set_user_bpammo(id, CSW_DEAGLE, 35);
            ColorChat(id, "^4[CSGO] ^1Ai ales ^4AK47^1+Deagle+^4Grenazi.");
    }
        case 2:
    {
            drop_weapons(id, 1)
            drop_weapons(id, 2)
            give_item(id, "weapon_knife");
            give_item(id, "weapon_awp");
            give_item(id, "weapon_deagle");
            give_item(id, "weapon_hegrenade");
            give_item(id, "weapon_flashbang");
            set_user_armor(id, 100);
            cs_set_user_bpammo(id, CSW_HEGRENADE, 1);
            cs_set_user_bpammo(id, CSW_FLASHBANG, 2);
            cs_set_user_bpammo(id, CSW_AWP, 30);
            cs_set_user_bpammo(id, CSW_DEAGLE, 35);
            ColorChat( id,"^4[CSGO] ^1Ai ales ^4AWP^1+Deagle+^4Grenazi.");
    }  
    }
    if (item == MENU_EXIT)
    {
    menu_destroy( menu );
    return PLUGIN_HANDLED;
    }
    return 1;
}

public get_item_flags() 
{ 
    new sFlags[24] 
    get_pcvar_string(items,sFlags,23) 
    return read_flags(sFlags) 
}

stock is_user_vip ( id )
{
    new s_Name[ 32 ], s_AuthID[ 32 ];
    get_user_name ( id, s_Name, 31 );
    get_user_authid ( id, s_AuthID, 31 );
    
    for ( new i; i < hk_TotalLines; i++ )
    {
        if ( ! strcmp ( s_Name, hk_VipsList[ i ] ) )
            return 1;
        if ( ! strcmp ( s_AuthID, hk_VipsList[ i ] ) )
            return 1;
    }
    
    return 0;

}

stock StripWeapons(id, Type, bool: bSwitchIfActive = true)
{
    new iReturn;
    
    if(is_user_alive(id))
    {
        new iEntity, iWeapon;
        while((iWeapon = GetWeaponFromSlot(id, Type, iEntity)) > 0)
            iReturn = ham_strip_user_weapon(id, iWeapon, Type, bSwitchIfActive);
    }
    
    return iReturn;
}

stock GetWeaponFromSlot( id , iSlot , &iEntity )
{
    if ( !( 1 <= iSlot <= 5 ) )
        return 0;
    
    iEntity = 0;
    const m_rgpPlayerItems_Slot0 = 367;
    const m_iId = 43;
    const XO_WEAPONS = 4;
    const XO_PLAYER = 5;
        
    iEntity = get_pdata_cbase( id , m_rgpPlayerItems_Slot0 + iSlot , XO_PLAYER );
    
    return ( iEntity > 0 ) ? get_pdata_int( iEntity , m_iId , XO_WEAPONS ) : 0;
}  

stock ham_strip_user_weapon(id, iCswId, iSlot = 0, bool:bSwitchIfActive = true)
{
    new iWeapon
    if( !iSlot )
    {
        static const iWeaponsSlots[] = {
            -1,
            2, //CSW_P228
            -1,
            1, //CSW_SCOUT
            4, //CSW_HEGRENADE
            1, //CSW_XM1014
            5, //CSW_C4
            1, //CSW_MAC10
            1, //CSW_AUG
            4, //CSW_SMOKEGRENADE
            2, //CSW_ELITE
            2, //CSW_FIVESEVEN
            1, //CSW_UMP45
            1, //CSW_SG550
            1, //CSW_GALIL
            1, //CSW_FAMAS
            2, //CSW_USP
            2, //CSW_GLOCK18
            1, //CSW_AWP
            1, //CSW_MP5NAVY
            1, //CSW_M249
            1, //CSW_M3
            1, //CSW_M4A1
            1, //CSW_TMP
            1, //CSW_G3SG1
            4, //CSW_FLASHBANG
            2, //CSW_DEAGLE
            1, //CSW_SG552
            1, //CSW_AK47
            3, //CSW_KNIFE
            1 //CSW_P90
        }
        iSlot = iWeaponsSlots[iCswId]
    }

    const XTRA_OFS_PLAYER = 5
    const m_rgpPlayerItems_Slot0 = 367

    iWeapon = get_pdata_cbase(id, m_rgpPlayerItems_Slot0 + iSlot, XTRA_OFS_PLAYER)

    const XTRA_OFS_WEAPON = 4
    const m_pNext = 42
    const m_iId = 43

    while( iWeapon > 0 )
    {
        if( get_pdata_int(iWeapon, m_iId, XTRA_OFS_WEAPON) == iCswId )
        {
            break
        }
        iWeapon = get_pdata_cbase(iWeapon, m_pNext, XTRA_OFS_WEAPON)
    }

    if( iWeapon > 0 )
    {
        const m_pActiveItem = 373
        if( bSwitchIfActive && get_pdata_cbase(id, m_pActiveItem, XTRA_OFS_PLAYER) == iWeapon )
        {
            ExecuteHamB(Ham_Weapon_RetireWeapon, iWeapon)
        }

        if( ExecuteHamB(Ham_RemovePlayerItem, id, iWeapon) )
        {
            user_has_weapon(id, iCswId, 0)
            ExecuteHamB(Ham_Item_Kill, iWeapon)
            return 1
        }
    }

    return 0
} 

stock drop_weapons(id, dropwhat)
{
    // Get user weapons
    new weapons[32], num_weapons, index, weaponid
    get_user_weapons(id, weapons, num_weapons)
    
    // Loop through them and drop primaries or secondaries
    for (index = 0; index < num_weapons; index++)
    {
        // Prevent re-indexing the array
        weaponid = weapons[index]
        
        if ((dropwhat == 1 && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)) 
        || (dropwhat == 2 && ((1<<weaponid) & SECONDARY_WEAPONS_BIT_SUM))
        || (dropwhat == 3) && (((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM) || ((1<<weaponid) & SECONDARY_WEAPONS_BIT_SUM)))
        {
            // Get weapon entity
            new wname[32]
            get_weaponname(weaponid, wname, charsmax(wname))
            
            // Player drops the weapon
            engclient_cmd(id, "drop", wname)
        }
    }
}  

   // Stock: ChatColor!
    stock ColorChat(const id, const input[], any:...)
    {
        new count = 1, players[32]
        static msg[191]
        vformat(msg, 190, input, 3)
        
        replace_all(msg, 190, "!g", "^4") // Green Color
        replace_all(msg, 190, "!y", "^1") // Default Color
        replace_all(msg, 190, "!team", "^3") // Team Color
        replace_all(msg, 190, "!team2", "^0") // Team2 Color
        
        if (id) players[0] = id; else get_players(players, count, "ch")
        {
            for (new i = 0; i < count; i++)
            {
                if (is_user_connected(players[i]))
                {
                    message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
                    write_byte(players[i]);
                    write_string(msg);
                    message_end();
                }
            }
        }
    }

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

Terms of Use & Privacy Policy