floatsin, floatcos
#5

these functions are useful for creating a circle. if you want a circle of cars at dry lake, then try this:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
//... start pasting the command from here
	if (strcmp("/CarsDryLake", cmdtext, true) == 0)
	{
		new Float:X,Float:Y,Float:Z;
		GetPlayerPos(playerid,X,Y,Z);
		for(new i = 0; i<360; i+=5)
		{
			new Float:CX,Float:CY,Float:CZ,Float:CA;
			X=5.3426;
			Y=1521.4684;
			Z=12.7500;
			CX=X+(40*floatsin(i,degrees));
			CY=Y+(40*floatcos(i,degrees));
			CZ=Z;
			CA=(-i+180)%360;
			CreateVehicle(412,CX,CY,CZ,CA,-1,-1,10);
		}
		SendClientMessage(playerid,0xafafff77,"Vehicle(s) spawned.");
		return 1;
	}
//... until here
}
X=5.3426 Y=1521.4684 Z=12.7500 << these are the coordinates at drylake. the "basis" position, its the middle point,
40*floatsin << the 40 is the radius (x-axis), the y-axis will be calculated with the floatcos,
if you want to create an ellipse, then modify one of those "40", maybe like:
CX=X+(50*floatsin(i,degrees));
CY=Y+(30*floatcos(i,degrees));
you can define how "dense" the cars are by the angle (degrees), its the 5 here:
for(new i = 0; i<360; i+=5) << set it to a lower value if you expand the circle to maybe 3 or 4 degrees
Reply


Messages In This Thread
floatsin, floatcos - by Cank - 25.05.2010, 10:16
Re: floatsin, floatcos - by iJumbo - 25.05.2010, 10:22
Re: floatsin, floatcos - by Cank - 25.05.2010, 10:33
Re: floatsin, floatcos - by [HiC]TheKiller - 25.05.2010, 10:39
Re: floatsin, floatcos - by Babul - 25.05.2010, 13:11
Re: floatsin, floatcos - by Cank - 25.05.2010, 13:28

Forum Jump:


Users browsing this thread: 1 Guest(s)