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

V.I.P code, need additions


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nbanow
Senior Member
Join Date: Dec 2010
Location: Lithuania
Old 01-29-2021 , 08:54   V.I.P code, need additions
Reply With Quote #1

Hello guys. I've got this code that I'm almost happy with already. I wish someone could add some more options to this.


1. Add VIP status on TAB scoreboard. (VIP shouldn't hide C4 holder BOMB status)

2. Add command /vips which prints all online VIP players..

3. DISABLE MENU OPTIONS FOR SPECIFIED MAPS:

This VIP menu offers
1. Armors
2. Grenades set
3. HP bonuses after kill

I'd need to find a way how to disable "2" option (grenades set) for specific maps, only prefix of the map needed (fy_, aim_, awp_). Would be cool to get .ini file included in config folder where I could simply specify map prefixes.

Current code


HTML Code:
/* Plugin created by .l00ka*/

#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>
#include <hamsandwich>

#define PLUGIN "VIP Menu by .l00ka"
#define VERSION "1.0"
#define AUTHOR ".l00ka"


new mVIPmenu; // Menu
new mcbVIPMenu; // Menu Callback
new VipUsed[33];
new const PREFIX[] = { "!n[!gVIP!n]" };
new nSelectedItem = 0;
new pHeadShot;
new pKill;
new pMaxHp;
new checkReceiveBonusHP[33];


public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR);
    register_event("DeathMsg", "add_bonus_hp", "a", "1>0");
    RegisterHam(Ham_Spawn, "player", "FwdHamSpawn_Post", 1);
    
    register_clcmd("say vm", "showVIPmenu", ADMIN_LEVEL_H);
    register_clcmd("say /vm", "showVIPmenu", ADMIN_LEVEL_H);
    register_clcmd("say vipmenu", "showVIPmenu", ADMIN_LEVEL_H);
    register_clcmd("say /vipmenu", "showVIPmenu", ADMIN_LEVEL_H);
    
    // Features
    pHeadShot = register_cvar("vipmenu_hp_hs", "20");
    pKill = register_cvar("vipmenu_hp", "15");
    pMaxHp = register_cvar("vipmenu_max_hp", "100");
}

public client_putinserver(id)
{
    checkReceiveBonusHP[id] = false;
}

public FwdHamSpawn_Post(id)
{
    if (is_user_alive(id)) 
    {
        execOnNextRound(id);
        // Restrict menu for one time per round
        VipUsed[id] = false;
    }
}


public showVIPmenu(id, level)
{
    if( !( get_user_flags( id ) & level ) )
    {
        console_print( id, "You have no access to this command." );
        return PLUGIN_HANDLED;
    }
    if(!VipUsed[id]) 
    {    
        /* Menu Choose VIP Feature: */
        mVIPmenu = menu_create("\yChoose VIP Feature: ^n\rPHOBIA", "mh_VipMenuHandler");
        mcbVIPMenu = menu_makecallback("mcb_VIPMenu")
        switch(nSelectedItem) {
        
            case 0: 
            {
                menu_additem(mVIPmenu, "Kevlar+Helm", "1", ADMIN_LEVEL_H, 0);
                menu_additem(mVIPmenu, "Grenade Set", "2", ADMIN_LEVEL_H, 0);
                menu_additem(mVIPmenu, "HP Bonus for KILL", "3", ADMIN_LEVEL_H, 0);
            }
            
            case 1: 
            {
                menu_additem(mVIPmenu, "Kevlar+Helm \r*", "1", ADMIN_LEVEL_H, mcbVIPMenu);
                menu_additem(mVIPmenu, "Grenade Set", "2", ADMIN_LEVEL_H, 0);
                menu_additem(mVIPmenu, "HP Bonus for KILL", "3", ADMIN_LEVEL_H, 0);
            }
            case 2:
            {
                menu_additem(mVIPmenu, "Kevlar+Helm", "1", ADMIN_LEVEL_H, 0);
                menu_additem(mVIPmenu, "Grenade Set \r*", "2", ADMIN_LEVEL_H, mcbVIPMenu);
                menu_additem(mVIPmenu, "HP Bonus for KILL", "3", ADMIN_LEVEL_H, 0);
            }
            case 3:
            {
                menu_additem(mVIPmenu, "Kevlar+Helm", "1", 0);
                menu_additem(mVIPmenu, "Grenade Set", "2",  0);
                menu_additem(mVIPmenu, "HP Bonus for KILL \r*", "3", 0, mcbVIPMenu);
            }
        }    
        menu_setprop(mVIPmenu, MPROP_EXIT, MEXIT_ALL);
        /* Menu End */
        menu_display(id, mVIPmenu, 0);
        
        return PLUGIN_HANDLED;
    }
    else if(VipUsed[id])
    {
        client_printc(id, "%s You Already used !gVIP!n menu this round. Please wait for a next round!", PREFIX);
    }
    else 
    {
        client_printc(id, "%s Only !gADMINS!n and !gVIPS!n can use this menu.", PREFIX);
        return PLUGIN_HANDLED;
        
    }
    return PLUGIN_HANDLED;
}


