Raised This Month: $ Target: $400
 0% 

Block some weapons for SOME players


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Legend
Member
Join Date: Mar 2010
Location: Denmark
Old 03-13-2010 , 15:39   Block some weapons for SOME players
Reply With Quote #1

If someone have a class there can't use example AK47 and M4A1, so is it possible to block some weapons for some players also in buy menu?
__________________
Legend is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 03-13-2010 , 16:04   Re: Block some weapons for SOME players
Reply With Quote #2

Use RegisterHam( Ham_AddPlayerItem, "player", "HAM_AddItem_Pre" )
then supercede if it's the weapon you're wanting them not to have.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
Legend
Member
Join Date: Mar 2010
Location: Denmark
Old 03-13-2010 , 16:07   Re: Block some weapons for SOME players
Reply With Quote #3

Thanks, I got another question:
Is it possible to add extra damage to example a AWP?
__________________
Legend is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 03-13-2010 , 16:27   Re: Block some weapons for SOME players
Reply With Quote #4

Yep. Many different ways to do it, and I'm sure my method will be corrected with a more efficient one, so be sure to check in.

PHP Code:
#define EXTRA_DAMAGE    40

public plugin_init()
{
    
RegisterHamHam_TakeDamage"player""HAM_TakeDamage_Pre" )
}

public 
HAM_TakeDamage_Previctiminflictorattackerfloat:damagedamagebits )
{
    if( 
inflictor == CSW_AWP )
    {
        
SetHamParamFloat4Float:damage EXTRA_DAMAGE )
    }
    
    return 
HAM_IGNORED;

__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
Seta00
The Seta00 user has crashed.
Join Date: Jan 2010
Location: Berlin
Old 03-13-2010 , 16:46   Re: Block some weapons for SOME players
Reply With Quote #5

Quote:
Originally Posted by wrecked_ View Post
Yep. Many different ways to do it, and I'm sure my method will be corrected with a more efficient one, so be sure to check in.

PHP Code:
#define EXTRA_DAMAGE    40

public plugin_init()
{
    
RegisterHamHam_TakeDamage"player""HAM_TakeDamage_Pre" )
}

public 
HAM_TakeDamage_Previctiminflictorattackerfloat:damagedamagebits )
{
    if( 
inflictor == CSW_AWP )
    {
        
SetHamParamFloat4Float:damage EXTRA_DAMAGE )
    }
    
    return 
HAM_IGNORED;

Quote:
Originally Posted by ham_const.inc
Inflictor is the entity that caused the damage (such as a gun).
`inflictor' isn't the gun type, it's the gun entity id.
Seta00 is offline
Legend
Member
Join Date: Mar 2010
Location: Denmark
Old 03-14-2010 , 07:26   Re: Block some weapons for SOME players
Reply With Quote #6

That way is pretty hard isnt there a easier way?
__________________
Legend is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-14-2010 , 08:16   Re: Block some weapons for SOME players
Reply With Quote #7

Quote:
Originally Posted by Seta00 View Post
`inflictor' isn't the gun type, it's the gun entity id.
Inflictor is not the gun entity index, it's the player index unless this is a non attached entity as grenade.

And for other request, Ham_AddPlayerItem wont block buy, money will be taken but weapon won't be given.
Look how i block flash buy and flash pickup in this plugin : http://forums.alliedmods.net/showthread.php?p=596743
And do the same with m4 and ak
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 03-14-2010 at 08:21.
ConnorMcLeod 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 08:43.


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