SA-MP Forums Archive
Float Function - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Float Function (/showthread.php?tid=133872)



Float Function - deather - 14.03.2010

Can somebody explain floatsin, floatcos functions?


Re: Float Function - Correlli - 14.03.2010

Wiki can.


Re: Float Function - Babul - 14.03.2010

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];