Float Function
#1

Can somebody explain floatsin, floatcos functions?
Reply
#2

Wiki can.
Reply
#3

with the floatsin/floatcos you can calculate the x,y position by giving an angle and the radius.
Код:
dcmd_Cars(playerid,params[])
{
  new Float:X,Float:Y,Float:Z;//,Float:A;
  GetPlayerPos(playerid,X,Y,Z);
	for(new i = 0; i<360; i+=10)
	{
    new Float:CX,Float:CY,Float:CZ,Float:CA;
		CX=X+(20*floatsin(i,degrees));
		CY=Y+(20*floatcos(i,degrees));
		CZ=Z;
		CA=(-i+180)%360;
		Veh[Vehicles]=AddStaticVehicle(412,CX,CY,CZ,CA,-1,-1,-1);Vehicles++;
	}
	SendClientMessage(playerid,0xafafff77,"Vehicle(s) spawned.");
	return 1;
}
that snipped lets you spawn some cars in a circle - dont forget to add those 2 lines at top of your script, they are holding the cars itself, aswell the vehicle-"counter":
Код:
new Vehicles;
new Veh[2000];
Reply


Forum Jump:


Users browsing this thread: