Hi everyone. Iv'e got some problems with my 3dgs game.
When i lift up my arm, everything is OK like this image:



But when i'am rotating the arm, it goes going wrong like this:



The Angle of the PAN rotating is not correct anymore, it only works when the arm tilt is at 0.

Does someone know how i can fix this?

Code:
function gondelarm()
{
	gondelarm_1 = me;
	ent_create("Gondel.mdl",me,Gondel1);
	ent_create("Gondel.mdl",me,Gondel2);
	ent_create("Gondel.mdl",me,Gondel3);
	
	while(1){
		wait(1);
		vec_for_vertex(me.x, tussenarm_1, 122);
		
		my.tilt = tangoarm_1.roll;
						
		if (key_q){ gondelarmsnelheid += 0.005; tegen = 1; mee = 0;}
		if (key_a){ gondelarmsnelheid -= 0.005; mee = 1; tegen = 0;}
		my.pan += gondelarmsnelheid;
		if(tegen == 1 && gondelarmsnelheid >= 1.8){ gondelarmsnelheid = 1.8; }
		if(tegen == 1 && gondelarmsnelheid == 0){ gondelarmsnelheid = 0; }
		if(mee == 1 && gondelarmsnelheid <= -1.8){ gondelarmsnelheid = -1.8; }
		if(mee == 1 && gondelarmsnelheid == 0){ gondelarmsnelheid = 0; }
	}
}

action tangoarm()
{
	tangoarm_1 = me;
	ent_create("GondolArm.mdl", NULL, gondelarm);
	ent_create("TussenArm.mdl", NULL, tussenarm);

	while(1){
		
		if (key_s){ liftarmsnelheid += 0.002; tegen = 1; mee = 0;}
		if (key_w){ liftarmsnelheid -= 0.002; mee = 1; tegen = 0;}
		my.roll += liftarmsnelheid;
		if(tegen == 1 && liftarmsnelheid >= 1.8){ liftarmsnelheid = 1.8; }
		if(tegen == 1 && liftarmsnelheid == 0){ liftarmsnelheid = 0; }
		if(mee == 1 && liftarmsnelheid <= -1.8){ liftarmsnelheid = -1.8; }
		if(mee == 1 && liftarmsnelheid == 0){ liftarmsnelheid = 0; }
		
		wait(1);
	}
}


Some lines out of my codes.
Someone can help me please to fix this? Thanks !