AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Doesn't take damage from the front (https://forums.alliedmods.net/showthread.php?t=92845)

ƒa†es™ 05-20-2009 21:05

Doesn't take damage from the front
 
Is it possible to make a plugin that block damage from the front which means. when player shoot his enemy the enemy doesn't take damage from the front it take damage only at the back. ?

el.nino 05-20-2009 21:32

Re: Doesn't take damage from the front
 
http://forums.alliedmods.net/showthr...ight=back+shot
This can help you. Don't forget you are in scripting help and not in suggest or request section :D

ƒa†es™ 05-20-2009 22:12

Re: Doesn't take damage from the front
 
I don't understand how to do it

ƒa†es™ 05-21-2009 05:24

Re: Doesn't take damage from the front
 
Sorry for the double posting, I really need help from this

ehha 05-21-2009 06:22

Re: Doesn't take damage from the front
 
Thanks el.nino, I need this too :)

ot_207 05-21-2009 13:47

Re: Doesn't take damage from the front
 
Quote:

Originally Posted by el.nino (Post 831403)
http://forums.alliedmods.net/showthr...ight=back+shot
This can help you. Don't forget you are in scripting help and not in suggest or request section :D

That is not a good example.

Here is how I would do it. (NOT TESTED! It may be needed to add more lines)
PHP Code:

#include <amxmodx>
#include <engine>
#include <hamsandwich>

public plugin_init()
{
    
RegisterHam(Ham_TakeDamage"player""fw_takedamage")
}

public 
fw_takedamage(victiminfilctorattackerFloat:damagebits)
{
    static 
Float:origin[3]
    
entity_get_vector(infilctorEV_VEC_originorigin)
    if (
is_in_viewcone(victimorigin1))
    {
        
// HIT FROM FRONT
        
return HAM_SUPERCEDE
    
}

    return 
HAM_IGNORED



ƒa†es™ 05-22-2009 01:44

Re: Doesn't take damage from the front
 
Quote:

Originally Posted by ot_207 (Post 831803)
That is not a good example.

Here is how I would do it. (NOT TESTED! It may be needed to add more lines)
PHP Code:

#include <amxmodx>
#include <engine>
#include <hamsandwich>
 
public plugin_init()
{
    
RegisterHam(Ham_TakeDamage"player""fw_takedamage")
}
 
public 
fw_takedamage(victiminfilctorattackerFloat:damagebits)
{
    static 
Float:origin[3]
    
entity_get_vector(infilctorEV_VEC_originorigin)
    if (
is_in_viewcone(victimorigin1))
    {
        
// HIT FROM FRONT
        
return HAM_SUPERCEDE
    
}
 
    return 
HAM_IGNORED




Thanks so much :up:

If it can ignored the knockback it will be cool.

Problem 1 : Could you set it will take damage from any other Grenade.

ot_207 05-22-2009 06:53

Re: Doesn't take damage from the front
 
PHP Code:

#include <amxmodx>
#include <engine>
#include <hamsandwich>

public plugin_init()
{
    
RegisterHam(Ham_TakeDamage"player""fw_takedamage")
}

public 
fw_takedamage(victiminfilctorattackerFloat:damagebits)
{
    static 
Float:origin[3]
    
entity_get_vector(infilctorEV_VEC_originorigin)
    if (
is_in_viewcone(victimorigin1) && inflictor == attacker)
    {
        
// HIT FROM FRONT
        
return HAM_SUPERCEDE
    
}

    return 
HAM_IGNORED



SnoW 05-22-2009 08:09

Re: Doesn't take damage from the front
 
You have to be careful with the word inflictor. Also if you want to improve little, first check if inflictor is attacker and after that get origin and viewcone. ;)

Bugsy 05-22-2009 09:47

Re: Doesn't take damage from the front
 
I would not use inflictor at all in this case.

PHP Code:

RegisterHamHam_TakeDamage "player" "fw_HamTakeDamage" 

public 
fw_HamTakeDamageiVictim iInflictor iAttacker Float:fDamage iBitDamage )
{
    if ( ( 
iVictim == iAttacker ) || !iAttacker 
        return 
HAM_IGNORED;
        
    static 
FloatfAttackerOrigin[3]
    
entity_get_vectoriAttacker EV_VEC_origin fAttackerOrigin )
    
    return 
is_in_viewconeiVictim fAttackerOrigin ) ? HAM_SUPERCEDE HAM_IGNORED;




All times are GMT -4. The time now is 01:32.

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