Hi all! Wanna create new plugin - for alert msg for user:
If user touch something - in air
PHP Code:
message_begin(MSG_ONE, get_user_msgid("Damage"), _, id);
and create red blocks 1 or 2 on that side which part of body touching
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 */
PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <engine>
#include <fakemeta>
public plugin_init()
{
RegisterHam(Ham_Touch, "player", "FwdPlayerTouch")
}
new Float:model_size[3];
public FwdPlayerTouch(id, ent)
{
entity_get_vector(id, EV_VEC_size, model_size);
if(!(pev(id, pev_flags) & FL_ONGROUND) && model_size[2] > 50.0 && is_user_alive(id))
{
new Float:origin[3]
entity_get_vector(id, EV_VEC_origin, origin)
new hull = (get_entity_flags(id) & FL_DUCKING) ? HULL_HEAD : HULL_HUMAN
new Float:temp_origin[3]
for(new i = 0; i < 4; i++)
{
temp_origin = origin
temp_origin[i / 2] += ((i % 2) ? -1.0 : 1.0)
temp_origin[2] += 22;
if(trace_hull(temp_origin, hull, id, 1))
{
take_damage(id, temp_origin)
break
}
}
}
}
stock take_damage(id, Float:origin[3])
{
new gorigin[3];
gorigin[0] = floatround(origin[0]);
gorigin[1] = floatround(origin[1]);
gorigin[2] = floatround(origin[2]);
message_begin(MSG_ONE, get_user_msgid("Damage"), _, id);
write_byte(1); // damage save
write_byte(1); // damage take
write_long(DMG_GENERIC); // example dmg - DMG_POISON
write_coord(gorigin[0]); // x
write_coord(gorigin[1]); // y
write_coord(gorigin[2]); // z // use this for show the messaj up i tink more up?
message_end();
}
now when i touch wall i get red blocks from 4 side. can some one help with this?