Add project files.

master
smekalm 2 years ago
parent 0239aafd75
commit 62db1526c4

@ -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();
}
}
}
}

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{3CD9D818-ECAE-497B-A7AD-5B64C2345A84}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Code_Blue_Calls</RootNamespace>
<AssemblyName>Code Blue Calls</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\..\Games\GTAV\plugins\LSPDFR\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="LSPD First Response">
<HintPath>..\References\LSPD First Response.dll</HintPath>
</Reference>
<Reference Include="RagePluginHookSDK">
<HintPath>..\References\RagePluginHookSDK.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Callouts\Test.cs" />
<Compile Include="IniFile.cs" />
<Compile Include="Main.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.33516.290
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Code Blue Calls", "Code Blue Calls.csproj", "{3CD9D818-ECAE-497B-A7AD-5B64C2345A84}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{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}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3CD9D818-ECAE-497B-A7AD-5B64C2345A84}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {29F89CB0-BC42-4243-9068-9A57520D3379}
EndGlobalSection
EndGlobal

@ -0,0 +1,59 @@
using System;
using System.Runtime.InteropServices;
using System.Text;
namespace Code_Blue_Calls
{
/// <summary>
/// Create a New INI file to store or load data
/// </summary>
public class IniFile
{
public string path;
[DllImport("kernel32")]
private static extern long WritePrivateProfileString(string section,
string key, string val, string filePath);
[DllImport("kernel32")]
private static extern int GetPrivateProfileString(string section,
string key, string def, StringBuilder retVal,
int size, string filePath);
/// <summary>
/// INIFile Constructor.
/// </summary>
/// <PARAM name="INIPath"></PARAM>
public IniFile(string INIPath)
{
path = INIPath;
}
/// <summary>
/// Write Data to the INI File
/// </summary>
/// <PARAM name="Section"></PARAM>
/// Section name
/// <PARAM name="Key"></PARAM>
/// Key Name
/// <PARAM name="Value"></PARAM>
/// Value Name
public void IniWriteValue(string Section, string Key, string Value)
{
WritePrivateProfileString(Section, Key, Value, this.path);
}
/// <summary>
/// Read Data Value From the Ini File
/// </summary>
/// <PARAM name="Section"></PARAM>
/// <PARAM name="Key"></PARAM>
/// <PARAM name="Path"></PARAM>
/// <returns></returns>
public string IniReadValue(string Section, string Key)
{
StringBuilder temp = new StringBuilder(255);
int i = GetPrivateProfileString(Section, Key, "", temp, 255, this.path);
return temp.ToString();
}
}
}

@ -0,0 +1,69 @@
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 System.Reflection;
//using LSPD_First_Response.Mod.Callouts;
namespace Code_Blue_Calls
{
public class Main : Plugin
{
public override void Initialize()
{
Functions.OnOnDutyStateChanged += OnOnDutyStateChangedHandler;
Game.LogTrivial("Code Blue callouts initialized.");
AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(LSPDFRResolveEventHandler);
}
public override void Finally()
{
throw new NotImplementedException();
}
public static void OnOnDutyStateChangedHandler(bool OnDuty)
{
if (OnDuty)
{
RegisterCallouts();
Game.DisplayNotification("Code Blue Callouts loaded.");
}
}
private static void RegisterCallouts()
{
Functions.RegisterCallout(typeof(Callouts.Test));
}
public static Assembly LSPDFRResolveEventHandler(object sender, ResolveEventArgs args)
{
foreach (Assembly assembly in Functions.GetAllUserPlugins())
{
if (args.Name.ToLower().Contains(assembly.GetName().Name.ToLower()))
{
return assembly;
}
}
return null;
}
public static bool IsLSPDFRPluginRunning(string Plugin, Version minversion = null)
{
foreach (Assembly assembly in Functions.GetAllUserPlugins())
{
AssemblyName an = assembly.GetName();
if (an.Name.ToLower() == Plugin.ToLower())
{
if (minversion == null || an.Version.CompareTo(minversion) >= 0)
{
return true;
}
}
}
return false;
}
}
}

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Code Blue Calls")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Code Blue Calls")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("3cd9d818-ecae-497b-a7ad-5b64c2345a84")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Loading…
Cancel
Save