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

[REQ] Test plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Evaldas.Grigas
Senior Member
Join Date: Sep 2011
Location: Lithuania
Old 10-26-2011 , 06:07   [REQ] Test plugin
Reply With Quote #1

This code should block from buying awp. But it should let pick it up.
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cl_buy>

#define PLUGIN "Block buy AWP"
#define VERSION "1.0"
#define AUTHOR "Evaldas.Grigas"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event("CurAWP""event_CurAWP""be""1=1")
}

public 
event_CurAWP(idiItem)
{            
    if(!(
get_user_flags(id) & ADMIN_LEVEL_H))
        {    
        if(
iItem == CSW_AWP)
        {
        
client_print(idprint_center"Sniper's only for VIP's")
        
client_cmd(id"drop")
        }
    }

Attached Files
File Type: inc cl_buy.inc (256 Bytes, 206 views)
__________________
Please enter this website everyday: http://forums.alliedmods.net/showthread.php?t=169067

Last edited by Evaldas.Grigas; 10-26-2011 at 09:39.
Evaldas.Grigas is offline
Send a message via Skype™ to Evaldas.Grigas
vato loco [GE-S]
Veteran Member
Join Date: Oct 2006
Location: Germany
Old 10-26-2011 , 06:50   Re: [REQ] Test plugin
Reply With Quote #2

maybe you can edit this for your needs i foud it somewhere

PHP 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_Postid )
{
    
g_iLastTouchedBox[id] = 0
}

public 
WeaponBox_Touch(iWpnBxid)
{
    if( 
is_user_alive(id) && pev(iWpnBxpev_flags) & FL_ONGROUND )
    {
        new 
iWeapon get_pdata_cbase(iWpnBxm_rgpPlayerItems_wpnbx_slot1XO_WEAPONBOX)
        if( 
iWeapon && cs_get_weapon_id(iWeapon) == CSW_AWP && !CanHaveAwpid ) )
        {
            if( 
g_iLastTouchedBox[id] != iWpnBx )
            {
                if( !
user_has_weapon(idCSW_SCOUT) )
                {
                    
client_print(idprint_center"#Cstrike_TitlesTXT_Cannot_Buy_This")
                }
                
g_iLastTouchedBox[id] = iWpnBx
            
}
            return 
HAM_SUPERCEDE
        
}
    }
    return 
HAM_IGNORED
}

public 
BuyAwp(id)
{
    if( !
CanHaveAwpid ) )
    {
        
client_print(idprint_center"#Cstrike_TitlesTXT_Cannot_Buy_This")
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE
}

public 
client_command(id)
{
    static 
szCommand[8]
    
    if( 
read_argv(0szCommandcharsmax(szCommand)) < )
    {
        return 
CheckArgAwp(idszCommand)
    }
    return 
PLUGIN_CONTINUE
}

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

CheckArgAwp(id, const szCommand[]) {
    static const 
awp[] = "awp"
    
static const magnum[] = "magnum"
    
    
if(!CanHaveAwpid ) && (equali(szCommandawp) || equali(szCommandmagnum)))
    {
        
client_print(idprint_center"#Cstrike_TitlesTXT_Cannot_Buy_This")
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE
}

bool:CanHaveAwpid ) {
    return !!(
get_user_flags(id) & ADMIN_LEVEL_H)

__________________

Last edited by vato loco [GE-S]; 10-26-2011 at 07:00.
vato loco [GE-S] is offline
Evaldas.Grigas
Senior Member
Join Date: Sep 2011
Location: Lithuania
Old 10-26-2011 , 07:12   Re: [REQ] Test plugin
Reply With Quote #3

No. I need you to test my code. I am not at home now.
__________________
Please enter this website everyday: http://forums.alliedmods.net/showthread.php?t=169067
Evaldas.Grigas is offline
Send a message via Skype™ to Evaldas.Grigas
vato loco [GE-S]
Veteran Member
Join Date: Oct 2006
Location: Germany
Old 10-26-2011 , 07:19   Re: [REQ] Test plugin
Reply With Quote #4

i don't need to test your code because i see what you try to do with your code...
player who has not the flag H should drop awp when he pick it up...
__________________

Last edited by vato loco [GE-S]; 10-26-2011 at 07:21.
vato loco [GE-S] is offline
Evaldas.Grigas
Senior Member
Join Date: Sep 2011
Location: Lithuania
Old 10-26-2011 , 08:49   Re: [REQ] Test plugin
Reply With Quote #5

No. Player who doesn't have level H can't buy awp. He CAN pick it up! I need to check if it really works without any bugs.
__________________
Please enter this website everyday: http://forums.alliedmods.net/showthread.php?t=169067

Last edited by Evaldas.Grigas; 10-26-2011 at 08:50.
Evaldas.Grigas is offline
Send a message via Skype™ to Evaldas.Grigas
edgaras85
Senior Member
Join Date: Mar 2010
Location: Lithuania
Old 10-26-2011 , 09:27   Re: [REQ] Test plugin
Reply With Quote #6

Quote:
Originally Posted by Evaldas.Grigas View Post
No. Player who doesn't have level H can't buy awp. He CAN pick it up! I need to check if it really works without any bugs.
The code you made is doing backwards... It lets to buy awp, and Player with level H (vip) can't pick up awp
__________________
edgaras85 is offline
Evaldas.Grigas
Senior Member
Join Date: Sep 2011
Location: Lithuania
Old 10-26-2011 , 09:39   Re: [REQ] Test plugin
Reply With Quote #7

Edited. Test it again please. Than you.
__________________
Please enter this website everyday: http://forums.alliedmods.net/showthread.php?t=169067
Evaldas.Grigas is offline
Send a message via Skype™ to Evaldas.Grigas
vato loco [GE-S]
Veteran Member
Join Date: Oct 2006
Location: Germany
Old 10-26-2011 , 10:30   Re: [REQ] Test plugin
Reply With Quote #8

learn to read
Quote:
Originally Posted by vato loco [GE-S] View Post
player who has not the flag H
and by the way
one thing is what to try to do with your code
an other thing is what the code do...
and your code let everyone who has not flag H drop the awp nothing else

all you have to do is to remove some stuff from the code i have post
(wepaonbox stuff) and you will have what you trying to do
__________________

Last edited by vato loco [GE-S]; 10-26-2011 at 11:03.
vato loco [GE-S] is offline
Old 10-26-2011, 10:37
Evaldas.Grigas
This message has been deleted by Evaldas.Grigas.
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 05:49.


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