Raised This Month: $ Target: $400
 0% 

To block attack knife to time.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
The Inhabitant Of Heavens
Member
Join Date: Aug 2011
Old 09-25-2011 , 23:24   To block attack knife to time.
Reply With Quote #1

How to make knife attack delay to 2 seconds?

Last edited by The Inhabitant Of Heavens; 09-26-2011 at 09:32.
The Inhabitant Of Heavens is offline
Old 09-26-2011, 09:32
The Inhabitant Of Heavens
This message has been deleted by The Inhabitant Of Heavens.
Diegorkable
Veteran Member
Join Date: Jun 2011
Old 09-26-2011 , 14:42   Re: To block attack knife to time.
Reply With Quote #2

Is it possible to block a player trying to attack?

like register_clcmd("+attack") and then return plugin handled or w/e it is (FMRES or w/e), try looking for a forward of it in Fake Meta (they have almost everything lol) and then set a boolean, check if its true block it, and set a task to 2 seconds when after 2 seconds the bool will be false (thats the algorythm, about the physic part i dont know much)
Diegorkable is offline
Stereo
Veteran Member
Join Date: Dec 2010
Old 09-26-2011 , 14:55   Re: To block attack knife to time.
Reply With Quote #3

If you know a little pawn, you need to register Ham_Weapon_PrimaryAttack, use return HAM_SUPERCEDE and set_task with 2.0 seconds and client_cmd(id, "+attack")

That's what I think
Stereo is offline
The Inhabitant Of Heavens
Member
Join Date: Aug 2011
Old 09-27-2011 , 09:07   Re: To block attack knife to time.
Reply With Quote #4

Stereo,example pls
The Inhabitant Of Heavens is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 09-27-2011 , 12:22   Re: To block attack knife to time.
Reply With Quote #5

The attack is easy to block but the animations are not since they are client-side.
__________________

Last edited by Bugsy; 09-27-2011 at 19:29.
Bugsy is offline
Stereo
Veteran Member
Join Date: Dec 2010
Old 09-27-2011 , 13:07   Re: To block attack knife to time.
Reply With Quote #6

I'm not sure

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

#define PLUGIN "Attack 2 seconds"
#define VERSION "1.0"
#define AUTHOR "Stereo"

#define XTRA_OFS_PLAYER            5
#define m_flNextAttack            83

new g_iMaxPlayers
#define IsPlayer(%1)    ( 1 <= %1 <= g_iMaxPlayers )

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
RegisterHam(Ham_Weapon_PrimaryAttack"weapon_knife""Ham_Primary_Knife_Attack")
    
    
g_iMaxPlayers get_maxplayers()
}
public 
Ham_Primary_Knife_Attack(ent)
{
    new 
id pev(entpev_owner)
    if(
is_user_alive(id) && IsPlayer(id) )
    {
        
set_task(2.0"Attack_Player"id)
        
set_pdata_float(idm_flNextAttack1.0XTRA_OFS_PLAYER)
    }
}
public 
Attack_Player(iPlayer)
    
ExecuteHam(Ham_Weapon_PrimaryAttackiPlayer
Stereo is offline
The Inhabitant Of Heavens
Member
Join Date: Aug 2011
Old 09-27-2011 , 14:05   Re: To block attack knife to time.
Reply With Quote #7

Not,doesn't work
The Inhabitant Of Heavens is offline
a7811311622
Member
Join Date: Apr 2010
Old 09-28-2011 , 10:33   Re: To block attack knife to time.
Reply With Quote #8

PHP Code:
#include <amxmodx>
#include <hamsandwich>
public plugin_init()
{
 
register_plugin("undefined""1.0""a7811311622")
 
 
RegisterHam(Ham_Weapon_PrimaryAttack"weapon_knife""fw_PriAttack")
}
public 
fw_PriAttack(weapon)
{
 if(!
weapon) return HAM_IGNORED
 
 set_task
(2.0"PrimaryAttackDelay"weapon)
 
 return 
HAM_SUPERCEDE
}
public 
PrimaryAttackDelay(weapon)
{
 
ExecuteHam(Ham_Weapon_PrimaryAttackweapon)

__________________
a7811311622 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 09-28-2011 , 11:45   Re: To block attack knife to time.
Reply With Quote #9

The attack itself will be blocked with that, however you will still see the player doing the attack animation, as stated above. Also, clicking attack multiple times or holding attack will need special handling.
__________________
Bugsy is offline
a7811311622
Member
Join Date: Apr 2010
Old 09-28-2011 , 22:30   Re: To block attack knife to time.
Reply With Quote #10

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
public plugin_init()
{
 
register_plugin("undefined""1.0""a7811311622")
 
 
RegisterHam(Ham_Weapon_PrimaryAttack"weapon_knife""fw_PriAttack")
}
public 
fw_PriAttack(weapon)
{
 if(!
pev_valid(weapon)) return HAM_IGNORED
 
 set_pev
(pev(weaponpev_owner), pev_weaponanim0)
 
message_begin(MSG_ONE_UNRELIABLESVC_WEAPONANIM_pev(weaponpev_owner))
 
write_byte(0)
 
write_byte(pev(pev(weaponpev_owner), pev_body))
 
message_end()
 
 
set_pdata_float(pev(weaponpev_owner), 83get_gametime(), 5)
 
 
set_task(2.0"PrimaryAttackDelay"weapon)
 
 return 
HAM_SUPERCEDE
}
public 
PrimaryAttackDelay(weapon)
{
 
set_pdata_float(pev(weaponpev_owner), 830.05)
 
ExecuteHam(Ham_Weapon_PrimaryAttackweapon)

__________________
a7811311622 is offline
Reply


Thread Tools
Display Modes

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 19:34.


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