shourya90

Untitled

Mar 31st, 2021
445
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.03 KB | None | 0 0
  1. [RemoteEvent("StartTaxiJob")]
  2.         public void StartTaxiJob(Player player)
  3.         {
  4.             JobVehiclesVar Tveh = null;
  5.             foreach (JobVehiclesVar Veh in JobVehiclesVar.JOB_VEHICLE_LIST)
  6.             {
  7.                 if(Veh.JobVehicleOwner == player)
  8.                 {
  9.                     if(Veh.JobVehicleType == (int)JobVehType.JOB_VEH_TAXI)
  10.                     {
  11.                    
  12.                         Tveh = Veh;
  13.                         break;
  14.                     }
  15.                 }
  16.             }
  17.             if (Tveh != null)
  18.             {
  19.                 if (NAPI.Vehicle.GetVehicleDriver(Tveh.JobVehicleHolder) == player)
  20.                 {
  21.                     if (!TaxiStatus[player.Id])
  22.                     {
  23.                         if (Fun.IsPlayerInJob(player))
  24.                         {
  25.                             return;
  26.                         }
  27.                         if (!Fun.IsPlayerCivilian(player))
  28.                         {
  29.                             Fun.SendNotification(player, "This job is only for civilian class");
  30.                             return;
  31.                         }
  32.                         Fun.SendNotification(player, "Taxi job started~n~To cancel the job use ~y~/canceltaxi");
  33.                         TaxiStatus[player.Id] = true;
  34.  
  35.                         player.TriggerEvent("StartTaxiClient", Tveh.JobVehicleHolder);
  36.                     }
  37.                 }
  38.             }
  39.             else
  40.             {
  41.                 if (Fun.IsInRangeOfPoint(player.Position, new Vector3(-249.83844, -313.43216, 30.16217), 2))
  42.                 {
  43.                     if (!TaxiStatus[player.Id])
  44.                     {
  45.                         if (!Fun.IsPlayerCivilian(player))
  46.                         {
  47.                             Fun.SendNotification(player, "This job is only for civilian class");
  48.                             return;
  49.                         }
  50.                         if (Fun.IsPlayerInJob(player))
  51.                         {
  52.                             return;
  53.                         }
  54.                         JobVehiclesVar JobVeh = new JobVehiclesVar();
  55.                         JobVeh.JobVehicleOwner = player;
  56.                         JobVeh.JobVehicleType = (int)JobVehType.JOB_VEH_TAXI;
  57.                         JobVeh.JobVehicleRefueling = false;
  58.                         JobVeh.JobVehicleFuel = 1000;
  59.                         JobVeh.JobVehicleHolder = NAPI.Vehicle.CreateVehicle(VehicleHash.Taxi, new Vector3(-249.83844, -313.43216, 30.16217), -136.12138f, 1, 2, "Txi");
  60.                         NAPI.Player.SetPlayerIntoVehicle(player, JobVeh.JobVehicleHolder, 0);
  61.                         JobVehiclesVar.JOB_VEHICLE_LIST.Add(JobVeh);
  62.                         Fun.SendNotification(player, "Taxi job started~n~To cancel the job use ~y~/canceltaxi");
  63.                         TaxiStatus[player.Id] = true;
  64.  
  65.                         player.TriggerEvent("StartTaxiClient", Tveh.JobVehicleHolder);
  66.                     }
  67.                 }
  68.             }
  69.            
  70.         }
Advertisement
Add Comment
Please, Sign In to add comment