AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Block some weapons for SOME players (https://forums.alliedmods.net/showthread.php?t=121262)

Legend 03-13-2010 15:39

Block some weapons for SOME players
 
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?

wrecked_ 03-13-2010 16:04

Re: Block some weapons for SOME players
 
Use RegisterHam( Ham_AddPlayerItem, "player", "HAM_AddItem_Pre" )
then supercede if it's the weapon you're wanting them not to have.

Legend 03-13-2010 16:07

Re: Block some weapons for SOME players
 
Thanks, I got another question:
Is it possible to add extra damage to example a AWP?

wrecked_ 03-13-2010 16:27

Re: Block some weapons for SOME players
 
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;



Seta00 03-13-2010 16:46

Re: Block some weapons for SOME players
 
Quote:

Originally Posted by wrecked_ (Post 1116521)
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.

Legend 03-14-2010 07:26

Re: Block some weapons for SOME players
 
That way is pretty hard isnt there a easier way?

ConnorMcLeod 03-14-2010 08:16

Re: Block some weapons for SOME players
 
Quote:

Originally Posted by Seta00 (Post 1116538)
`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


All times are GMT -4. The time now is 08:43.

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