AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   catch knife attack (https://forums.alliedmods.net/showthread.php?t=106030)

One 10-10-2009 20:32

catch knife attack
 
how to catch knife-attack,knife-attacker, victim & the dmg?


* the attackers weapon can be knife but he can make dmg with touching the victim. so i cant check attackers weapon.

Jon 10-10-2009 20:35

Re: catch knife attack
 
Ham_TakeDamage? Didn't quite understand this: * the attackers weapon can be knife but he can make dmg with touching the victim.

One 10-10-2009 20:38

Re: catch knife attack
 
Quote:

Originally Posted by Jon (Post 958138)
Ham_TakeDamage? Didn't quite understand this: * the attackers weapon can be knife but he can make dmg with touching the victim.

so i have to get the weapon of the attacker when i register an event "ham_takedamage". but as i said, users weapon can be knife but i need only the knife damage. nothing else.

the user can make damage without any weapons. for example by jumping or touching other players. in this case the weapon can be all weapons.
i need to get only the damage which made by knife.

Bugsy 10-10-2009 21:51

Re: catch knife attack
 
Quote:

Originally Posted by One (Post 958142)
so i have to get the weapon of the attacker when i register an event "ham_takedamage". but as i said, users weapon can be knife but i need only the knife damage. nothing else.

the user can make damage without any weapons. for example by jumping or touching other players. in this case the weapon can be all weapons.
i need to get only the damage which made by knife.

When the victim takes damage, check if attackers current weapon is knife? Am I missing something here? Your explanation sounds odd, you are looking to catch knife damage, then you say you cant check the attackers weapon because he can issue damage just by touching the victim. But won't he need to be holding the knife to issue knife damage?

PHP Code:

#define IsPlayer(%1)            (1<=%1<=g_MaxClients)

RegisterHamHam_TakeDamage "player" "fw_HamTakeDamage" )

public 
fw_HamTakeDamageVictim Inflictor Attacker Float:fDamage BitDamage 
{
    if ( 
IsPlayerAttacker ) && ( get_user_weaponAttacker ) == CSW_KNIFE ) ) 
    {
        
//Victim hurt with knife
    
}



ieGaming 10-10-2009 22:51

Re: catch knife attack
 
What I think he means is that he wants the plugin to damage the victim if the attacker has a knife out. And right now its damaging with all weapons correct?

SnoW 10-11-2009 03:36

Re: catch knife attack
 
One means that he has an other plugin in his server which makes players able to damage other players by just touching them. Like this they can do damage by touching and just holding knife out. One doesn't want to get that damage but only the real damage done with knife.

One 10-11-2009 04:54

Re: catch knife attack
 
Quote:

Originally Posted by SnoW (Post 958317)
One means that he has an other plugin in his server which makes players able to damage other players by just touching them. Like this they can do damage by touching and just holding knife out. One doesn't want to get that damage but only the real damage done with knife.

:P perfect .
yea i just want to give em victim the damage as HP back. but the damage which players do with jumping or touching other users, is real & victim will take damage. only no knife damage.

( i dont want to disable the knife damage. because when you knife anyone, player can't walk anymore or will be slower. so i can't disable the knife damage but i can to give the damage which made by knife, back to the victim. ) i hope unterstand what i mean.

Jon 10-11-2009 05:05

Re: catch knife attack
 
PHP Code:


// Bugsy's code

#define IsPlayer(%1)            (1<=%1<=g_MaxClients)

RegisterHamHam_TakeDamage "player" "fw_HamTakeDamage" )

public 
fw_HamTakeDamageVictim Inflictor Attacker Float:fDamage BitDamage 
{
    if ( 
IsPlayerAttacker ) && ( cs_get_weapon_idInflictor ) == CSW_KNIFE ) ) 
    {
        
//Victim hurt with knife, NOT JUMPING
    
}



One 10-11-2009 05:18

Re: catch knife attack
 
Quote:

Originally Posted by Jon (Post 958360)
PHP Code:


// Bugsy's code

#define IsPlayer(%1)            (1<=%1<=g_MaxClients)

RegisterHamHam_TakeDamage "player" "fw_HamTakeDamage" )

public 
fw_HamTakeDamageVictim Inflictor Attacker Float:fDamage BitDamage 
{
    if ( 
IsPlayerAttacker ) && ( cs_get_weapon_idInflictor ) == CSW_KNIFE ) ) 
    {
        
//Victim hurt with knife
    
}



you wanna kidding me? oO i said i cant use this. i dont want to give a user hp back when the attacker made damage by jumping & not knife. oO


imaing : there is a mod, which strips all you'r weapon & you just get a knife. you can kill an enemey by jumping/touching the players. so you'r weapon which you have in you'r hand is KNIFE but you dont make damage with the knife. you just make the damage with jumping.
so now i want to disable knife's damage but the effect which a knife damage do ( slowdown when attacked ) must be there. you just get damage when knifed but after 0.00000000000x sec. you become the damage back & you can't die by knife damages. only jump or touch damage can kill you oO

Jon 10-11-2009 05:25

Re: catch knife attack
 
I'm not kidding you, if you look at the code I changed it. It checks if the weapon used was knife, so the statement will return false if the attacker damaged the victim by touching him.


All times are GMT -4. The time now is 22:43.

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