Raised This Month: $ Target: $400
 0% 

Doesn't take damage from the front


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ƒa†es™
Senior Member
Join Date: May 2009
Location: Garena
Old 05-20-2009 , 21:05   Doesn't take damage from the front
Reply With Quote #1

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. ?
__________________
ƒa†es™ is offline
el.nino
Junior Member
Join Date: Dec 2007
Old 05-20-2009 , 21:32   Re: Doesn't take damage from the front
Reply With Quote #2

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
el.nino is offline
ƒa†es™
Senior Member
Join Date: May 2009
Location: Garena
Old 05-20-2009 , 22:12   Re: Doesn't take damage from the front
Reply With Quote #3

I don't understand how to do it
__________________
ƒa†es™ is offline
ƒa†es™
Senior Member
Join Date: May 2009
Location: Garena
Old 05-21-2009 , 05:24   Re: Doesn't take damage from the front
Reply With Quote #4

Sorry for the double posting, I really need help from this
__________________
ƒa†es™ is offline
ehha
SourceMod Donor
Join Date: Apr 2006
Location: Sibiu
Old 05-21-2009 , 06:22   Re: Doesn't take damage from the front
Reply With Quote #5

Thanks el.nino, I need this too
ehha is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 05-21-2009 , 13:47   Re: Doesn't take damage from the front
Reply With Quote #6

Quote:
Originally Posted by el.nino View Post
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
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

__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
ƒa†es™
Senior Member
Join Date: May 2009
Location: Garena
Old 05-22-2009 , 01:44   Re: Doesn't take damage from the front
Reply With Quote #7

Quote:
Originally Posted by ot_207 View Post
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

If it can ignored the knockback it will be cool.

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

Last edited by ƒa†es™; 05-22-2009 at 01:54.
ƒa†es™ is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 05-22-2009 , 06:53   Re: Doesn't take damage from the front
Reply With Quote #8

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

__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 05-22-2009 , 08:09   Re: Doesn't take damage from the front
Reply With Quote #9

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. ;)
SnoW is offline
Send a message via MSN to SnoW
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-22-2009 , 09:47   Re: Doesn't take damage from the front
Reply With Quote #10

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;

__________________

Last edited by Bugsy; 05-22-2009 at 10:15.
Bugsy 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 03:20.


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