Hello, can anyone help me to change player's aim? If I'm looking to player and press 'Attack' button his aim should rotate and rotate by += 1.0 while I'm holding that button. Idk how it should be done.
There is my attempt (with angle)
PHP Code:
public Fwd_CmdStart(id, Cmd)
{
if (!is_user_alive(id))
return FMRES_IGNORED
static Buttons, ButtonsChanged, ButtonPressed, ButtonReleased
Buttons = get_uc(Cmd, UC_Buttons)
ButtonsChanged = get_pdata_int(id, 245) ^ Buttons
ButtonPressed = ButtonsChanged & Buttons
ButtonReleased = ButtonsChanged & ~Buttons
if (ButtonPressed & IN_ATTACK)
{
new Target, Body
get_user_aiming(id, Target, Body)
static Float: Angle[3]
entity_get_vector(Target, EV_VEC_angles, Angle)
if (Angle[1] < 180.0)
{
Angle[1] += 1.0
entity_set_vector(id, EV_VEC_angles, Angle)
//client_print(id, print_center, "[Angle: %f %f %f]", Angle[0], Angle[1], Angle[2])
}
}
return FMRES_IGNORED
}