Compare commits

...

3 Commits

Author SHA1 Message Date
Supopur 6ba3f433a7 git is broke af 1 year ago
Supopur 546bb77c6e testasdasd 1 year ago
Supopur 6b2d0299f2 broke the code reverting later 1 year ago

@ -0,0 +1,79 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Rage;
using LSPD_First_Response.Mod.API;
using LSPD_First_Response.Mod.Callouts;
using System.Drawing;
namespace Code_Blue_Calls.Callouts
{
[CalloutInfo("Test", CalloutProbability.High)]
public class Test : Callout
{
private Ped suspect;
private Vehicle vehicle;
private Blip blip;
private LHandle Pursuit;
private Vector3 spawn;
private bool created;
public override bool OnBeforeCalloutDisplayed()
{
spawn = World.GetRandomPositionOnStreet();
ShowCalloutAreaBlipBeforeAccepting(spawn, 30f);
//AddMaximumDistanceCheck(40, spawn);
CalloutMessage = "Test";
CalloutPosition = spawn;
Functions.PlayScannerAudioUsingPosition("WE_HAVE CRIME_RESISTING_ARREST_02 IN_OR_ON_POSITION", spawn);
return base.OnBeforeCalloutDisplayed();
}
public override bool OnCalloutAccepted()
{
vehicle = new Vehicle("BLISTA", spawn);
vehicle.IsPersistent = true;
suspect = new Ped(vehicle.GetOffsetPositionFront(5f));
suspect.IsPersistent = true;
suspect.BlockPermanentEvents = true;
suspect.WarpIntoVehicle(vehicle, -1);
blip = suspect.AttachBlip();
blip.Color = System.Drawing.Color.Yellow;
blip.IsRouteEnabled = true;
created = false;
return base.OnCalloutAccepted();
}
public override void Process()
{
base.Process();
if (!created && Game.LocalPlayer.Character.DistanceTo(vehicle) <= 20f)
{
Pursuit = Functions.CreatePursuit();
Functions.AddPedToPursuit(Pursuit, suspect);
Functions.SetPursuitIsActiveForPlayer(Pursuit, true);
created = true;
}
if (created && !Functions.IsPursuitStillRunning(Pursuit))
{
End();
}
}
public override void End()
{
base.End();
if (suspect.Exists())
{
suspect.Dismiss();
}
}
}
}

@ -9,9 +9,10 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Code_Blue_Calls</RootNamespace> <RootNamespace>Code_Blue_Calls</RootNamespace>
<AssemblyName>Code Blue Calls</AssemblyName> <AssemblyName>Code Blue Calls</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic> <Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@ -30,12 +31,42 @@
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="CalloutInterface">
<HintPath>..\..\..\Documents\References\CalloutInterface.dll</HintPath>
</Reference>
<Reference Include="CalloutInterfaceAPI">
<HintPath>..\..\..\Documents\References\CalloutInterfaceAPI.dll</HintPath>
</Reference>
<Reference Include="LSPD First Response"> <Reference Include="LSPD First Response">
<HintPath>..\References\LSPD First Response.dll</HintPath> <HintPath>..\..\..\Documents\References\LSPD First Response.dll</HintPath>
</Reference>
<Reference Include="RAGENativeUI">
<HintPath>..\..\..\Documents\References\RAGENativeUI.dll</HintPath>
</Reference> </Reference>
<Reference Include="RagePluginHookSDK"> <Reference Include="RagePluginHookSDK">
<HintPath>..\References\RagePluginHookSDK.dll</HintPath> <HintPath>..\..\..\Documents\References\RagePluginHookSDK.dll</HintPath>
</Reference>
<Reference Include="StopThePed">
<HintPath>..\..\..\Documents\References\StopThePed.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
@ -46,9 +77,12 @@
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Net.Http" /> <Reference Include="System.Net.Http" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
<Reference Include="UltimateBackup">
<HintPath>..\..\..\Documents\References\UltimateBackup.dll</HintPath>
</Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Callouts\DomesticViolence.cs" /> <Compile Include="Callouts\Test.cs" />
<Compile Include="IniFile.cs" /> <Compile Include="IniFile.cs" />
<Compile Include="Main.cs" /> <Compile Include="Main.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />

