Kieran_S0

Processing

Feb 1st, 2021
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.77 KB | None | 0 0
  1. using GTA;
  2. using GTA.Math;
  3. using GTA.Native;
  4. using System;
  5. using System.Windows.Forms;
  6. using System.Drawing;
  7.  
  8. public partial class Lestermission : Script
  9. {
  10.     void Processing()
  11.     {
  12.         switch(task)
  13.         {
  14.             case Missiontask.initialize: Initialize(); break;
  15.             case Missiontask.atLester: Processing_atLester(); break;
  16.             case Missiontask.goToVehicle: Processing_goToVehicle(); break;
  17.             case Missiontask.enterVehicle: Processing_enterVehicle(); break;
  18.             case Missiontask.restartMission: Processing_restartMission(); break;
  19.             case Missiontask.pickupGuard: Processing_pickupGuard(); break;
  20.         }
  21.     }
  22.     void Processing_atLester()
  23.     {
  24.         //make sure script can start
  25.         if (lester == null) return;
  26.         if (!lester.Exists()) return;
  27.         if (lester.IsDead) return;
  28.  
  29.         //show mission notif once
  30.         if (player.IsNearEntity(lester, new Vector3(10f, 10f, 10f)) && !missionNotification)
  31.         {
  32.             GTA.UI.Notify("Talk to ~y~Lester ~w~to start the mission");
  33.             missionNotification = true;
  34.         }
  35.  
  36.         //key to talk to lester
  37.         if (World.GetDistance(player.Position, lesterStairsPos) < 3.5f)
  38.         {
  39.             DisplayHelpTextThisFrame("Press ~INPUT_CONTEXT~ to talk to Lester");
  40.         }
  41.  
  42.         //taking to lester
  43.         if (Game.IsControlJustPressed(2, GTA.Control.Context))
  44.         {
  45.             if (World.GetDistance(player.Position, lesterStairsPos) < 3.5f)
  46.             {              
  47.                 //spawn the car
  48.                 missionVehicle = World.CreateVehicle(new Model(-1150599089), new GTA.Math.Vector3(695.8693f, -1005.955f, 22.43776f), 3.489466f);
  49.  
  50.                 //vehicle color
  51.                 missionVehicle.PrimaryColor = VehicleColor.MetallicBlue;
  52.                 missionVehicle.SecondaryColor = VehicleColor.MetallicBlue;
  53.  
  54.                 //subtitle
  55.                 GTA.UI.ShowSubtitle("I have left some drugs in the ~b~primo~w~. Get in the ~b~primo ~w~and deliver them for me.", 8000);
  56.  
  57.                 //make lester walk away
  58.                 Function.Call(Hash.TASK_GO_STRAIGHT_TO_COORD, lester.Handle, 717.9976f, -963.3627f, 29.39533f, 1, -1, 0.0f, 0.0f);
  59.  
  60.                 //delete lester blip
  61.                 lester.CurrentBlip.Remove();
  62.  
  63.                 //next task
  64.                 task = Missiontask.goToVehicle;
  65.             }
  66.         }  
  67.     }
  68.     void Processing_goToVehicle()
  69.     {  
  70.         //add blip to mission vehicle
  71.         missionVehicle.AddBlip();
  72.         missionVehicle.CurrentBlip.Sprite = BlipSprite.GetawayCar;
  73.         missionVehicle.CurrentBlip.Color = BlipColor.Blue;
  74.         missionVehicle.CurrentBlip.IsShortRange = true;
  75.         missionVehicle.CurrentBlip.Name = "Vehicle";
  76.  
  77.         //spawn guard
  78.         guard = World.CreatePed(new Model(1822283721), new GTA.Math.Vector3(370.8857f, -771.8976f, 29.27729f), 0.008833435f);
  79.         guard.Task.UseMobilePhone();
  80.  
  81.         //next task
  82.         task = Missiontask.enterVehicle;
  83.     }
  84.     void Processing_enterVehicle()
  85.     {
  86.         if (player.IsSittingInVehicle(missionVehicle))
  87.         {
  88.             //make guard marker
  89.             if (!missionVehicle.IsInRangeOf(guardMarkerPos, 3.5f)) Function.Call(Hash.DRAW_MARKER, 1, 372.8544f, -767.2747f, 28.29266f, 0f, 0f, 0f, 0f, 0f, 0f, 1.8f, 1.8f, 0.9f, 0, 153, 255, 255, false, false, 2, false, false, false);
  90.  
  91.             //give player duffelbag
  92.             Function.Call(Hash.SET_PED_COMPONENT_VARIATION, player, 9, 1, 0, 1); //duffelbag
  93.             Function.Call(Hash.SET_PED_COMPONENT_VARIATION, player, 5, 4, 0, 1); //gloves
  94.  
  95.             //delete mission vehicle blip when player is in car
  96.             missionVehicle.CurrentBlip.Remove();
  97.  
  98.             //make dest blip
  99.             blipDestination = World.CreateBlip(guardMarkerPos);
  100.             blipDestination.Sprite = BlipSprite.Standard;
  101.             blipDestination.Color = BlipColor.Blue;
  102.             blipDestination.ShowRoute = true;
  103.             blipDestination.Name = "Guard";
  104.          
  105.             //subtitle
  106.             GTA.UI.ShowSubtitle("Pickup the ~b~guard", 8000);
  107.  
  108.             //next task
  109.             task = Missiontask.pickupGuard;
  110.         }
  111.     }
  112.     void Processing_pickupGuard()
  113.     {
  114.         if (player.IsInRangeOf(guardMarkerPos, 3.5f) && missionVehicle.IsStopped)
  115.         {
  116.             //make guard in pedgroup
  117.             PedGroup pedgroup = player.CurrentPedGroup;
  118.             pedgroup.Add(guard, false);
  119.             guard.Task.ClearAll();
  120.         }        
  121.  
  122.         //next task
  123.         task = Missiontask.restartMission;
  124.     }
  125.     void Processing_restartMission()
  126.     {
  127.         //if (!player.IsInRangeOf(, 100.00f)) Deinitialize();
  128.         //if (!player.IsInRangeOf(, 100.00f)) Initialize();
  129.     }
  130. }
  131.  
Advertisement
Add Comment
Please, Sign In to add comment