GetClosestVehicle(playerid, radius)
#4

could this be helpful?
http://www.xfire.com/video/38ed30/
Код:
CMD:test(playerid,params[]){
	new TimerOld=GetTickCount();
	new VehID;
	new Dist,DistLower=8500,DistLowerSA;
	new Float:X,Float:Y,Float:Z;
	new Float:pX,Float:pY,Float:pZ;
	new XX,YY,ZZ;
	new sXX,sYY,sZZ;
	GetPlayerPos(playerid,pX,pY,pZ);
	for(new v=0;v<MAX_VEHICLES;v++)
	{
		if(IsPlayerInVehicle(playerid,v)==1) continue;
		GetVehiclePos(v,X,Y,Z);
		if(IsPlayerInRangeOfPoint(playerid,DistLower,X,Y,Z))
		{
			XX=floatround(X-pX,floatround_floor);
			YY=floatround(Y-pY,floatround_floor);
			ZZ=floatround(Z-pZ,floatround_floor);
			sXX=XX*XX;
			sYY=YY*YY;
			sZZ=ZZ*ZZ;
			DistLowerSA=sXX+sYY+sZZ;
			DistLower=floatround(floatsqroot(DistLowerSA),floatround_floor);
			VehID=v;
		}
	}
	new TimerNew=GetTickCount();
	new string[48];
	format(string,sizeof(string),"Closest Veh:%d Dist:%d ms:%d",VehID,DistLower,TimerNew-TimerOld);
	SendClientMessage(playerid,0x33cc33ff,string);
	return VehID;
}
Reply


Messages In This Thread
GetClosestVehicle(playerid, radius) - by armyoftwo - 11.11.2010, 14:15
Re: GetClosestVehicle(playerid, radius) - by rs.pect - 11.11.2010, 14:26
Re: GetClosestVehicle(playerid, radius) - by armyoftwo - 11.11.2010, 14:27
Re: GetClosestVehicle(playerid, radius) - by Babul - 11.11.2010, 14:32
Re: GetClosestVehicle(playerid, radius) - by armyoftwo - 11.11.2010, 14:42
Re: GetClosestVehicle(playerid, radius) - by The_Moddler - 11.11.2010, 14:47

Forum Jump:


Users browsing this thread: 2 Guest(s)