Quote:
Originally Posted by ConnorMcLeod
Why do you want to detect that ?
|
I'm doing something like l4d's charger infected. The only thing that I want to do is to catch when while charging he touches a wall for stopping his speed boost.
Another good way that I was thinking is to detect if something is in front of him... but this didn't worked at all:
PHP Code:
register_touch("player", "*", "fw_Player_Touch")
public fw_Player_Touch(iId, iOther)
{
if(g_bIsAlive[iId] && g_bBoostActivated[iId] && !IsAlive(iOther))
{
// debug print added here, it's called correctly.
static Float:vecOrigin[3], Float:vecDirection[3]
entity_get_vector(iId, EV_VEC_origin, vecOrigin)
velocity_by_aim(iId, 16, vecDirection) // a little bit ahead him
xs_vec_add(vecOrigin, vecDirection, vecOrigin)
engfunc(EngFunc_TraceHull, vecOrigin, vecOrigin, 0, HULL_HUMAN /* or HULL_HEAD? */, iId, 0)
if(get_tr2(0, TR_StartSolid) || get_tr2(0, TR_AllSolid) || !get_tr2(0, TR_InOpen))
{
// Disabling...
}
}
}
__________________