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

Plugin editing: Snipers only for VIPs


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
HiDeath
Senior Member
Join Date: Aug 2018
Location: Tunisia
Old 09-24-2019 , 18:15   Plugin editing: Snipers only for VIPs
Reply With Quote #1

Could anyone edit this code so it works for all snipers

The purpose of this plugin is to allow snipers only for VIPs (can't buy or pick...)

Weapons that should be included: id:
AWP (Magnum Sniper Rifle): CSW_AWP
Krieg 550 Commando: CSW_SG550
D3/AU-1: CSW_G3SG1

Thanks in advance!

Code:
#include <amxmodx>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>

#define VERSION "1.0.0"

#define MAX_PLAYERS 32

#define XO_WEAPONBOX    4
#define m_rgpPlayerItems_wpnbx_slot1 35

new g_iLastTouchedBox[MAX_PLAYERS+1]

public plugin_init()
{
    register_plugin("Awp VIP", VERSION, "ConnorMcLeod")

    RegisterHam(Ham_Spawn, "player", "Player_Spawn_Post", 1)
    RegisterHam(Ham_Touch, "weaponbox", "WeaponBox_Touch")

    register_menucmd(register_menuid("T_BuyRifle", 1), MENU_KEY_5, "BuyAwp")
    register_menucmd(register_menuid("CT_BuyRifle", 1), MENU_KEY_6, "BuyAwp")
}

public client_putinserver(id)
{
    g_iLastTouchedBox[id] = 0
}

public Player_Spawn_Post( id )
{
    g_iLastTouchedBox[id] = 0
}

public WeaponBox_Touch(iWpnBx, id)
{
    if( is_user_alive(id) && pev(iWpnBx, pev_flags) & FL_ONGROUND )
    {
        new iWeapon = get_pdata_cbase(iWpnBx, m_rgpPlayerItems_wpnbx_slot1, XO_WEAPONBOX)
        if( iWeapon > 0 && cs_get_weapon_id(iWeapon) == CSW_AWP && !CanHaveAwp( id ) )
        {
            if( g_iLastTouchedBox[id] != iWpnBx )
            {
                if( !user_has_weapon(id, CSW_SCOUT) )
                {
                    client_print(id, print_center, "#Cstrike_TitlesTXT_Cannot_Buy_This")
                }
                g_iLastTouchedBox[id] = iWpnBx
            }
            return HAM_SUPERCEDE
        }
    }
    return HAM_IGNORED
}

public BuyAwp(id)
{
    if( !CanHaveAwp( id ) )
    {
        client_print(id, print_center, "#Cstrike_TitlesTXT_Cannot_Buy_This")
        return PLUGIN_HANDLED
    }
    return PLUGIN_CONTINUE
}

public client_command(id)
{
    static szCommand[8]

    if( read_argv(0, szCommand, charsmax(szCommand)) < 7 )
    {
        return CheckArgAwp(id, szCommand)
    }
    return PLUGIN_CONTINUE
}

public CS_InternalCommand(id, const szCommand[])
{
    return CheckArgAwp(id, szCommand)
}

CheckArgAwp(id, const szCommand[])
{
    static const awp[] = "awp"
    static const magnum[] = "magnum"

    if(    !CanHaveAwp( id )
    &&    ( equali(szCommand, awp) || equali(szCommand, magnum) )    )
    {
        client_print(id, print_center, "#Cstrike_TitlesTXT_Cannot_Buy_This")
        return PLUGIN_HANDLED
    }
    return PLUGIN_CONTINUE
}

bool:CanHaveAwp( id )
{
    return !!(get_user_flags(id) & ADMIN_LEVEL_H)
}
__________________
Avoid cs 1.6 no steam, use the steam version clean full & original
HiDeath is offline
HiDeath
Senior Member
Join Date: Aug 2018
Location: Tunisia
Old 10-08-2019 , 07:15   Re: Plugin editing: Snipers only for VIPs
Reply With Quote #2

UP
__________________
Avoid cs 1.6 no steam, use the steam version clean full & original
HiDeath is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 10-14-2019 , 10:27   Re: Plugin editing: Snipers only for VIPs
Reply With Quote #3

Did you ever play the VIP with only a knife like it should be?

ConnorMcLeod made it so only The VIP can have AWP and you want that expanded to all sniper weapons including the auto-sniper which is banned on AS maps by default?
Interesting. What I am working on is VIP has a para and everybody else has No Buy Zone.
__________________
DJEarthQuake is offline
HiDeath
Senior Member
Join Date: Aug 2018
Location: Tunisia
Old 10-17-2019 , 11:10   Re: Plugin editing: Snipers only for VIPs
Reply With Quote #4

Quote:
Originally Posted by DJEarthQuake View Post
Did you ever play the VIP with only a knife like it should be?

ConnorMcLeod made it so only The VIP can have AWP and you want that expanded to all sniper weapons including the auto-sniper which is banned on AS maps by default?
Interesting. What I am working on is VIP has a para and everybody else has No Buy Zone.
Everyone has his own server preferences, so why the hell you just being an asshole?
__________________
Avoid cs 1.6 no steam, use the steam version clean full & original
HiDeath 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 15:51.


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