Okay, well I tested out my prethink method, and I can go forwards or backwards in the air, but I can't seem to move left or right. I was wondering if there was something wrong with my coding and also if I push any other buttons like the attack button, I just stand still could someone help me out on this:
Code:
public client_PreThink(id)
{
new Float:maxSpeed = 1000
new Float:fVelocity[3], Float:v_angles[3]
new flag = entity_get_int(id, EV_INT_flags)
if(isFlyModeEnabled && is_user_alive(id)){
if(!(flag & FL_ONGROUND)){
if(get_user_button(id) == IN_FORWARD){
velocity_by_aim(id, maxSpeed, fVelocity)
entity_set_vector(id, EV_VEC_velocity, fVelocity)
}
else if(get_user_button(id) == IN_BACK){
velocity_by_aim(id, maxSpeed, fVelocity)
fVelocity[0] -= fVelocity[0]*2.0
fVelocity[1] -= fVelocity[1]*2.0
fVelocity[2] -= fVelocity[2]*2.0
entity_set_vector(id, EV_VEC_velocity, fVelocity)
}
else if(get_user_oldbutton(id) == IN_FORWARD && get_user_button(id) == IN_ATTACK){
velocity_by_aim(id, maxSpeed, fVelocity)
entity_set_vector(id, EV_VEC_velocity, fVelocity)
}
else if(get_user_oldbutton(id) == IN_FORWARD && get_user_button(id) == IN_ATTACK2){
velocity_by_aim(id, maxSpeed, fVelocity)
entity_set_vector(id, EV_VEC_velocity, fVelocity)
}
else if(get_user_oldbutton(id) == IN_BACK && get_user_button(id) == IN_ATTACK){
velocity_by_aim(id, maxSpeed, fVelocity)
fVelocity[0] -= fVelocity[0]*2.0
fVelocity[1] -= fVelocity[1]*2.0
fVelocity[2] -= fVelocity[2]*2.0
entity_set_vector(id, EV_VEC_velocity, fVelocity)
}
else if(get_user_oldbutton(id) == IN_BACK && get_user_button(id) == IN_ATTACK2){
velocity_by_aim(id, maxSpeed, fVelocity)
fVelocity[0] -= fVelocity[0]*2.0
fVelocity[1] -= fVelocity[1]*2.0
fVelocity[2] -= fVelocity[2]*2.0
entity_set_vector(id, EV_VEC_velocity, fVelocity)
}
else if(get_user_button(id) == IN_MOVELEFT){
entity_get_vector(id, EV_VEC_v_angle, v_angles)
v_angles[0] += 90.0
v_angles[1] += 90.0
fVelocity[0] = floatcos(v_angles[1], degrees) * maxSpeed
fVelocity[1] = floatsin(v_angles[1], degrees) * maxSpeed
fVelocity[2] = floatsin(-v_angles[0], degrees) * maxSpeed
entity_set_vector(id, EV_VEC_velocity, fVelocity)
}
else if(get_user_button(id) == IN_MOVERIGHT){
entity_get_vector(id, EV_VEC_v_angle, v_angles)
v_angles[0] += 270.0
v_angles[1] += 270.0
fVelocity[0] = floatcos(v_angles[1], degrees) * maxSpeed
fVelocity[1] = floatsin(v_angles[1], degrees) * maxSpeed
fVelocity[2] = floatsin(-v_angles[0], degrees) * maxSpeed
entity_set_vector(id, EV_VEC_velocity, fVelocity)
}
else{
fVelocity[0] = 0.0
fVelocity[1] = 0.0
fVelocity[2] = 1.0
entity_set_vector(id, EV_VEC_velocity, fVelocity)
}
}
}
}