AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   No knife HIT (https://forums.alliedmods.net/showthread.php?t=189744)

kulers2010 07-10-2012 11:39

No knife HIT
 
No hit attack 1 and 2

Quote:

public Fwd_PlayerPreThink(id)
{
static temp, weapon;
weapon = get_user_weapon(id, temp, temp);

if(weapon == CSW_KNIFE)
{
if(get_user_team(id) == 2)
{
//Code whitch not allow hit with attack1
static button;
button = pev(id, pev_button);
if(button & IN_ATTACK)
{
button = (button & ~IN_ATTACK ) | IN_ATTACK2;
set_pev(id, pev_button, button);
}
}
else
{
//Code whitch not allow hit with attack 1 or attack2
}
}
}
WRead this where i write, i dont know what need write (//Code whitch not allow hit with attack 1 or attack2)

Aooka 07-10-2012 12:23

Re: No knife HIT
 
Hmm look at :
Code:

/**
        * Description:                Usually called whenever an entity takes any kind of damage.
        *                                        Inflictor is the entity that caused the damage (such as a gun).
        *                                        Attacker is the entity that tirggered the damage (such as the gun's owner).
        * Forward params:        function(this, idinflictor, idattacker, Float:damage, damagebits);
        * Return type:                Integer.
        * Execute params:        ExecuteHam(Ham_TakeDamage, this, idinflictor, idattacker, Float:damage, damagebits);
        */
        Ham_TakeDamage,


mottzi 07-11-2012 05:20

Re: No knife HIT
 
It would be bether to use traceAttack, I guess.

Napoleon_be 07-11-2012 10:33

Re: No knife HIT
 
Use Cmd_Start to block binds like that...

OnePL 07-11-2012 19:21

Re: No knife HIT
 
Maybe so?

PHP Code:

#include <amxmodx>
#include <fakemeta>

public plugin_init()
    
register_forward(FM_PlayerPreThink"PlayerPreThink")

public 
PlayerPreThink(id) {
    if(
is_user_connected(id) && is_user_alive(id) && get_user_weapon(id) == CSW_KNIFE && get_user_team(id) == 2)
        
set_pev(idpev_buttonpev(idpev_button) & ~IN_ATTACK && pev(idpev_button) & ~IN_ATTACK2)

    return 
FMRES_HANDLED



Bugsy 07-11-2012 19:30

Re: No knife HIT
 
Do you want to block the attacker from using the knife or just block the damage inflicted on the victim?


All times are GMT -4. The time now is 15:14.

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