Raised This Month: $ Target: $400
 0% 

No Headshot


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Debesėlis
Senior Member
Join Date: Aug 2008
Location: Lithuania
Old 06-10-2009 , 05:46   No Headshot
Reply With Quote #1

How do I make this menu function make you immune to headshots.

PHP Code:
public hs(id)
{
    if(
headshot_active[id] == 1)
    {

//no headshot code...

    
}

I want something simmilar to:
http://forums.alliedmods.net/showthread.php?p=489668

But I don't want to use VESTHELM. After activating the menu function others couldn't do headshots on you.
Debesėlis is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-10-2009 , 05:59   Re: No Headshot
Reply With Quote #2

Something like :

Code:
    #include <amxmodx>     #include <fakemeta>     #include <hamsandwich>         const m_LastHitGroup = 75;     public plugin_init ()     {         RegisterHam( Ham_TakeDamage, "player", "Event_PlayerTakeDamage" );     }         public Event_PlayerTakeDamage ( const Victim )     {         return headshot_active[ Victim ] && get_pdata_int( Victim, m_LastHitGroup ) == HIT_HEAD ? : HAM_SUPERCEDE : HAM_IGNORED;     }
__________________
Arkshine is offline
Debesėlis
Senior Member
Join Date: Aug 2008
Location: Lithuania
Old 06-10-2009 , 06:53   Re: No Headshot
Reply With Quote #3

doesn't work
Debesėlis is offline
Atspulgs
Senior Member
Join Date: Mar 2008
Old 06-10-2009 , 08:35   Re: No Headshot
Reply With Quote #4

heh i once did something similar only for a hero.
i did this
PHP Code:
/* Sets hit zones for player.
 * Parts of body are as bits:
 * 1   - generic
 * 2   - head
 * 4   - chest
 * 8   - stomach
 * 16  - left arm
 * 32  - right arm
 * 64  - left leg
 * 128 - right leg */
native set_user_hitzones(index 0target 0body 255);

/* Get user hitzones. */
native get_user_hitzones(indextarget); 
this you may found in fun.inc
those are syntaxes, and not my code (just to make clear)
__________________
-=DG Ats
DoomedGang web page -
http://www.doomedgang.com
Atspulgs is offline
Debesėlis
Senior Member
Join Date: Aug 2008
Location: Lithuania
Old 06-10-2009 , 08:49   Re: No Headshot
Reply With Quote #5

Quote:
Originally Posted by Atspulgs View Post
heh i once did something similar only for a hero.
i did this
PHP Code:
/* Sets hit zones for player.
 * Parts of body are as bits:
 * 1   - generic
 * 2   - head
 * 4   - chest
 * 8   - stomach
 * 16  - left arm
 * 32  - right arm
 * 64  - left leg
 * 128 - right leg */
native set_user_hitzones(index 0target 0body 255);

/* Get user hitzones. */
native get_user_hitzones(indextarget); 
this you may found in fun.inc
those are syntaxes, and not my code (just to make clear)

PHP Code:
public hs(id)
{
    if(
headshot_active[id] == 1)
    {
         
native set_user_hitzones(index 0target 0body 255);
         
native get_user_hitzones(indextarget);

    }

as it should appear?
Debesėlis is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-10-2009 , 10:24   Re: No Headshot
Reply With Quote #6

My code works perfectly. I tested before posting. It doesn't compile because I've added headshot_active[ Victim ] to show you the way, that's all.
__________________
Arkshine is offline
Debesėlis
Senior Member
Join Date: Aug 2008
Location: Lithuania
Old 06-10-2009 , 12:44   Re: No Headshot
Reply With Quote #7

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
    
const m_LastHitGroup 75;

public 
hs(id, const Victim)
{
    if(
headshot_active[id] == 1)
    {

        return 
headshot_active[Victim] && get_pdata_int(Victimm_LastHitGroup) == HIT_HEAD ? : HAM_SUPERCEDE HAM_IGNORED;

    }

I tried to put it together, but I didn't manage to.
Debesėlis is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-10-2009 , 12:48   Re: No Headshot
Reply With Quote #8

arkshine had it formatted correctly.

Are you setting the headshot_active array element to 1\true for the player that you want to be immune to headshots?

Edit: Fixed typo in return line

return headshot_active[ Victim ] && get_pdata_int( Victim, m_LastHitGroup ) == HIT_HEAD ? [->] : [<-] HAM_SUPERCEDE : HAM_IGNORED;

PHP Code:

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

new headshot_active33 ];
const 
m_LastHitGroup 75;

public 
plugin_init ()
{
    
RegisterHamHam_TakeDamage"player""Event_PlayerTakeDamage" );
    
    
register_concmd"amx_blockhs" "cmdBlockHS" );
}

public 
cmdBlockHSid )
{
    
headshot_activeid ] = 1;
}

public 
Event_PlayerTakeDamage ( const Victim )

    return ( 
headshot_activeVictim ] && ( get_pdata_intVictimm_LastHitGroup ) == HIT_HEAD  ) ) ? HAM_SUPERCEDE HAM_IGNORED;

__________________

Last edited by Bugsy; 06-10-2009 at 13:15.
Bugsy is offline
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 06-10-2009 , 12:51   Re: No Headshot
Reply With Quote #9

PHP Code:

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

const m_LastHitGroup 75;
new 
cvarHeadshot

public plugin_init ()
{
    
RegisterHamHam_TakeDamage"player""Event_PlayerTakeDamage" );
    
    
cvarHeadshot register_cvar("headshot","1")
}

public 
Event_PlayerTakeDamage ( const Victim )

    return 
get_pcvar_numcvarHeadshot ) && ( get_pdata_intVictimm_LastHitGroup ) == HIT_HEAD ) ? HAM_SUPERCEDE HAM_IGNORED;

It's arkshine code. You will also need to take care of the blood.
__________________

Last edited by joaquimandrade; 06-10-2009 at 12:55.
joaquimandrade is offline
Debesėlis
Senior Member
Join Date: Aug 2008
Location: Lithuania
Old 06-10-2009 , 12:55   Re: No Headshot
Reply With Quote #10

Quote:
Originally Posted by Bugsy View Post
arkshine had it formatted correctly.

Are you setting the headshot_active array element to 1\true for the player that you want to be immune to headshots?

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

new headshot_active33 ];
const 
m_LastHitGroup 75;

public 
plugin_init ()
{
    
RegisterHamHam_TakeDamage"player""Event_PlayerTakeDamage" );
    
register_concmd"amx_blockhs" "cmdBlockHS" );
}

public 
cmdBlockHSid )
{
    
headshot_activeid ] = 1;
}

public 
Event_PlayerTakeDamage ( const Victim )

    return 
headshot_activeVictim ] && get_pdata_intVictimm_LastHitGroup ) == HIT_HEAD ? : HAM_SUPERCEDE HAM_IGNORED;


I have an admin menu. I want players who activate the headshot immunity function to be immune to headshots.
Debesėlis 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 13:59.


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