Well see, I am making a carmod, and when a user is in a car he cannot strafe left or right. Seems as if when users aren't in a car, they can run backwards and forwards normally, but when the stafe left and right, they do it at a walking speed.
Seems as if even if they disconnect, it affects them on other servers also. I don't want this to be the case.
Code:
Code:
// To stop user Buttons
public client_PreThink(id)
{
if(incar[id])
{
new bufferstop = entity_get_int(id,EV_INT_button);
if((bufferstop & IN_MOVELEFT) || (bufferstop & IN_MOVERIGHT) || (bufferstop & IN_ATTACK) || (bufferstop & IN_ATTACK2)) {
//entity_set_int(id,EV_INT_button,entity_get_int(id,EV_INT_button) & ~IN_JUMP); (Dosen't seem to work)
entity_set_int(id,EV_INT_button,IN_CANCEL);
}
/*
#define IN_ATTACK (1<<0)
#define IN_JUMP (1<<1)
#define IN_DUCK (1<<2)
#define IN_FORWARD (1<<3)
#define IN_BACK (1<<4)
#define IN_USE (1<<5)
#define IN_CANCEL (1<<6)
#define IN_LEFT (1<<7)
#define IN_RIGHT (1<<8)
#define IN_MOVELEFT (1<<9)
#define IN_MOVERIGHT (1<<10)
#define IN_ATTACK2 (1<<11)
#define IN_RUN (1<<12)
#define IN_RELOAD (1<<13)
#define IN_ALT1 (1<<14)
#define IN_SCORE (1<<15)
*/
if(bufferstop & IN_FORWARD) {
// This part by Charr (Batman / Gorlag's Vec By Aim)
new Float:VecVel[3],Float:VecAngles[3];
entity_get_vector(id,EV_VEC_velocity,VecVel);
entity_get_vector(id,EV_VEC_v_angle,VecAngles);
VecVel[0] = floatcos(VecAngles[1],degrees) * float(carspeed[id]);
VecVel[1] = floatsin(VecAngles[1],degrees) * float(carspeed[id]);
entity_set_vector(id,EV_VEC_velocity,VecVel);
}
if(bufferstop & IN_BACK) {
// This part by Charr (Batman / Gorlag's Vec By Aim)
new Float:VecVel[3],Float:VecAngles[3];
entity_get_vector(id,EV_VEC_velocity,VecVel);
entity_get_vector(id,EV_VEC_v_angle,VecAngles);
VecVel[0] = floatcos(VecAngles[1],degrees) / ( float(carspeed[id]) / 2 );
VecVel[1] = floatsin(VecAngles[1],degrees) / ( float(carspeed[id]) / 2 );
entity_set_vector(id,EV_VEC_velocity,VecVel);
}
return PLUGIN_CONTINUE;
}
return PLUGIN_CONTINUE;
}
__________________