Raised This Month: $12 Target: $400
 3% 

Knife drain


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
homm88
New Member
Join Date: Jan 2008
Old 01-24-2008 , 08:30   Knife drain
Reply With Quote #1

I just want that if I knife (damage not only kill) someone, I get extra HP. If I hit someone for 65dmg, I get 65dmg for myself. (or a Cvar to control dmg would be <3)
I searched and I didn't any plugin that could do this, it should be an unique idea. It would benefit knifing in official maps, as usually people knife for just fun and to show skill...
It would also fit on 100hp knife maps...
homm88 is offline
[kirk]./musick`
Senior Member
Join Date: Jun 2007
Location: Tampa, Florida
Old 01-24-2008 , 16:18   Re: Knife drain
Reply With Quote #2

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>

new i_Cvari_bCvar

public plugin_init() {
    
register_plugin("Knife HP""1.0""kirkhalo")
    
i_Cvar register_cvar("amx_kniferight""65")    
    
i_bCvar register_cvar("amx_knifeleft""45")
}

public 
client_damage(iAttackeriVictimiDamageiWeap_indexg_bTA){
    new 
sWeapon_Name[50]
    
get_weaponname(iWeap_indexsWeapon_Name49)
    if (
equal(sWeapon_Name"weapon_knife")){
        if (!
g_bTA){
        new 
i_Cvar_amount get_pcvar_num(i_Cvar)
        new 
i_bCvar_amount get_pcvar_num(i_bCvar)
        new 
iHealth 
        
switch (iDamage){
            case 
65: {
            
iHealth get_user_health(iAttacker) + i_Cvar_amount
            set_user_health
(iAttackeriHealth)
        }
            
            case 
45: {
            
iHealth get_user_health(iAttacker) + i_bCvar_amount
            set_user_health
(iAttackeriHealth)
        }
            }
        }
    }
    return 
PLUGIN_HANDLED

Could probably be shorter, but I'm not that great at making short plugins

-Kirk
__________________
[kirk]./musick` is offline
Send a message via AIM to [kirk]./musick`
homm88
New Member
Join Date: Jan 2008
Old 01-24-2008 , 16:43   Re: Knife drain
Reply With Quote #3

Thx, will be testing.
Compiled successfully.
[ 37] Knife HP 1.0 kirkhalo knifedrain.amxx running
I will test tomorrow with my brother in LAN.

Last edited by homm88; 01-24-2008 at 17:08.
homm88 is offline
[kirk]./musick`
Senior Member
Join Date: Jun 2007
Location: Tampa, Florida
Old 01-24-2008 , 16:44   Re: Knife drain
Reply With Quote #4

Ok, if there are any errors, sorry, I can't personally test any plugins, only compile. Usually 1 person testing doesn't work out too well

Just tell me if there is.
__________________
[kirk]./musick` is offline
Send a message via AIM to [kirk]./musick`
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 01-25-2008 , 07:24   Re: Knife drain
Reply With Quote #5

i read it as he wanted a plugin that gave you hp for the amount of damage you dealt to someone with your knife
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
[kirk]./musick`
Senior Member
Join Date: Jun 2007
Location: Tampa, Florida
Old 01-25-2008 , 07:48   Re: Knife drain
Reply With Quote #6

And thats exactly what I did.

EDIT:
PS: Just in case you didn't know, I did include 2 cvars, one for right click knife hit (65 dmg), and one for left click (45 dmg). If you want to control the amount of health you get for each you can use these 2 cvars: "amx_kniferight" (right click knife health added) DEFAULT: "65". "amx_knifeleft" (left click knife health added) DEFAULT: "45".

-Kirk
__________________

Last edited by [kirk]./musick`; 01-25-2008 at 07:52.
[kirk]./musick` is offline
Send a message via AIM to [kirk]./musick`
homm88
New Member
Join Date: Jan 2008
Old 01-25-2008 , 13:55   Re: Knife drain
Reply With Quote #7

X-olent is right though, this is a little different, you can do more or less damage with knife so when I left click for 60dmg then it still gives me amx_knifeleft hp...
I knew and spotted the CVARs, I set the amx_kniferight to 65 and knifeleft to 15, and it didn't seem to work when I tested...
homm88 is offline
[kirk]./musick`
Senior Member
Join Date: Jun 2007
Location: Tampa, Florida
Old 01-25-2008 , 15:46   Re: Knife drain
Reply With Quote #8

Sorry, I don't memorize all the hp done by hits. I'm practically sure it is 65 damage for a right click, but what about left click? Is it 15 or 45? I lost track. That's the only error.

I reread what you meant and now I see what you mean. It isn't always the same amount of damage am I correct? So if I could get the lowest amount of damage for a right click, then I will be able to fix it. I just got home from school, and I'm a little confused at the moment.

-Kirk
__________________
[kirk]./musick` is offline
Send a message via AIM to [kirk]./musick`
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 01-25-2008 , 15:50   Re: Knife drain
Reply With Quote #9

Code:
#include <amxmodx> #include <cstrike> #include <csx> #include <fun> public plugin_init() {      register_plugin("Knife HP", "1.0", "Exolent"); } public client_damage(attacker, victim, damage, wpnid, ta) {      if(!attacker      || !victim      || attacker == victim      || ta      || cs_get_weapon_id(wpnid) != CSW_KNIFE)           return;            new health = get_user_health(attacker)+damage;      set_user_health(attacker, (health <= 100) ? health : 100) }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
homm88
New Member
Join Date: Jan 2008
Old 01-25-2008 , 15:51   Re: Knife drain
Reply With Quote #10

The damage seriously varies, right click is (55?)65-780, left click is 14-... idk, maybe its 45.
The plugin didn't make me gain any hp when I hit my enemy...
I will be trying X-olent's script tomorrow, hope it works better, I appreciate all the effort though.

Sorry, X-olent's script doesn't work either, I seem to get no HP for knifing my enemy.

Last edited by homm88; 01-26-2008 at 10:16.
homm88 is offline
Old 01-25-2008, 15:59
homm88
This message has been deleted by homm88. Reason: mistake
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 20:14.


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