AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   To block attack knife to time. (https://forums.alliedmods.net/showthread.php?t=168235)

The Inhabitant Of Heavens 09-25-2011 23:24

To block attack knife to time.
 
How to make knife attack delay to 2 seconds?

Diegorkable 09-26-2011 14:42

Re: To block attack knife to time.
 
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)

Stereo 09-26-2011 14:55

Re: To block attack knife to time.
 
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

The Inhabitant Of Heavens 09-27-2011 09:07

Re: To block attack knife to time.
 
Stereo,example pls

Bugsy 09-27-2011 12:22

Re: To block attack knife to time.
 
The attack is easy to block but the animations are not since they are client-side.

Stereo 09-27-2011 13:07

Re: To block attack knife to time.
 
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


The Inhabitant Of Heavens 09-27-2011 14:05

Re: To block attack knife to time.
 
Not,doesn't work

a7811311622 09-28-2011 10:33

Re: To block attack knife to time.
 
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)



Bugsy 09-28-2011 11:45

Re: To block attack knife to time.
 
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.

a7811311622 09-28-2011 22:30

Re: To block attack knife to time.
 
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)




All times are GMT -4. The time now is 17:34.

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