i have a car(taxi)and write these code:

function players_car()
{
player = my;
phent_settype (my, ph_rigid, ph_box);
phent_setmass (my, 200, ph_box);
phent_setgroup (my, 2); // set the id of the car
phent_setfriction (my, 20); // set the friction coefficient
phent_setdamping (my, 20, 30); // set the velocity damping (linear = 20, angular = 30)
phent_setelasticity (my, 30, 10); // set the bounciness factor
ent_create(tyreleft_mdl, vector(my.x - 65, my.y - 70, my.z - 45), cars_tyre3 ); // create the rear left wheel
ent_create(tyreright_mdl, vector(my.x - 65, my.y + 70, my.z - 45), cars_tyre1 ); // create the rear right wheel//FRONT
ent_create(tyreleft_mdl, vector(my.x + 65, my.y - 70, my.z - 45), cars_tyre2 ); // create the front left wheel
ent_create(tyreright_mdl, vector(my.x + 65, my.y + 70, my.z - 45), cars_tyre0 ); // create the front right wheel//FRONT
}

function cars_tyre0()
{
INDEX=0;
phent_settype (my, ph_rigid, ph_sphere); // the wheels have a rigid body and behave like spheres
phent_setmass (my, 10, ph_sphere); // they've got 10 kilograms each (~22 pounds)
phent_setgroup (my, 2); // set the id for the wheels
phent_setfriction (my, 60); // set the friction coefficient
phent_setdamping (my, 40, 5); // and the damping factor
phent_setelasticity (my, 30, 10); // set the bounciness
joints[index] = phcon_add (PH_WHEEL, player, my); // bind the wheel to the player (the car), returns the identifier of the constraint
// set the anchor point for the hinge to the origin of the wheel model and the hinge axis to y (0, 1, 0)
phcon_setparams1 (joints[index], my.x, vector(0, 0, 1), vector(0, 1, 0));
// allowed angles for the joint (-360, 360, 0) sets no limits
phcon_setparams2 (joints[index], vector(-40, 40, 0), nullvector, nullvector);

}


function cars_tyre1()
{
INDEX=1;
phent_settype (my, ph_rigid, ph_sphere); // the wheels have a rigid body and behave like spheres
phent_setmass (my, 10, ph_sphere); // they've got 10 kilograms each (~22 pounds)
phent_setgroup (my, 2); // set the id for the wheels
phent_setfriction (my, 60); // set the friction coefficient
phent_setdamping (my, 40, 5); // and the damping factor
phent_setelasticity (my, 30, 10); // set the bounciness
joints[index] = phcon_add (PH_WHEEL, player, my); // bind the wheel to the player (the car), returns the identifier of the constraint
// set the anchor point for the hinge to the origin of the wheel model and the hinge axis to y (0, 1, 0)
phcon_setparams1 (joints[index], my.x, vector(0, 0, 1), vector(0, 1, 0));
// allowed angles for the joint (-360, 360, 0) sets no limits
phcon_setparams2 (joints[index],nullvector , nullvector, nullvector);

}

players_car() for body of car and cars_tyre1()for rear whells and cars_tyre0() for front whells.

in main function i have these code:

somecode
ph_setgravity (vector(0, 0, -386));
//ph_setgravity (vector(0, 0, 0));
ent_create (car_mdl, vector(0, 0, 500), players_car);
while(player == null) {wait(1);}

while (1)
{
motor = 0;
angle = 0;

if(key_w == on)
{
motor = -200;
}
if(key_s == on)
{
motor = 200;
}
if(key_a == on)
{
angle = -20;
}
if(key_d == on)
{
angle = 20; left side of the car
}
phcon_setmotor (joints[0], vector(angle, 90, 0), nullvector, nullvector); //for front
phcon_setmotor (joints[2], vector(angle, 90, 0), nullvector, nullvector); //for front
phcon_setmotor (joints[1], nullvector, vector(motor, 900, 0), nullvector);//for rear whell
phcon_setmotor (joints[3], nullvector, vector(motor, 900, 0), nullvector);//for rear whell

wait (1);
}

this code work but not good for example sometimes rear whells not fixed and give angle and moving car not correct.
can any body tell me why?and how can i fixed it