Raised This Month: $ Target: $400
 0% 

Multiply slash damage by two


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 06-28-2012 , 14:21   Multiply slash damage by two
Reply With Quote #1

How would you do this? I thought about checking if the weapon is knife and damage before hooking is 15 but that feels a little bit uncool. Ham_TakeDamage would be greatly appreciated as I already use it.
Backstabnoob is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 06-28-2012 , 14:40   Re: Multiply slash damage by two
Reply With Quote #2

hook Ham_TakeDamage as pre
Check that the attacker's weapon is CSW_KNIFE (or 29)
inside that....
PHP Code:
    SetHamParamFloat(4flDamage*2
__________________
What an elegant solution to a problem that doesn't need solving....
Liverwiz is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 06-28-2012 , 14:43   Re: Multiply slash damage by two
Reply With Quote #3

Read the topic name again please.
Backstabnoob is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-28-2012 , 14:46   Re: Multiply slash damage by two
Reply With Quote #4

There is a plugin that measures slash and stab distances separately.
You should take a look at that code and see if it helps you.

I think it's Knife Distance by SchlumPF.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 06-28-2012 , 14:50   Re: Multiply slash damage by two
Reply With Quote #5

oh. sorry

PHP Code:
(flDamage 30) ? SetHamParamFloat(4flDamage*2) : return HAM_HANDLED 
i figure a stab is gonna be around 55 or greater at all times. so being less than 30 would give it a pretty good threshold if anything messes with it.


Quote:
Originally Posted by Exolent[jNr] View Post
There is a plugin that measures slash and stab distances separately.
You should take a look at that code and see if it helps you.

I think it's Knife Distance by SchlumPF.
What i have to say about that is you can slash within the same distance as a stab (and quite frequently do)
Or you can check to see if the weapon is under primary, or secondary operations (left or right click) but i don't know that at the top off my head. Or at all....
__________________
What an elegant solution to a problem that doesn't need solving....

Last edited by Liverwiz; 06-28-2012 at 14:53.
Liverwiz is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 06-28-2012 , 14:52   Re: Multiply slash damage by two
Reply With Quote #6

It checks for the pressed button via pev_button. I'm going to try using that.
If anyone knows it won't work in TakeDamage, please tell me so I can save some headaches
Backstabnoob is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 06-28-2012 , 14:56   Re: Multiply slash damage by two
Reply With Quote #7

Quote:
Originally Posted by Liverwiz View Post
Or you can check to see if the weapon is under primary, or secondary operations (left or right click) but i don't know that at the top off my head. Or at all....
Quote:
Originally Posted by Backstabnoob View Post
It checks for the pressed button via pev_button. I'm going to try using that.
If anyone knows it won't work in TakeDamage, please tell me so I can save some headaches
YAY! i was right. and yay for fakemeta.
__________________
What an elegant solution to a problem that doesn't need solving....
Liverwiz is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-29-2012 , 00:47   Re: Multiply slash damage by two
Reply With Quote #8

You can see in cssdk : http://code.google.com/p/cs-sdk/sour.../wpn_knife.cpp
that on slah, pre-damage passed is 15.0 or 20.0, and on stab, damage is 65.0 (or 65.0 * 3.0)

PHP Code:
#include <amxmodx>

#include <hamsandwich>


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

public plugin_init()
{
    
g_iMaxPlayers get_maxplayers()
    
RegisterHam(Ham_TraceAttack"player""OnCBasePlayer_TraceAttack"false)
}

public 
OnCBasePlayer_TraceAttack(idiAttackerFloat:flDamage /* , Float:fVecDir[3], ptr, bitsDamageType */ )
{
    if( 
IsPlayer(iAttacker) && flDamage 21.0 && get_user_weapon(iAttacker) == CSW_KNIFE )
    {
        
SetHamParamFloat(3flDamage 2.0)
        return 
HAM_HANDLED
    
}
    return 
HAM_IGNORED

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 06-29-2012 at 01:21.
ConnorMcLeod is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 06-29-2012 , 04:22   Re: Multiply slash damage by two
Reply With Quote #9

I said I could check the damage in the first post, but it may cause problems if any plugin modifies the damage and is loaded before this one. While I take this as a second method, I'll still try using pev_button first as it may be a better solution if it works.
Backstabnoob is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 06-29-2012 , 18:12   Re: Multiply slash damage by two
Reply With Quote #10

I can confirm that pev_button works flawlessly.
Backstabnoob is offline
Reply



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


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