Airplane Heading Help!
#4

He shouldn't use OnPlayerUpdate. I think it will take much more CPU usage than a timer of 1 to 2 seconds. It doesn't have to be updated so fast because anyways, a plane isn't changing angle really fast. So I suggest he make a timer for it.

Exemple:

Код:
//top of your script

forward AngleUpdate();
//in ongamemodeinit

SetTimer("AngleUpdate", 1500, 1);

//now the public

public AngleUpdate()
{
	for(new i = 0; i<MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{
			if(GetVehicleVehicleSeat(i) != 0) return 1;
			new vehicleid = GetPlayerVehicleID(i);
			if(GetVehicleModel(vehicleid) == 460 || GetVehicleModel(vehicleid) == 476 || GetVehicleModel(vehicleid) == 511) //and continue like that for all airplanes.
			{
			    new Float:a;
			    GetVehicleZAngle(vehicleid, a);
			    if(a > 45 && a < 135)
			    {
			        //codes for east
			    }
			    else if(a > 135 && a < 225)
			    {
			        //codes for south
			    }
			    else if(a > 225 && a < 315)
			    {
			        //codes for west
			    }
			    else if(!(a > 135 && a < 315)
			    {
			        //codes for north
			    }
			}
		}
	}
	return 1;
}
<

By the way Schurman, GetPlayerVehicleSeat will return -1 is the player isn't in a vehicle, so you don't have to put IsPlayerInAnyVehicle.
Reply


Messages In This Thread
Airplane Heading Help! - by SoHidden - 16.10.2012, 23:16
Re : Airplane Heading Help! - by lelemaster - 16.10.2012, 23:30
Re: Airplane Heading Help! - by SchurmanCQC - 16.10.2012, 23:40
Re : Airplane Heading Help! - by lelemaster - 16.10.2012, 23:52
Re: Airplane Heading Help! - by CoaPsyFactor - 16.10.2012, 23:56
Re: Airplane Heading Help! - by SoHidden - 19.10.2012, 22:37

Forum Jump:


Users browsing this thread: 1 Guest(s)