示例#1
0
 /// <summary>
 /// Parks a vehicle with selected id
 /// </summary>
 /// <param name="c">Client</param>
 /// <param name="vehicleId">Vehicle id</param>
 public void ParkVehicle(Client c, int vehicleId)
 {
     if (PlayerManager.Instance().IsClientUsingCharacter(c))
     {
         Character character = PlayerManager.Instance().GetActiveCharacterForClient(c);
         RPVehicle vehicle   = VehicleManager.Instance().GetVehicleWithId(vehicleId);
         if (vehicle != null && character.ID == vehicle.ownerId && vehicle.spawned)
         {
             if (vehicle.handle == API.shared.getPlayerVehicle(c))
             {
                 if (vehicle.position.DistanceTo(vehicle.parkPosition) <= parkDistance)
                 {
                     vehicle.Park();
                 }
                 else
                 {
                     API.shared.sendNotificationToPlayer(c, "You have to close to the parking spot in order to park the vehicle!");
                 }
             }
             else
             {
                 API.shared.sendNotificationToPlayer(c, "You need to be in the vehicle you want to park!");
             }
         }
     }
 }
示例#2
0
 /// <summary>
 /// Parks a vehicle with selected id
 /// </summary>
 /// <param name="client">Client</param>
 /// <param name="vehicleId">Vehicle id</param>
 public void ParkVehicle(Character character, int vehicleId)
 {
     RPVehicle vehicle = VehicleManager.Instance().GetVehicleWithId(vehicleId);
     if (vehicle != null && character.ID == vehicle.ownerId && vehicle.spawned)
     {
         if (vehicle.handle == API.shared.getPlayerVehicle(character.client))
         {
             if (vehicle.position.DistanceTo(vehicle.parkPosition) <= parkDistance)
             {
                 vehicle.Park();
             }
             else
             {
                 character.SendNotification("You have to close to the parking spot in order to park the vehicle!");
             }
         }
         else
         {
             character.SendNotification("You have to close to the parking spot in order to park the vehicle!");
         }
     }
 }