Raised This Month: $ Target: $400
 0% 

Creating knockback.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Fry!
Veteran Member
Join Date: Apr 2008
Location: Latvia
Old 01-25-2009 , 08:45   Creating knockback.
Reply With Quote #1

Hi, guys! I want to ask something is it possible to create knockback for knife too? just like for all other weapons? If yes please show it how...

Regards.
__________________
Quote:
Originally Posted by wisam187
why all the great scriptors..... always.... leave and let their works go into oblivion ???
i miss your way in making outstanding plugins...
this forum needs lots of the likes of you..... and less of the idiots that spread right now.
Fry! is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-25-2009 , 10:13   Re: Creating knocback.
Reply With Quote #2

Try this :

PHP Code:
/*    Copyright © 2009, ConnorMcLeod

    Knife KnockBack is free software;
    you can redistribute it and/or modify it under the terms of the
    GNU General Public License as published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Knife KnockBack; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <xs>

#define PLUGIN "Knife KnockBack"
#define AUTHOR "ConnorMcLeod"
#define VERSION "0.0.1"

new g_pCvarKnockBack

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
g_pCvarKnockBack register_cvar("amx_knife_knockback""10")

    
RegisterHam(Ham_TakeDamage"player""Player_TakeDamage"1)
}

public 
Player_TakeDamage(ididinflictoridattackerFloat:flDamagedamagebits)
{
    if(    !
idattacker
    
||    id == idattacker
    
||    idinflictor != idattacker//    )
    
||    get_user_weapon(idattacker) != CSW_KNIFE    )
    {
        return
    }

    new 
Float:fDir[3], Float:fOrigin[3], Float:fVelocity[3]

    
pev(idpev_originfDir)
    
pev(idattackerpev_originfOrigin)

    
xs_vec_sub(fDirfOriginfDir)
    
xs_vec_normalize(fDirfDir)

    
flDamage *= get_pcvar_num(g_pCvarKnockBack)
    if( 
flDamage 1500.0 )
        
flDamage 1500.0

    pev
(idpev_velocityfVelocity)
    
xs_vec_mul_scalar(fDirflDamagefDir)
    
xs_vec_add(fVelocityfDirfVelocity)
    
set_pev(idpev_velocityfVelocity)

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Fry!
Veteran Member
Join Date: Apr 2008
Location: Latvia
Old 01-25-2009 , 11:44   Re: Creating knockback.
Reply With Quote #3

Um, no doesn't work even cvar wont work.
__________________
Quote:
Originally Posted by wisam187
why all the great scriptors..... always.... leave and let their works go into oblivion ???
i miss your way in making outstanding plugins...
this forum needs lots of the likes of you..... and less of the idiots that spread right now.
Fry! is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-25-2009 , 12:26   Re: Creating knockback.
Reply With Quote #4

I have tested with high cvar value and was working.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Fry!
Veteran Member
Join Date: Apr 2008
Location: Latvia
Old 01-25-2009 , 12:50   Re: Creating knockback.
Reply With Quote #5

um, can you add distance too how far victim will knocked back? Cuz otherwise looks like it's just a knife hit... ;/
__________________
Quote:
Originally Posted by wisam187
why all the great scriptors..... always.... leave and let their works go into oblivion ???
i miss your way in making outstanding plugins...
this forum needs lots of the likes of you..... and less of the idiots that spread right now.

Last edited by Fry!; 01-25-2009 at 12:52.
Fry! is offline
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 01-25-2009 , 15:08   Re: Creating knockback.
Reply With Quote #6

Quote:
Originally Posted by Fry! View Post
um, can you add distance too how far victim will knocked back? Cuz otherwise looks like it's just a knife hit... ;/
The higher the cvar's value, the farther he will get knocked back.
I suggest making it random though.
__________________
O o
/¯________________________
| IMMA FIRIN' MAH LAZOR!!!
\_¯¯¯
Dores is offline
Old 01-25-2009, 12:51
Fry!
This message has been deleted by Fry!.
Fry!
Veteran Member
Join Date: Apr 2008
Location: Latvia
Old 01-25-2009 , 16:28   Re: Creating knockback.
Reply With Quote #8

When I tested with bots this plugin didn't work at all... When I knife enemys they even wont knocked back... wtf?
__________________
Quote:
Originally Posted by wisam187
why all the great scriptors..... always.... leave and let their works go into oblivion ???
i miss your way in making outstanding plugins...
this forum needs lots of the likes of you..... and less of the idiots that spread right now.
Fry! is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-25-2009 , 17:02   Re: Creating knockback.
Reply With Quote #9

Tested with podbots and works, but may be it would help to set the player higher when he is on ground.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 01-25-2009 , 17:06   Re: Creating knockback.
Reply With Quote #10

Bots will behave a little bit differently than regular clients when you're setting their velocity.

From experience, I've found that bots need to be pushed much harder.
__________________
stupok 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 01:38.


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