Move Object with a function
#1

Hey, guys!
In my lil' GM is a plane which shall start and fly. I let the plane move on the X- and Z-coordinate with two functions (they're mathematic correctly). But only the X-coordinate change, not the Z-coordinate. Does anybidy know why?
Here's the code:
Код:
#include<a_samp>
#include<a_objects>
main(){
	print("\n----------------------------------");
	print("Gamemode by Marc_307");
	print("----------------------------------\n");
}
new Float:x;
new plane;
forward Plane();
public OnGameModeInit(){
	SetGameModeText("myScript");
	SetTimer("Plane",40,1);
	AddPlayerClass(0,5078.248047,-2578.241455,4.679042,269.1425,0,0,0,0,0,0);
	CreateObject(4866,5078.248047,-2578.241455,4.679042,0.0000,0.0000,0.0000);
	CreateObject(3814,4961.949707,-2619.125732,11.144671,0.0000,0.0000,90.0000);
	CreateObject(3814,4949.348145,-2619.131348,11.159706,0.0000,0.0000,90.0000);
	plane=CreateObject(1683,4951.471680,-2620.470703,10.581669,0.0000,0.0000,0.0000);
	return 1;
}
public Plane(){
	new Float:X=1464151/312500*x*x+15473349/3125;//f(x)=4.6852832xІ+4951.47168
	new Float:Z=89375019/100000000*x*x+10581669/1000000;//f(x)=0.89375019xІ+10.581669
	SetObjectPos(plane,X,-2620.470703,Z);
	x+=0.025;
	if(x>10)x=0;
	return 1;
}
public OnPlayerRequestClass(playerid,classid){
	SetPlayerPos(playerid,1958.3783,1343.1572,15.3746);
	SetPlayerCameraPos(playerid,1958.3783,1343.1572,15.3746);
	SetPlayerCameraLookAt(playerid,1958.3783,1343.1572,15.3746);
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)