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

[ES][TUT] Daño en hitzones.


  
 
 
Thread Tools Display Modes
Author Message
fezh
Veteran Member
Join Date: Dec 2008
Location: BANNED
Old 05-26-2010 , 17:43   [ES][TUT] Daño en hitzones.
#1

La primera forma es para detectar un headshot usando DeathMsg (obviamente esto no es para detectar daño ya que el usuario ya está muerto por lo que lo haría inútil en este sentido):
PHP Code:
#include <amxmodx>

public plugin_init( )
{
    
register_plugin"Hitzones Test""1.0.0""Shupiro" );
    
    
register_event"DeathMsg""Event_DeathMsg""a" );
}

public 
Event_DeathMsg( )
{
    if ( 
read_data) )
    {
        
// Es headshot.
        // Sin embargo pueden filtrar directamente el headshot
        // en el evento en lugar de chequearlo a posteriori.
        // register_event( "DeathMsg" , "Event_DeathMsg" , "a" , "3=1" );
    
}

La segunda forma sirve para detectar daño en distintas hitzones:
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

const OFFSET_LAST_HIT_GROUP 75;
const 
XTRA_LINUX_OFFS 5;

public 
plugin_init( )
{
    
register_plugin"Hitzones Test""1.0.0""Shupiro" );
    
    
RegisterHamHam_TakeDamage"player""Fwd_TakeDamage_Pre");
}

public 
Fwd_TakeDamage_PreiVictim )
{
    if ( 
get_pdata_intiVictimOFFSET_LAST_HIT_GROUPXTRA_LINUX_OFFS ) == HIT_HEAD )
    {
        
// Daño en la cabeza.
    
}

Hitzones disponibles:
Quote:
Originally Posted by amxconst.inc
/* Parts of body for hits */
#define HIT_GENERIC 0 /* none */
#define HIT_HEAD 1
#define HIT_CHEST 2
#define HIT_STOMACH 3
#define HIT_LEFTARM 4
#define HIT_RIGHTARM 5
#define HIT_LEFTLEG 6
#define HIT_RIGHTLEG 7
__________________
"There is no knowledge, that is not power"

Last edited by fezh; 05-27-2010 at 11:31.
fezh is offline
capostrike93
Veteran Member
Join Date: Feb 2009
Location: adios y??
Old 05-26-2010 , 23:32   Re: [ES][TUT] Daño en hitzones.
#2

bien, pero no tiene sentido el macro IsValidHitzone, simplemente deveria ser:

PHP Code:
public Fwd_TakeDamage_PreiVictim )
{
    if ( 
get_pdata_intiVictimOFFSET_LAST_HIT_GROUPXTRA_LINUX_OFFS ) == HIT_HEAD )
    {
        
// Daño en la cabeza.
    
}

__________________
capostrike93 is offline
S34Qu4K3
Veteran Member
Join Date: Jan 2010
Location: Galicia
Old 05-27-2010 , 10:34   Re: [ES][TUT] Daño en hitzones.
#3

Gracias fezh, me es muy util
__________________

- ASM2SMA: Experimental AMXX Assembly encoder

- Defuse Bar Fix

Quote:
Originally Posted by Arkshine
I DON'T WANT TO SEE NOOOOOOOOOOOOOOO AHHHHH. MY EYES ARE ALREADY HURT.
S34Qu4K3 is offline
Rukia
BANNED
Join Date: May 2010
Old 05-27-2010 , 11:00   Re: [ES][TUT] Daño en hitzones.
#4

gracias fish
Rukia is offline
frk_14
Senior Member
Join Date: Jan 2009
Location: Argentina
Old 05-27-2010 , 17:20   Re: [ES][TUT] Daño en hitzones.
#5

Es posible hacer andar las hitzones en una entidad que no sea "player"??
frk_14 is offline
Send a message via MSN to frk_14 Send a message via Skype™ to frk_14
apuu
BANNED
Join Date: Oct 2009
Location: Argentina
Old 05-27-2010 , 18:52   Re: [ES][TUT] Daño en hitzones.
#6

si esa entidad no es un npc si.

edito: me exprese mal mira tenes que crear un fakeplayer, es decir, al npc darle la func fakeplayer

Last edited by apuu; 05-27-2010 at 18:55.
apuu is offline
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viña del Mar, Chile
Old 05-27-2010 , 19:26   Re: [ES][TUT] Daño en hitzones.
#7

Creo que la 8 es HIT_SHIELD, y no esta definido en amxconst.inc.
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
apuu
BANNED
Join Date: Oct 2009
Location: Argentina
Old 05-27-2010 , 19:38   Re: [ES][TUT] Daño en hitzones.
#8

Quote:
Originally Posted by meTaLiCroSS View Post
Creo que la 8 es HIT_SHIELD, y no esta definido en amxconst.inc.
y como obtengo el la zona? por otro modulo ?
apuu is offline
frk_14
Senior Member
Join Date: Jan 2009
Location: Argentina
Old 05-27-2010 , 22:11   Re: [ES][TUT] Daño en hitzones.
#9

Quote:
Originally Posted by apuu View Post
si esa entidad no es un npc si.

edito: me exprese mal mira tenes que crear un fakeplayer, es decir, al npc darle la func fakeplayer
fake player o fake client?
ocupan slots en el server?
frk_14 is offline
Send a message via MSN to frk_14 Send a message via Skype™ to frk_14
apuu
BANNED
Join Date: Oct 2009
Location: Argentina
Old 05-27-2010 , 22:13   Re: [ES][TUT] Daño en hitzones.
#10

se XD bueno no me acordaba si era fakeplayer o client, si ocupa 1 slot
apuu is offline
 



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 12:12.


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