@ -8,13 +8,19 @@ EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3CD9D818-ECAE-497B-A7AD-5B64C2345A84}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3CD9D818-ECAE-497B-A7AD-5B64C2345A84}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3CD9D818-ECAE-497B-A7AD-5B64C2345A84}.Debug|Any CPU.Build.0 = Debug|Any CPU {3CD9D818-ECAE-497B-A7AD-5B64C2345A84}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3CD9D818-ECAE-497B-A7AD-5B64C2345A84}.Debug|x64.ActiveCfg = Debug|x64
{3CD9D818-ECAE-497B-A7AD-5B64C2345A84}.Debug|x64.Build.0 = Debug|x64
{3CD9D818-ECAE-497B-A7AD-5B64C2345A84}.Release|Any CPU.ActiveCfg = Release|Any CPU {3CD9D818-ECAE-497B-A7AD-5B64C2345A84}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3CD9D818-ECAE-497B-A7AD-5B64C2345A84}.Release|Any CPU.Build.0 = Release|Any CPU {3CD9D818-ECAE-497B-A7AD-5B64C2345A84}.Release|Any CPU.Build.0 = Release|Any CPU
{3CD9D818-ECAE-497B-A7AD-5B64C2345A84}.Release|x64.ActiveCfg = Release|x64
{3CD9D818-ECAE-497B-A7AD-5B64C2345A84}.Release|x64.Build.0 = Release|x64
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

@ -14,8 +14,13 @@ namespace Code_Blue_Calls
{ {
public override void Initialize() public override void Initialize()
{ {
// Subscribe to the OnOnDutyStateChanged event
Functions.OnOnDutyStateChanged += OnOnDutyStateChangedHandler; Functions.OnOnDutyStateChanged += OnOnDutyStateChangedHandler;
// Log a message to indicate that the callouts have been initialized
Game.LogTrivial("Code Blue callouts initialized."); Game.LogTrivial("Code Blue callouts initialized.");
// Register an event handler for resolving LSPDFR-related assemblies
AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(LSPDFRResolveEventHandler); AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(LSPDFRResolveEventHandler);
} }
@ -24,46 +29,65 @@ namespace Code_Blue_Calls
throw new NotImplementedException(); throw new NotImplementedException();
} }
// Event handler for the OnOnDutyStateChanged event
public static void OnOnDutyStateChangedHandler(bool OnDuty) public static void OnOnDutyStateChangedHandler(bool OnDuty)
{ {
if (OnDuty) if (OnDuty)
{ {
<<<<<<< HEAD
// If the player goes on duty, register the callouts
RegisterCallouts();
// Display a notification to indicate that the callouts have been loaded
=======
RegisterCallouts(); RegisterCallouts();
>>>>>>> parent of ccc531b (Added domestic violence calout)
Game.DisplayNotification("Code Blue Callouts loaded."); Game.DisplayNotification("Code Blue Callouts loaded.");
} }
} }
// Register the callouts
private static void RegisterCallouts() private static void RegisterCallouts()
{ {
Functions.RegisterCallout(typeof(Callouts.DomesticViolence)); Functions.RegisterCallout(typeof(Callouts.Test));
} }
// Event handler for resolving LSPDFR-related assemblies
// I stole this code from a tutorial i have no idea how it works but i just know that it checks for lspdfr version. Btw comments are made by chat gpt
public static Assembly LSPDFRResolveEventHandler(object sender, ResolveEventArgs args) public static Assembly LSPDFRResolveEventHandler(object sender, ResolveEventArgs args)
{ {
// Iterate through all user plugins to find the requested assembly
foreach (Assembly assembly in Functions.GetAllUserPlugins()) foreach (Assembly assembly in Functions.GetAllUserPlugins())
{ {
// Check if the assembly name matches the requested name
if (args.Name.ToLower().Contains(assembly.GetName().Name.ToLower())) if (args.Name.ToLower().Contains(assembly.GetName().Name.ToLower()))
{ {
return assembly; return assembly; // Return the assembly if found
} }
} }
return null; return null; // Return null if the assembly is not found
} }
// Check if an LSPDFR plugin is running
// I stole this code from a tutorial i have no idea how it works but i just know that it checks for lspdfr version. Btw comments are made by chat gpt
public static bool IsLSPDFRPluginRunning(string Plugin, Version minversion = null) public static bool IsLSPDFRPluginRunning(string Plugin, Version minversion = null)
{ {
foreach (Assembly assembly in Functions.GetAllUserPlugins()) foreach (Assembly assembly in Functions.GetAllUserPlugins())
{ {
AssemblyName an = assembly.GetName(); AssemblyName an = assembly.GetName();
// Check if the plugin name matches the requested name
if (an.Name.ToLower() == Plugin.ToLower()) if (an.Name.ToLower() == Plugin.ToLower())
{ {
// Check the version if a minimum version is provided
if (minversion == null || an.Version.CompareTo(minversion) >= 0) if (minversion == null || an.Version.CompareTo(minversion) >= 0)
{ {
return true; return true; // Return true if the plugin is running and meets the minimum version requirement
} }
} }
} }
return false; return false; // Return false if the plugin is not found or does not meet the minimum version requirement
} }
} }
} }

Loading…
Cancel
Save