Raised This Month: $ Target: $400
 0% 

How to collect hitbox information?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
uros117
Junior Member
Join Date: Nov 2015
Old 11-28-2015 , 17:17   How to collect hitbox information?
Reply With Quote #1

Hello,
I am new to amx mod x but I have some programming experience with c, c# and java.
I had trouble with collecting information about where the bullet hit my player and how much damage it gave to me and send it over the serial port.
Can someone give me some examples or libraries?
Thanks a lot!

Last edited by uros117; 11-28-2015 at 17:17.
uros117 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-28-2015 , 18:59   Re: How to collect hitbox information?
Reply With Quote #2

Here's how to get the info. You can also determine the type of damage (bullet, grenade, drown, fire, etc) using the DamageBits bitsum.
PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>

public plugin_init() 
{
    
RegisterHamHam_TakeDamage "player" "TakeDamage" true );
}

public 
TakeDamageiVictim iInflictor iAttacker Float:fDamage DamageBits )
{
    static const 
m_iLastHitGroup 75;
    static const 
XO_Player 5;
    
    
//Total damage inflicted on victim. This is not the actual loss in hp of victim since this
    //damage value is reduced by armor that the victim may have.
    
client_printprint_chat "Damage inflicted = %d" floatroundfDamage ) );
    
    
//Actual damage taken by victim (loss in hp).
    
client_printprint_chat "Damage realized = %d" peviVictim pev_dmg_take ) );
    
    
//Body part that was hit.
    
switch ( get_pdata_intiVictim m_iLastHitGroup XO_Player ) )
    {
        case 
HIT_HEADclient_printprint_chat "Hit head" );
        case 
HIT_LEFTARMHIT_RIGHTARMclient_printprint_chat "Hit arm" );
        case 
HIT_CHESTclient_printprint_chat "Hit chest" );
        case 
HIT_STOMACHclient_printprint_chat "Hit stomach" );
        case 
HIT_LEFTLEGHIT_RIGHTLEGclient_printprint_chat "Hit leg" );
    }
    

__________________

Last edited by Bugsy; 11-28-2015 at 19:04.
Bugsy is offline
uros117
Junior Member
Join Date: Nov 2015
Old 11-29-2015 , 03:21   Re: How to collect hitbox information?
Reply With Quote #3

Thank you for fast and good reply it helped a lot but can I send that info to my c# or java program that will send that information to COM port.
Can I link programs using sql server or is there some better solution for this problem?
Thank you again, Uros.

Last edited by uros117; 11-29-2015 at 04:07.
uros117 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-29-2015 , 04:18   Re: How to collect hitbox information?
Reply With Quote #4

Quote:
Originally Posted by uros117 View Post
Thank you for fast and good reply it helped a lot but can I send that info to my c# or java program that will send that information to COM port.
Can I link programs using sql server or is there some better solution for this problem?
Thank you again, Uros.
MySQL is one method for collecting data from a game server which would then be accessible by any other program that is capable of accessing and communicating with the MySQL server.

Beyond that, you need to explain the "problem" so that we can give you an better answer.
__________________

Last edited by fysiks; 11-29-2015 at 04:23.
fysiks is offline
uros117
Junior Member
Join Date: Nov 2015
Old 11-29-2015 , 04:31   Re: How to collect hitbox information?
Reply With Quote #5

Quote:
Beyond that, you need to explain the "problem" so that we can give you an better answer.
I want to send info to microcontroller over serial communication port when my player hit in game so I can activate some electronics to interact with the player of the game.
Regards, Uros.

Last edited by uros117; 11-29-2015 at 04:33.
uros117 is offline
uros117
Junior Member
Join Date: Nov 2015
Old 11-29-2015 , 13:53   Re: How to collect hitbox information?
Reply With Quote #6

I found the solution.
You can use sockets to send info to c# TCPClient and convert it to string and then send specific commands to the microcontroller over serial communication port.
Thank you Bugsy and fysiks for helping me.
uros117 is offline
Reply


Thread Tools
Display Modes

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 17:53.


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