Alright the part if it's an object is probably solved. I get victim IDs of 300+, so basically if victim id is higher than 32 it should be an object.
This script prints info if you press attack button while aiming at something. (You can also use a melee weapon from far away to get the info without damaging the target.)
Code:
#include <amxmodx>
#include <engine>
#include <tfcconst>
public plugin_init()
{
register_plugin("TFC Object", "0.1", "pizzahut")
}
public plugin_modules()
{
require_module("engine")
require_module("tfcx")
}
public client_PreThink(id)
{
new is_attack, was_attack
is_attack = entity_get_int(id, EV_INT_button) & IN_ATTACK
was_attack = entity_get_int(id, EV_INT_oldbuttons) & IN_ATTACK
if (is_attack && !was_attack)
{
new victim, bodypart
new Float:distance = get_user_aiming(id, victim, bodypart)
new clip, ammo
new weapon = get_user_weapon(id,clip,ammo)
client_print(id, print_chat, "id=%d | distance=%f victim=%d bodypart=%d | weapon=%d clip=%d ammo=%d^n", id, distance, victim, bodypart, weapon, clip, ammo)
}
return PLUGIN_CONTINUE
}
So what is left, is to find out if the object belongs to the own team.
And ideally, find out if the attack destroys the object.