AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to collect hitbox information? (https://forums.alliedmods.net/showthread.php?t=275389)

uros117 11-28-2015 17:17

How to collect hitbox information?
 
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!

Bugsy 11-28-2015 18:59

Re: How to collect hitbox information?
 
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" );
    }
    



uros117 11-29-2015 03:21

Re: How to collect hitbox information?
 
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.

fysiks 11-29-2015 04:18

Re: How to collect hitbox information?
 
Quote:

Originally Posted by uros117 (Post 2367324)
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.

uros117 11-29-2015 04:31

Re: How to collect hitbox information?
 
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.

uros117 11-29-2015 13:53

Re: How to collect hitbox information?
 
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.:)


All times are GMT -4. The time now is 17:53.

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