/* Menu Choose VIP Feature: */

public mh_VipMenuHandler(id, menu, item) {
    if( item == MENU_EXIT ) {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }
    
    
    new data[6], iName[64];
    new access, callback;
    menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
    
    new key = str_to_num(data);
    switch(key)
    {
        case 1:
        {
            if(nSelectedItem != key) {            
                VipUsed[id] = true;            
                nSelectedItem = key;
                client_printc(id, "%s !gARMORS!n will be given next round.", PREFIX);
            }
            
        }
        case 2:
        {
            if(nSelectedItem != key) {            
                VipUsed[id] = true;    
                nSelectedItem = key;
                client_printc(id, "%s !gGRENADE SET!n will be given next round.", PREFIX);
            }
        }
        case 3:
        {
            if(nSelectedItem != key) {            
                VipUsed[id] = true;    
                nSelectedItem = key;
                client_printc(id, "%s !gHP BONUS!n will be loaded next round.", PREFIX);
            }
        }
    }
    
    menu_destroy(menu);
    return PLUGIN_HANDLED;        
    
}


/* Methode that will be called at next round start. */
public execOnNextRound(id) {
    switch(nSelectedItem) {
        case 1: 
        {        
            give_item(id, "item_assaultsuit");
            set_user_armor(id, 100);
            checkReceiveBonusHP[id] = false;
            
        }
        case 2:
        {
            give_item(id, "weapon_hegrenade");
            give_item(id, "weapon_flashbang");
            give_item(id, "weapon_smokegrenade");
            checkReceiveBonusHP[id] = false;
        }
        case 3:
        {
            checkReceiveBonusHP[id] = true;
        }
    }
}



// Colour Chat
stock client_printc(const id, const input[], any:...)
{
    new count = 1, players[32];
    static msg[191];
    vformat(msg, 190, input, 3);        
    replace_all(msg, 190, "!g", "^x04"); // Green Color
    replace_all(msg, 190, "!n", "^x01"); // Default Color
    replace_all(msg, 190, "!t", "^x03"); // Team 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();
            }
        }
    }

}



public mcb_VIPMenu(id, menu, item) {
/* This is the callback-event, here you can set items enabled or disabled. */
/* If you want to enable an item, use: return ITEM_ENABLED */
/* If you want to disable an item, use: return ITEM_DISABLED */
return ITEM_DISABLED;
}


public add_bonus_hp()
{
    // Save our info.
    new iAttacker = read_data(1);
    
    if(checkReceiveBonusHP[iAttacker]) 
    {
        new iVictim = read_data(2);
        
        if(is_user_alive(iAttacker) && iAttacker != iVictim && iAttacker != 0 && get_user_team(iAttacker) != get_user_team(iVictim))
        {
            new iMaxHp = get_pcvar_num(pMaxHp);
            new iHeadShot = read_data(3);
        
            if(iHeadShot)
            {
                set_user_health(iAttacker, clamp(get_user_health(iAttacker) + get_pcvar_num(pHeadShot), 0, iMaxHp));
            }
            else
            {
                set_user_health(iAttacker, clamp(get_user_health(iAttacker) + get_pcvar_num(pKill), 0, iMaxHp));
            }
        }
    }
    
}
Nbanow 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 02:49.


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