16.10.2012, 23:52
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:
<
By the way Schurman, GetPlayerVehicleSeat will return -1 is the player isn't in a vehicle, so you don't have to put IsPlayerInAnyVehicle.
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.