Update 07.12.2022
This commit is contained in:
13
C#/FiveM/Framework/.idea/.idea.Framework/.idea/.gitignore
generated
vendored
Normal file
13
C#/FiveM/Framework/.idea/.idea.Framework/.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Rider ignored files
|
||||||
|
/contentModel.xml
|
||||||
|
/modules.xml
|
||||||
|
/projectSettingsUpdater.xml
|
||||||
|
/.idea.Framework.iml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
7
C#/FiveM/Framework/.idea/.idea.Framework/.idea/discord.xml
generated
Normal file
7
C#/FiveM/Framework/.idea/.idea.Framework/.idea/discord.xml
generated
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="DiscordProjectSettings">
|
||||||
|
<option name="show" value="PROJECT_FILES" />
|
||||||
|
<option name="description" value="" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
6
C#/FiveM/Framework/.idea/.idea.Framework/.idea/encodings.xml
generated
Normal file
6
C#/FiveM/Framework/.idea/.idea.Framework/.idea/encodings.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise">
|
||||||
|
<file url="file://$PROJECT_DIR$/Framework.Shared/fxmanifest.lua" charset="US-ASCII" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
BIN
C#/FiveM/Framework/Build/Framework.Client.net.dll
Normal file
BIN
C#/FiveM/Framework/Build/Framework.Client.net.dll
Normal file
Binary file not shown.
BIN
C#/FiveM/Framework/Build/Framework.Server.net.dll
Normal file
BIN
C#/FiveM/Framework/Build/Framework.Server.net.dll
Normal file
Binary file not shown.
BIN
C#/FiveM/Framework/Build/Framework.Shared.dll
Normal file
BIN
C#/FiveM/Framework/Build/Framework.Shared.dll
Normal file
Binary file not shown.
BIN
C#/FiveM/Framework/Build/MySql.Data.dll
Normal file
BIN
C#/FiveM/Framework/Build/MySql.Data.dll
Normal file
Binary file not shown.
BIN
C#/FiveM/Framework/Build/NativeUI.dll
Normal file
BIN
C#/FiveM/Framework/Build/NativeUI.dll
Normal file
Binary file not shown.
20
C#/FiveM/Framework/Build/fxmanifest.lua
Normal file
20
C#/FiveM/Framework/Build/fxmanifest.lua
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
fx_version 'cerulean'
|
||||||
|
games { 'gta5' }
|
||||||
|
|
||||||
|
author 'Leon hoppe <leon@ladenbau-hoppe.de>'
|
||||||
|
description 'FiveM Framework in C#'
|
||||||
|
version '1.0.0'
|
||||||
|
|
||||||
|
files {
|
||||||
|
'NativeUI.dll',
|
||||||
|
'MySql.Data.dll',
|
||||||
|
'Framework.Shared.dll'
|
||||||
|
}
|
||||||
|
|
||||||
|
client_scripts {
|
||||||
|
'Framework.Client.net.dll'
|
||||||
|
}
|
||||||
|
|
||||||
|
server_scripts {
|
||||||
|
'Framework.Server.net.dll'
|
||||||
|
}
|
||||||
BIN
C#/FiveM/Framework/Build/stream/NativeUI.ytd
Normal file
BIN
C#/FiveM/Framework/Build/stream/NativeUI.ytd
Normal file
Binary file not shown.
28
C#/FiveM/Framework/Framework.Client/Client.cs
Normal file
28
C#/FiveM/Framework/Framework.Client/Client.cs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
#pragma warning disable CS1998
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using CitizenFX.Core;
|
||||||
|
using Framework.Client.Handler;
|
||||||
|
using NativeUI;
|
||||||
|
|
||||||
|
namespace Framework.Client {
|
||||||
|
public class Client : ClientScript {
|
||||||
|
public static Client Instance;
|
||||||
|
public static MenuPool Menus;
|
||||||
|
|
||||||
|
public Client() {
|
||||||
|
Instance = this;
|
||||||
|
Menus = new MenuPool();
|
||||||
|
|
||||||
|
JoinHandler.Init();
|
||||||
|
|
||||||
|
EventHandlers["client:spawn:register"] += new Action(JoinHandler.Register);
|
||||||
|
EventHandlers["client:spawn:choose"] += new Action<dynamic[]>(JoinHandler.ChooseChar);
|
||||||
|
|
||||||
|
Tick += async () => {
|
||||||
|
Menus.ProcessMenus();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
74
C#/FiveM/Framework/Framework.Client/Framework.Client.csproj
Normal file
74
C#/FiveM/Framework/Framework.Client/Framework.Client.csproj
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" DefaultTargets="Build" 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>{4E52F164-32BF-40C6-978E-E91BB595C5B6}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>Framework.Client</RootNamespace>
|
||||||
|
<AssemblyName>Framework.Client.net</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
<DebugType>embedded</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>../Build</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<PostBuildEvent>del Newtonsoft.Json.xml</PostBuildEvent>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="CitizenFX.Core.Client, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\CitizenFX.Core.Client.1.0.6086\lib\net45\CitizenFX.Core.Client.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="NativeUI">
|
||||||
|
<HintPath>..\Librarys\NativeUI.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Client.cs" />
|
||||||
|
<Compile Include="Handler\JoinHandler.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="Utils\UI.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="packages.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Framework.Shared\Framework.Shared.csproj">
|
||||||
|
<Project>{7130f249-1c23-438c-a077-76a2867f8c5e}</Project>
|
||||||
|
<Name>Framework.Shared</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
|
|
||||||
|
</Project>
|
||||||
93
C#/FiveM/Framework/Framework.Client/Handler/JoinHandler.cs
Normal file
93
C#/FiveM/Framework/Framework.Client/Handler/JoinHandler.cs
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
using System;
|
||||||
|
using CitizenFX.Core;
|
||||||
|
using CitizenFX.Core.UI;
|
||||||
|
using Framework.Client.Utils;
|
||||||
|
using Framework.Shared.Models;
|
||||||
|
using NativeUI;
|
||||||
|
|
||||||
|
namespace Framework.Client.Handler {
|
||||||
|
public static class JoinHandler {
|
||||||
|
private static UIMenu _registerMenu;
|
||||||
|
private static PlayerData _data;
|
||||||
|
|
||||||
|
public static void Init() {
|
||||||
|
_registerMenu = new UIMenu("PrincepRP", "Registrierung");
|
||||||
|
Client.Menus.Add(_registerMenu);
|
||||||
|
|
||||||
|
var sex = new UIMenuItem("Geschlecht setzen", "0 -> Männlich, 1 -> Weiblich");
|
||||||
|
var height = new UIMenuItem("Größe setzen", "Wert in cm");
|
||||||
|
var firstName = new UIMenuItem("Vornamen setzen");
|
||||||
|
var lastName = new UIMenuItem("Nachnamen setzen");
|
||||||
|
var birth = new UIMenuItem("Geburtsdatum setzen", "DD.MM.JJJJ, min. 18 Jahre");
|
||||||
|
var skin = new UIMenuItem("Skin erstellen");
|
||||||
|
var done = new UIMenuItem("Charackter erstellen");
|
||||||
|
|
||||||
|
_registerMenu.AddItem(sex);
|
||||||
|
_registerMenu.AddItem(height);
|
||||||
|
_registerMenu.AddItem(firstName);
|
||||||
|
_registerMenu.AddItem(lastName);
|
||||||
|
_registerMenu.AddItem(birth);
|
||||||
|
_registerMenu.AddItem(skin);
|
||||||
|
_registerMenu.AddItem(done);
|
||||||
|
|
||||||
|
sex.Activated += async (sender, item) => {
|
||||||
|
var input = await UI.DisplayTextInput("Geschlecht setzen", 1);
|
||||||
|
if (int.TryParse(input, out var result)) {
|
||||||
|
_data.sex = result == 0;
|
||||||
|
|
||||||
|
if (_data.sex) sex.Description = "Männlich";
|
||||||
|
else sex.Description = "Weiblich";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Screen.ShowNotification("~r~Geschlecht setzen: 0 -> Männlich, 1 -> Weiblich");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
height.Activated += async (sender, item) => {
|
||||||
|
var input = await UI.DisplayTextInput("Größe setzen", 3);
|
||||||
|
if (int.TryParse(input, out var result)) {
|
||||||
|
_data.height = result;
|
||||||
|
|
||||||
|
height.Description = _data.height + "cm";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Screen.ShowNotification("~r~Größe setzen: Wert in cm");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
firstName.Activated += async (sender, item) => {
|
||||||
|
var input = await UI.DisplayTextInput("Vornamen setzen", 60);
|
||||||
|
_data.firstName = input;
|
||||||
|
firstName.Description = _data.firstName;
|
||||||
|
};
|
||||||
|
|
||||||
|
lastName.Activated += async (sender, item) => {
|
||||||
|
var input = await UI.DisplayTextInput("Nachnamen setzen", 60);
|
||||||
|
_data.lastName = input;
|
||||||
|
lastName.Description = _data.lastName;
|
||||||
|
};
|
||||||
|
|
||||||
|
birth.Activated += async (sender, item) => {
|
||||||
|
var input = await UI.DisplayTextInput("Geburtsdatum setzen", 10);
|
||||||
|
_data.birth = input;
|
||||||
|
birth.Description = _data.birth;
|
||||||
|
};
|
||||||
|
|
||||||
|
done.Activated += (sender, item) => {
|
||||||
|
// TODO: Checks
|
||||||
|
_registerMenu.Visible = false;
|
||||||
|
BaseScript.TriggerServerEvent("server:spawn:register", _data);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Register() {
|
||||||
|
_data = new PlayerData();
|
||||||
|
_registerMenu.Visible = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ChooseChar(dynamic[] chars) {
|
||||||
|
Debug.WriteLine("ChooseChar");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
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("Framework.Client")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("Framework.Client")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2022")]
|
||||||
|
[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("4E52F164-32BF-40C6-978E-E91BB595C5B6")]
|
||||||
|
|
||||||
|
// 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")]
|
||||||
27
C#/FiveM/Framework/Framework.Client/Utils/UI.cs
Normal file
27
C#/FiveM/Framework/Framework.Client/Utils/UI.cs
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
using System.Threading.Tasks;
|
||||||
|
using CitizenFX.Core;
|
||||||
|
using CitizenFX.Core.Native;
|
||||||
|
|
||||||
|
namespace Framework.Client.Utils {
|
||||||
|
public static class UI {
|
||||||
|
|
||||||
|
public static async Task<string> DisplayTextInput(string title, int maxLength) {
|
||||||
|
API.AddTextEntry("CH_INPUT", title);
|
||||||
|
API.DisplayOnscreenKeyboard(1, "CH_INPUT", "", "", "", "", "", maxLength);
|
||||||
|
|
||||||
|
while (API.UpdateOnscreenKeyboard() == 0) {
|
||||||
|
await BaseScript.Delay(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (API.UpdateOnscreenKeyboard() != 2) {
|
||||||
|
var result = API.GetOnscreenKeyboardResult();
|
||||||
|
await BaseScript.Delay(0);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
await BaseScript.Delay(0);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
// <autogenerated />
|
||||||
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
|
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")]
|
||||||
Binary file not shown.
@@ -0,0 +1 @@
|
|||||||
|
34591d24053ea89eea29dc22e89a3ebad14609bf
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
D:\Programmierstuff\C#\FiveM\Framework\Framework.Client\obj\Release\Framework.Client.csproj.AssemblyReference.cache
|
||||||
|
D:\Programmierstuff\C#\FiveM\Framework\Framework.Client\obj\Release\Framework.Client.csproj.CoreCompileInputs.cache
|
||||||
|
D:\Programmierstuff\C#\FiveM\Framework\Framework.Client\obj\Release\Framework.Client.csproj.CopyComplete
|
||||||
|
D:\Programmierstuff\C#\FiveM\Framework\Build\fxmanifest.lua
|
||||||
|
D:\Programmierstuff\C#\FiveM\Framework\Build\stream\NativeUI.ytd
|
||||||
|
D:\Programmierstuff\C#\FiveM\Framework\Build\Framework.Client.net.dll
|
||||||
|
D:\Programmierstuff\C#\FiveM\Framework\Framework.Client\obj\Release\Framework.Client.net.dll
|
||||||
Binary file not shown.
4
C#/FiveM/Framework/Framework.Client/packages.config
Normal file
4
C#/FiveM/Framework/Framework.Client/packages.config
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="CitizenFX.Core.Client" version="1.0.6086" targetFramework="net481" />
|
||||||
|
</packages>
|
||||||
10
C#/FiveM/Framework/Framework.Server/App.config
Normal file
10
C#/FiveM/Framework/Framework.Server/App.config
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?><configuration>
|
||||||
|
<runtime>
|
||||||
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
</assemblyBinding>
|
||||||
|
</runtime>
|
||||||
|
</configuration>
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
using System;
|
||||||
|
using CitizenFX.Core;
|
||||||
|
|
||||||
|
namespace Framework.Server.Extensions {
|
||||||
|
public static class PlayerExtensions {
|
||||||
|
|
||||||
|
public static int ServerId(this Player player) => Convert.ToInt32(player.Handle);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
86
C#/FiveM/Framework/Framework.Server/Framework.Server.csproj
Normal file
86
C#/FiveM/Framework/Framework.Server/Framework.Server.csproj
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" DefaultTargets="Build" 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>{3B60C431-5ACF-4145-A792-32217A65A445}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>Framework.Server</RootNamespace>
|
||||||
|
<AssemblyName>Framework.Server.net</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
<DebugType>embedded</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>../Build</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<PostBuildEvent>del Framework.Server.net.dll.config</PostBuildEvent>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="CitizenFX.Core.Server, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\CitizenFX.Core.Server.1.0.6086\lib\net45\CitizenFX.Core.Server.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.CSharp">
|
||||||
|
<HintPath>..\Librarys\Microsoft.CSharp.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="mscorlib" />
|
||||||
|
<Reference Include="MySql.Data">
|
||||||
|
<HintPath>..\Librarys\MySql.Data.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Configuration" />
|
||||||
|
<Reference Include="System.Configuration.Install" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Management" />
|
||||||
|
<Reference Include="System.Numerics" />
|
||||||
|
<Reference Include="System.Transactions" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Extensions\PlayerExtensions.cs" />
|
||||||
|
<Compile Include="Handlers\JoinHandler.cs" />
|
||||||
|
<Compile Include="MySql.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="Server.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="App.config" />
|
||||||
|
<None Include="packages.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Framework.Shared\Framework.Shared.csproj">
|
||||||
|
<Project>{7130f249-1c23-438c-a077-76a2867f8c5e}</Project>
|
||||||
|
<Name>Framework.Shared</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
|
|
||||||
|
</Project>
|
||||||
33
C#/FiveM/Framework/Framework.Server/Handlers/JoinHandler.cs
Normal file
33
C#/FiveM/Framework/Framework.Server/Handlers/JoinHandler.cs
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
using System;
|
||||||
|
using CitizenFX.Core;
|
||||||
|
using CitizenFX.Core.Native;
|
||||||
|
using Framework.Server.Extensions;
|
||||||
|
using Framework.Shared.Models;
|
||||||
|
|
||||||
|
namespace Framework.Server.Handlers {
|
||||||
|
public static class JoinHandler {
|
||||||
|
|
||||||
|
public static readonly Vector3 Spawn = new Vector3(258.7932f, -942.7487f, 29.3940f);
|
||||||
|
|
||||||
|
public static async void OnPlayerJoining([FromSource] Player player) {
|
||||||
|
API.SetPlayerRoutingBucket(player.Handle, player.ServerId());
|
||||||
|
API.SetRoutingBucketPopulationEnabled(player.ServerId(), false);
|
||||||
|
API.SetRoutingBucketEntityLockdownMode(player.ServerId(), "strict");
|
||||||
|
API.SetPlayerInvincible(player.Handle, true);
|
||||||
|
|
||||||
|
var identifier = "steam:" + player.Identifiers["steam"];
|
||||||
|
var result = await MySql.FetchAll($"SELECT * FROM players WHERE owner = '{identifier}'");
|
||||||
|
|
||||||
|
if (result.Length == 0) player.TriggerEvent("client:spawn:register");
|
||||||
|
else player.TriggerEvent("client:spawn:choose", result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async void OnRegister([FromSource] Player player, dynamic dData) {
|
||||||
|
var data = new PlayerData(dData);
|
||||||
|
var identifier = "steam:" + player.Identifiers["steam"];
|
||||||
|
await MySql.Execute($"INSERT INTO players VALUES ('{identifier}', '{Guid.NewGuid()}', {data.sex}, {data.height}, '{data.firstName}', '{data.lastName}', '{data.birth}', '{data.skin}')");
|
||||||
|
player.Character.Position = Spawn;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
47
C#/FiveM/Framework/Framework.Server/MySql.cs
Normal file
47
C#/FiveM/Framework/Framework.Server/MySql.cs
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using MySql.Data.MySqlClient;
|
||||||
|
|
||||||
|
namespace Framework.Server {
|
||||||
|
public static class MySql {
|
||||||
|
|
||||||
|
private static MySqlConnection _connection;
|
||||||
|
|
||||||
|
public static void Initialize(string connectionString) {
|
||||||
|
_connection = new MySqlConnection(connectionString);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async Task Execute(string query) {
|
||||||
|
await _connection.OpenAsync();
|
||||||
|
var cmd = new MySqlCommand(query, _connection);
|
||||||
|
await cmd.ExecuteNonQueryAsync();
|
||||||
|
await _connection.CloseAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async Task<dynamic[]> FetchAll(string query) {
|
||||||
|
await _connection.OpenAsync();
|
||||||
|
var cmd = new MySqlCommand(query, _connection);
|
||||||
|
var result = await cmd.ExecuteReaderAsync();
|
||||||
|
|
||||||
|
List<dynamic> data = new List<dynamic>();
|
||||||
|
foreach (var record in result) {
|
||||||
|
data.Add(record);
|
||||||
|
}
|
||||||
|
|
||||||
|
await _connection.CloseAsync();
|
||||||
|
|
||||||
|
return data.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async Task<dynamic> FetchOne(string query) {
|
||||||
|
var result = await FetchAll(query);
|
||||||
|
return result[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async void CreateTables(params string[] querys) {
|
||||||
|
var query = string.Join(";", querys);
|
||||||
|
await Execute(query);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
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("Framework.Server")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("Framework.Server")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2022")]
|
||||||
|
[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("3B60C431-5ACF-4145-A792-32217A65A445")]
|
||||||
|
|
||||||
|
// 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")]
|
||||||
19
C#/FiveM/Framework/Framework.Server/Server.cs
Normal file
19
C#/FiveM/Framework/Framework.Server/Server.cs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
using CitizenFX.Core;
|
||||||
|
using Framework.Server.Handlers;
|
||||||
|
|
||||||
|
namespace Framework.Server {
|
||||||
|
public class Server : ServerScript {
|
||||||
|
|
||||||
|
public Server() {
|
||||||
|
MySql.Initialize("Server=213.136.89.237;Database=FiveM;Uid=FiveM;Pwd=uTwjt1nGX3nf.LHR;");
|
||||||
|
MySql.CreateTables(
|
||||||
|
"CREATE TABLE IF NOT EXISTS players (owner VARCHAR(100), charId VARCHAR(100), sex BOOLEAN, height INT(3), firstName VARCHAR(60), lastName VARCHAR(60), birth VARCHAR(10), skin LONGTEXT)"
|
||||||
|
);
|
||||||
|
|
||||||
|
EventHandlers["playerJoining"] += new Action<Player>(JoinHandler.OnPlayerJoining);
|
||||||
|
EventHandlers["server:spawn:register"] += new Action<Player, dynamic>(JoinHandler.OnRegister);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
// <autogenerated />
|
||||||
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
|
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")]
|
||||||
Binary file not shown.
@@ -0,0 +1 @@
|
|||||||
|
4fed6ec97924c777f9315f8ba3e5430e56649d63
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
D:\Programmierstuff\C#\FiveM\Framework\Framework.Server\obj\Release\Framework.Server.csproj.AssemblyReference.cache
|
||||||
|
D:\Programmierstuff\C#\FiveM\Framework\Framework.Server\obj\Release\Framework.Server.csproj.CoreCompileInputs.cache
|
||||||
|
D:\Programmierstuff\C#\FiveM\Framework\Framework.Server\obj\Release\Framework.Server.csproj.CopyComplete
|
||||||
|
D:\Programmierstuff\C#\FiveM\Framework\Build\fxmanifest.lua
|
||||||
|
D:\Programmierstuff\C#\FiveM\Framework\Build\stream\NativeUI.ytd
|
||||||
|
D:\Programmierstuff\C#\FiveM\Framework\Build\Framework.Server.net.dll
|
||||||
|
D:\Programmierstuff\C#\FiveM\Framework\Framework.Server\obj\Release\Framework.Server.net.dll
|
||||||
|
D:\Programmierstuff\C#\FiveM\Framework\Build\Framework.Server.net.dll.config
|
||||||
Binary file not shown.
4
C#/FiveM/Framework/Framework.Server/packages.config
Normal file
4
C#/FiveM/Framework/Framework.Server/packages.config
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="CitizenFX.Core.Server" version="1.0.6086" targetFramework="net481" />
|
||||||
|
</packages>
|
||||||
76
C#/FiveM/Framework/Framework.Shared/Framework.Shared.csproj
Normal file
76
C#/FiveM/Framework/Framework.Shared/Framework.Shared.csproj
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" DefaultTargets="Build" 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>{7130F249-1C23-438C-A077-76A2867F8C5E}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>Framework.Shared</RootNamespace>
|
||||||
|
<AssemblyName>Framework.Shared</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
<DebugType>embedded</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>../Build</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<PostBuildEvent>del Newtonsoft.Json.xml</PostBuildEvent>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="CitizenFX.Core.Client, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\CitizenFX.Core.Client.1.0.6086\lib\net45\CitizenFX.Core.Client.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.CSharp">
|
||||||
|
<HintPath>..\Librarys\Microsoft.CSharp.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Framework.cs" />
|
||||||
|
<Compile Include="Models\PlayerData.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="packages.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="fxmanifest.lua">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="stream\NativeUI.ytd">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
|
|
||||||
|
</Project>
|
||||||
5
C#/FiveM/Framework/Framework.Shared/Framework.cs
Normal file
5
C#/FiveM/Framework/Framework.Shared/Framework.cs
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
namespace Framework.Shared {
|
||||||
|
public class Framework {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
25
C#/FiveM/Framework/Framework.Shared/Models/PlayerData.cs
Normal file
25
C#/FiveM/Framework/Framework.Shared/Models/PlayerData.cs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
namespace Framework.Shared.Models {
|
||||||
|
public class PlayerData {
|
||||||
|
public string owner { get; set; }
|
||||||
|
public string charId { get; set; }
|
||||||
|
public bool sex { get; set; }
|
||||||
|
public int height { get; set; }
|
||||||
|
public string firstName { get; set; }
|
||||||
|
public string lastName { get; set; }
|
||||||
|
public string birth { get; set; }
|
||||||
|
public string skin { get; set; }
|
||||||
|
|
||||||
|
public PlayerData() {}
|
||||||
|
|
||||||
|
public PlayerData(dynamic data) {
|
||||||
|
owner = data.owner;
|
||||||
|
charId = data.charId;
|
||||||
|
sex = data.sex;
|
||||||
|
height = data.height;
|
||||||
|
firstName = data.firstName;
|
||||||
|
lastName = data.lastName;
|
||||||
|
birth = data.birth;
|
||||||
|
skin = data.skin;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
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("Framework.Shared")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("Framework.Shared")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2022")]
|
||||||
|
[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("7130F249-1C23-438C-A077-76A2867F8C5E")]
|
||||||
|
|
||||||
|
// 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")]
|
||||||
20
C#/FiveM/Framework/Framework.Shared/fxmanifest.lua
Normal file
20
C#/FiveM/Framework/Framework.Shared/fxmanifest.lua
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
fx_version 'cerulean'
|
||||||
|
games { 'gta5' }
|
||||||
|
|
||||||
|
author 'Leon hoppe <leon@ladenbau-hoppe.de>'
|
||||||
|
description 'FiveM Framework in C#'
|
||||||
|
version '1.0.0'
|
||||||
|
|
||||||
|
files {
|
||||||
|
'NativeUI.dll',
|
||||||
|
'MySql.Data.dll',
|
||||||
|
'Framework.Shared.dll'
|
||||||
|
}
|
||||||
|
|
||||||
|
client_scripts {
|
||||||
|
'Framework.Client.net.dll'
|
||||||
|
}
|
||||||
|
|
||||||
|
server_scripts {
|
||||||
|
'Framework.Server.net.dll'
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
// <autogenerated />
|
||||||
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
|
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")]
|
||||||
Binary file not shown.
@@ -0,0 +1 @@
|
|||||||
|
d47f7446bd39259a49dfcc86a02d7c33c1fdcdef
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
D:\Programmierstuff\C#\FiveM\Framework\Output\Framework.Shared.dll
|
||||||
|
D:\Programmierstuff\C#\FiveM\Framework\Framework.Shared\obj\Release\Framework.Shared.csproj.AssemblyReference.cache
|
||||||
|
D:\Programmierstuff\C#\FiveM\Framework\Framework.Shared\obj\Release\Framework.Shared.csproj.CoreCompileInputs.cache
|
||||||
|
D:\Programmierstuff\C#\FiveM\Framework\Framework.Shared\obj\Release\Framework.Shared.dll
|
||||||
|
D:\Programmierstuff\C#\FiveM\Framework\Build\Framework.Shared.dll
|
||||||
|
D:\Programmierstuff\C#\FiveM\Framework\Build\fxmanifest.lua
|
||||||
|
D:\Programmierstuff\C#\FiveM\Framework\Build\stream\NativeUI.ytd
|
||||||
Binary file not shown.
4
C#/FiveM/Framework/Framework.Shared/packages.config
Normal file
4
C#/FiveM/Framework/Framework.Shared/packages.config
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="CitizenFX.Core.Client" version="1.0.6086" targetFramework="net481" />
|
||||||
|
</packages>
|
||||||
BIN
C#/FiveM/Framework/Framework.Shared/stream/NativeUI.ytd
Normal file
BIN
C#/FiveM/Framework/Framework.Shared/stream/NativeUI.ytd
Normal file
Binary file not shown.
28
C#/FiveM/Framework/Framework.sln
Normal file
28
C#/FiveM/Framework/Framework.sln
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Framework.Server", "Framework.Server\Framework.Server.csproj", "{3B60C431-5ACF-4145-A792-32217A65A445}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Framework.Client", "Framework.Client\Framework.Client.csproj", "{4E52F164-32BF-40C6-978E-E91BB595C5B6}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Framework.Shared", "Framework.Shared\Framework.Shared.csproj", "{7130F249-1C23-438C-A077-76A2867F8C5E}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{3B60C431-5ACF-4145-A792-32217A65A445}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{3B60C431-5ACF-4145-A792-32217A65A445}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{3B60C431-5ACF-4145-A792-32217A65A445}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{3B60C431-5ACF-4145-A792-32217A65A445}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{4E52F164-32BF-40C6-978E-E91BB595C5B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{4E52F164-32BF-40C6-978E-E91BB595C5B6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{4E52F164-32BF-40C6-978E-E91BB595C5B6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{4E52F164-32BF-40C6-978E-E91BB595C5B6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{7130F249-1C23-438C-A077-76A2867F8C5E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{7130F249-1C23-438C-A077-76A2867F8C5E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{7130F249-1C23-438C-A077-76A2867F8C5E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{7130F249-1C23-438C-A077-76A2867F8C5E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
6
C#/FiveM/Framework/Framework.sln.DotSettings.user
Normal file
6
C#/FiveM/Framework/Framework.sln.DotSettings.user
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||||
|
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=D_003A_005CProgrammierstuff_005CC_0023_005CFiveM_005CFramework_005CLibrarys_005CMicrosoft_002ECSharp_002Edll/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=D_003A_005CProgrammierstuff_005CC_0023_005CFiveM_005CFramework_005CLibrarys_005CMySql_002EData_002Edll/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=D_003A_005CProgrammierstuff_005CC_0023_005CFiveM_005CFramework_005CLibrarys_005CNativeUI_002Edll/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=D_003A_005CProgrammierstuff_005CC_0023_005CFiveM_005CFramework_005CLibrarys_005CNewtonsoft_002EJson_002Edll/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:String x:Key="/Default/Environment/AssemblyExplorer/XmlDocument/@EntryValue"><AssemblyExplorer /></s:String></wpf:ResourceDictionary>
|
||||||
BIN
C#/FiveM/Framework/Librarys/Microsoft.CSharp.dll
Normal file
BIN
C#/FiveM/Framework/Librarys/Microsoft.CSharp.dll
Normal file
Binary file not shown.
BIN
C#/FiveM/Framework/Librarys/MySql.Data.dll
Normal file
BIN
C#/FiveM/Framework/Librarys/MySql.Data.dll
Normal file
Binary file not shown.
BIN
C#/FiveM/Framework/Librarys/NativeUI.dll
Normal file
BIN
C#/FiveM/Framework/Librarys/NativeUI.dll
Normal file
Binary file not shown.
BIN
C#/FiveM/Framework/packages/CitizenFX.Core.Client.1.0.6086/.signature.p7s
vendored
Normal file
BIN
C#/FiveM/Framework/packages/CitizenFX.Core.Client.1.0.6086/.signature.p7s
vendored
Normal file
Binary file not shown.
BIN
C#/FiveM/Framework/packages/CitizenFX.Core.Client.1.0.6086/CitizenFX.Core.Client.1.0.6086.nupkg
vendored
Normal file
BIN
C#/FiveM/Framework/packages/CitizenFX.Core.Client.1.0.6086/CitizenFX.Core.Client.1.0.6086.nupkg
vendored
Normal file
Binary file not shown.
BIN
C#/FiveM/Framework/packages/CitizenFX.Core.Client.1.0.6086/lib/net45/CitizenFX.Core.Client.dll
vendored
Normal file
BIN
C#/FiveM/Framework/packages/CitizenFX.Core.Client.1.0.6086/lib/net45/CitizenFX.Core.Client.dll
vendored
Normal file
Binary file not shown.
91041
C#/FiveM/Framework/packages/CitizenFX.Core.Client.1.0.6086/lib/net45/CitizenFX.Core.Client.xml
vendored
Normal file
91041
C#/FiveM/Framework/packages/CitizenFX.Core.Client.1.0.6086/lib/net45/CitizenFX.Core.Client.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
C#/FiveM/Framework/packages/CitizenFX.Core.Server.1.0.6086/.signature.p7s
vendored
Normal file
BIN
C#/FiveM/Framework/packages/CitizenFX.Core.Server.1.0.6086/.signature.p7s
vendored
Normal file
Binary file not shown.
BIN
C#/FiveM/Framework/packages/CitizenFX.Core.Server.1.0.6086/CitizenFX.Core.Server.1.0.6086.nupkg
vendored
Normal file
BIN
C#/FiveM/Framework/packages/CitizenFX.Core.Server.1.0.6086/CitizenFX.Core.Server.1.0.6086.nupkg
vendored
Normal file
Binary file not shown.
BIN
C#/FiveM/Framework/packages/CitizenFX.Core.Server.1.0.6086/lib/net45/CitizenFX.Core.Server.dll
vendored
Normal file
BIN
C#/FiveM/Framework/packages/CitizenFX.Core.Server.1.0.6086/lib/net45/CitizenFX.Core.Server.dll
vendored
Normal file
Binary file not shown.
12098
C#/FiveM/Framework/packages/CitizenFX.Core.Server.1.0.6086/lib/net45/CitizenFX.Core.Server.xml
vendored
Normal file
12098
C#/FiveM/Framework/packages/CitizenFX.Core.Server.1.0.6086/lib/net45/CitizenFX.Core.Server.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
12098
C#/FiveM/Framework/packages/CitizenFX.Core.Server.1.0.6086/lib/netstandard20/CitizenFX.Core.Server.xml
vendored
Normal file
12098
C#/FiveM/Framework/packages/CitizenFX.Core.Server.1.0.6086/lib/netstandard20/CitizenFX.Core.Server.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
|
|||||||
1772fe7811bac0b83ee8d664ce41b0555ef86dfc
|
013c2ec836ef86840647c3021efe5696cb2af808
|
||||||
|
|||||||
@@ -14,3 +14,10 @@ D:\Programmierstuff\C#\Mosleys\Output\Mosleys.Client.net.dll
|
|||||||
D:\Programmierstuff\C#\Mosleys\Mosleys.Client\obj\Release\Mosleys.Client.csproj.CopyComplete
|
D:\Programmierstuff\C#\Mosleys\Mosleys.Client\obj\Release\Mosleys.Client.csproj.CopyComplete
|
||||||
D:\Programmierstuff\C#\Mosleys\Output\fxmanifest.lua
|
D:\Programmierstuff\C#\Mosleys\Output\fxmanifest.lua
|
||||||
D:\Programmierstuff\C#\Mosleys\Output\settings.ini
|
D:\Programmierstuff\C#\Mosleys\Output\settings.ini
|
||||||
|
D:\Programmierstuff\C#\FiveM\Mosleys\Output\fxmanifest.lua
|
||||||
|
D:\Programmierstuff\C#\FiveM\Mosleys\Output\settings.ini
|
||||||
|
D:\Programmierstuff\C#\FiveM\Mosleys\Output\Mosleys.Client.net.dll
|
||||||
|
D:\Programmierstuff\C#\FiveM\Mosleys\Mosleys.Client\obj\Release\Mosleys.Client.csproj.AssemblyReference.cache
|
||||||
|
D:\Programmierstuff\C#\FiveM\Mosleys\Mosleys.Client\obj\Release\Mosleys.Client.csproj.CoreCompileInputs.cache
|
||||||
|
D:\Programmierstuff\C#\FiveM\Mosleys\Mosleys.Client\obj\Release\Mosleys.Client.csproj.CopyComplete
|
||||||
|
D:\Programmierstuff\C#\FiveM\Mosleys\Mosleys.Client\obj\Release\Mosleys.Client.net.dll
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
|
|||||||
534f4db9ea8ef7acfc1233e7413c6b4d36a209be
|
cf1b84c5c0fc10756383522327c0e0c06879ce8e
|
||||||
|
|||||||
@@ -18,3 +18,10 @@ D:\Programmierstuff\C#\Mosleys\Output\fxmanifest.lua
|
|||||||
D:\Programmierstuff\C#\Mosleys\Output\settings.ini
|
D:\Programmierstuff\C#\Mosleys\Output\settings.ini
|
||||||
D:\Programmierstuff\C#\Mosleys\Output\Mosleys.Server.net.dll
|
D:\Programmierstuff\C#\Mosleys\Output\Mosleys.Server.net.dll
|
||||||
D:\Programmierstuff\C#\Mosleys\Mosleys.Server\obj\Release\Mosleys.Server.net.dll
|
D:\Programmierstuff\C#\Mosleys\Mosleys.Server\obj\Release\Mosleys.Server.net.dll
|
||||||
|
D:\Programmierstuff\C#\FiveM\Mosleys\Output\fxmanifest.lua
|
||||||
|
D:\Programmierstuff\C#\FiveM\Mosleys\Output\settings.ini
|
||||||
|
D:\Programmierstuff\C#\FiveM\Mosleys\Output\Mosleys.Server.net.dll
|
||||||
|
D:\Programmierstuff\C#\FiveM\Mosleys\Mosleys.Server\obj\Release\Mosleys.Server.csproj.AssemblyReference.cache
|
||||||
|
D:\Programmierstuff\C#\FiveM\Mosleys\Mosleys.Server\obj\Release\Mosleys.Server.csproj.CoreCompileInputs.cache
|
||||||
|
D:\Programmierstuff\C#\FiveM\Mosleys\Mosleys.Server\obj\Release\Mosleys.Server.csproj.CopyComplete
|
||||||
|
D:\Programmierstuff\C#\FiveM\Mosleys\Mosleys.Server\obj\Release\Mosleys.Server.net.dll
|
||||||
|
|||||||
Binary file not shown.
@@ -191,7 +191,7 @@ namespace Nexd.ESX.Client {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int modTurbo {
|
public int modTurbo {
|
||||||
get => Raw.modTurbo;
|
get => Convert.ToInt32(Raw.modTurbo);
|
||||||
set => Raw.modTurbo = value;
|
set => Raw.modTurbo = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
|
|||||||
c84418636563b1fd6318339a01e7718fc7e6bb37
|
b0af6398e8ba0df7b34b458f8f87a55cec0e5e6b
|
||||||
|
|||||||
@@ -4,3 +4,9 @@ D:\Programmierstuff\C#\Mosleys\Mosleys.Shared\obj\Release\Mosleys.Shared.csproj.
|
|||||||
D:\Programmierstuff\C#\Mosleys\Mosleys.Shared\obj\Release\Mosleys.Shared.csproj.CoreCompileInputs.cache
|
D:\Programmierstuff\C#\Mosleys\Mosleys.Shared\obj\Release\Mosleys.Shared.csproj.CoreCompileInputs.cache
|
||||||
D:\Programmierstuff\C#\Mosleys\Mosleys.Shared\obj\Release\Mosleys.Shared.dll
|
D:\Programmierstuff\C#\Mosleys\Mosleys.Shared\obj\Release\Mosleys.Shared.dll
|
||||||
D:\Programmierstuff\C#\Mosleys\Mosleys.Shared\bin\Release\settings.ini
|
D:\Programmierstuff\C#\Mosleys\Mosleys.Shared\bin\Release\settings.ini
|
||||||
|
D:\Programmierstuff\C#\FiveM\Mosleys\Mosleys.Shared\bin\Release\fxmanifest.lua
|
||||||
|
D:\Programmierstuff\C#\FiveM\Mosleys\Mosleys.Shared\bin\Release\settings.ini
|
||||||
|
D:\Programmierstuff\C#\FiveM\Mosleys\Mosleys.Shared\bin\Release\Mosleys.Shared.dll
|
||||||
|
D:\Programmierstuff\C#\FiveM\Mosleys\Mosleys.Shared\obj\Release\Mosleys.Shared.csproj.AssemblyReference.cache
|
||||||
|
D:\Programmierstuff\C#\FiveM\Mosleys\Mosleys.Shared\obj\Release\Mosleys.Shared.csproj.CoreCompileInputs.cache
|
||||||
|
D:\Programmierstuff\C#\FiveM\Mosleys\Mosleys.Shared\obj\Release\Mosleys.Shared.dll
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,21 +0,0 @@
|
|||||||
fx_version 'cerulean'
|
|
||||||
games { 'gta5' }
|
|
||||||
|
|
||||||
-- details
|
|
||||||
author 'Leon Hoppe'
|
|
||||||
description "Mosley's"
|
|
||||||
version '2.0'
|
|
||||||
|
|
||||||
files {
|
|
||||||
'Newtonsoft.Json.dll',
|
|
||||||
'Mosleys.Shared.dll',
|
|
||||||
'settings.ini'
|
|
||||||
}
|
|
||||||
|
|
||||||
client_scripts {
|
|
||||||
'Mosleys.Client.net.dll'
|
|
||||||
}
|
|
||||||
|
|
||||||
server_scripts {
|
|
||||||
'Mosleys.Server.net.dll'
|
|
||||||
}
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
|
|
||||||
{[Blip]
|
|
||||||
Position [-41.5, -1676.1, 30]
|
|
||||||
Sprite 380
|
|
||||||
Color 44
|
|
||||||
Scale 1.0
|
|
||||||
}
|
|
||||||
|
|
||||||
{[General]
|
|
||||||
MenuTitle Mosley's
|
|
||||||
ExhibitPrice 500
|
|
||||||
TestDriveTime 90000
|
|
||||||
SpawnRadius 100.0
|
|
||||||
MinSellPrice 1000
|
|
||||||
SellBill 0.1
|
|
||||||
TargetSociety mechanic
|
|
||||||
|
|
||||||
ForbiddenVehicleClasses [10, 13, 14, 15, 16, 18, 19, 20, 21]
|
|
||||||
|
|
||||||
SellLocation [-30.6116, -1676.2323, 28.5]
|
|
||||||
SpawnLocation [3.556, -1652.677, 28.853, 229.645]
|
|
||||||
TestDriveLocation [-48.724, -1645.301, 29.034, 318.446]
|
|
||||||
DigitalShowPoint [-31.4151, -1663.9031, 29.5]
|
|
||||||
DigitalCamera [-24.2456, -1643.7988, 33.1410, 186.6901]
|
|
||||||
}
|
|
||||||
|
|
||||||
{[CarSlots]
|
|
||||||
0 [-24.969, -1651.355, 28.35, 258.833]
|
|
||||||
1 [-51.790, -1694.293, 28.35, 301.206]
|
|
||||||
2 [-56.162, -1690.660, 28.35, 298.664]
|
|
||||||
3 [-59.606, -1685.879, 28.35, 309.221]
|
|
||||||
4 [-53.514, -1678.981, 28.35, 301.604]
|
|
||||||
5 [-43.349, -1666.895, 28.35, 296.207]
|
|
||||||
6 [-35.946, -1657.419, 28.35, 144.485]
|
|
||||||
7 [-16.085, -1653.906, 28.35, 308.377]
|
|
||||||
8 [-27.076, -1657.913, 28.35, 286.712]
|
|
||||||
9 [-23.641, -1643.140, 28.35, 121.021]
|
|
||||||
10 [-18.106, -1645.940, 28.35, 132.801]
|
|
||||||
11 [-43.647, -1690.989, 28.35, 311.298]
|
|
||||||
12 [-47.901, -1688.066, 28.35, 306.442]
|
|
||||||
13 [-51.714, -1683.800, 28.35, 306.119]
|
|
||||||
}
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 4.0 KiB |
@@ -45,8 +45,8 @@
|
|||||||
right: 10px;
|
right: 10px;
|
||||||
*/
|
*/
|
||||||
position: relative;
|
position: relative;
|
||||||
top: 63%;
|
top: 50%;
|
||||||
left: 36.5%;
|
left: 40%;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
|
|
||||||
color: white;
|
color: white;
|
||||||
@@ -58,6 +58,7 @@
|
|||||||
align-items: center;*/
|
align-items: center;*/
|
||||||
|
|
||||||
background-image: url("img/fare2.png");
|
background-image: url("img/fare2.png");
|
||||||
|
transform: scale(0.7);
|
||||||
}
|
}
|
||||||
|
|
||||||
#fare {
|
#fare {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ DrawDistance 100.0
|
|||||||
VehicleSpawnPoint [911.108, -177.867, 74.283, 225.0]
|
VehicleSpawnPoint [911.108, -177.867, 74.283, 225.0]
|
||||||
VehicleDeleter [908.317, -183.070, 73.201]
|
VehicleDeleter [908.317, -183.070, 73.201]
|
||||||
VehicleModel taxi
|
VehicleModel taxi
|
||||||
TimeToNpcJob 20000
|
TimeToNpcJob 300000
|
||||||
}
|
}
|
||||||
|
|
||||||
{[Cloakroom]
|
{[Cloakroom]
|
||||||
|
|||||||
@@ -6,10 +6,6 @@ using CitizenFX.Core.Native;
|
|||||||
namespace TaxiJob.Client.Extensions {
|
namespace TaxiJob.Client.Extensions {
|
||||||
public static class EntityExtensions {
|
public static class EntityExtensions {
|
||||||
|
|
||||||
|
|
||||||
public static void SetDoorLockStatus(this Vehicle vehicle, LockStatus status) => API.SetVehicleDoorsLocked(vehicle.Handle, (int)status);
|
|
||||||
public static void SetNumberPlateText(this Vehicle vehicle, string plate) => API.SetVehicleNumberPlateText(vehicle.Handle, plate);
|
|
||||||
|
|
||||||
public static void Freeze(this Entity entity, bool toggle) => API.FreezeEntityPosition(entity.Handle, toggle);
|
public static void Freeze(this Entity entity, bool toggle) => API.FreezeEntityPosition(entity.Handle, toggle);
|
||||||
public static void AsMissionEntry(this Entity entity) => API.SetEntityAsMissionEntity(entity.Handle, true, false);
|
public static void AsMissionEntry(this Entity entity) => API.SetEntityAsMissionEntity(entity.Handle, true, false);
|
||||||
public static void SetBlockingOfNonTemporaryEvents(this Entity entity, bool toggle) => API.SetBlockingOfNonTemporaryEvents(entity.Handle, toggle);
|
public static void SetBlockingOfNonTemporaryEvents(this Entity entity, bool toggle) => API.SetBlockingOfNonTemporaryEvents(entity.Handle, toggle);
|
||||||
@@ -29,6 +25,7 @@ namespace TaxiJob.Client.Extensions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static async Task Load(this Model model) {
|
public static async Task Load(this Model model) {
|
||||||
|
if (model.IsLoaded) return;
|
||||||
API.RequestModel((uint)model.Hash);
|
API.RequestModel((uint)model.Hash);
|
||||||
while (!API.HasModelLoaded((uint)model.Hash)) {
|
while (!API.HasModelLoaded((uint)model.Hash)) {
|
||||||
await BaseScript.Delay(50);
|
await BaseScript.Delay(50);
|
||||||
@@ -36,15 +33,4 @@ namespace TaxiJob.Client.Extensions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum LockStatus {
|
|
||||||
None,
|
|
||||||
Unlocked,
|
|
||||||
Locked,
|
|
||||||
LockForPlayers,
|
|
||||||
LockForInVehicle,
|
|
||||||
LockedInitially,
|
|
||||||
ForceShutDoors,
|
|
||||||
LockedButCanBeDamaged
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -7,8 +7,15 @@ using TaxiJob.Client.Extensions;
|
|||||||
|
|
||||||
namespace TaxiJob.Client.Handler {
|
namespace TaxiJob.Client.Handler {
|
||||||
public static class CloakroomHandler {
|
public static class CloakroomHandler {
|
||||||
|
public static Blip JobBlip;
|
||||||
|
|
||||||
public static void OnTick() {
|
public static void OnTick() {
|
||||||
|
if (JobBlip == null) {
|
||||||
|
var pos = TaxiJob.Config.Cloakroom.Position;
|
||||||
|
JobBlip = new Blip(API.AddBlipForCoord(pos.X, pos.Y, pos.Y));
|
||||||
|
BaseScript.TriggerEvent("esx_jobs:setBlipStyle", JobBlip.Handle);
|
||||||
|
}
|
||||||
|
|
||||||
var dist = World.GetDistance(Game.PlayerPed.Position, TaxiJob.Config.Cloakroom.Position);
|
var dist = World.GetDistance(Game.PlayerPed.Position, TaxiJob.Config.Cloakroom.Position);
|
||||||
if (dist >= TaxiJob.Config.DrawDistance) return;
|
if (dist >= TaxiJob.Config.DrawDistance) return;
|
||||||
|
|
||||||
@@ -47,8 +54,10 @@ namespace TaxiJob.Client.Handler {
|
|||||||
var menu = new ESX.UI.Menu(dMenu);
|
var menu = new ESX.UI.Menu(dMenu);
|
||||||
|
|
||||||
if (data.current.name == "default") {
|
if (data.current.name == "default") {
|
||||||
|
JobHandler.StopJob(false);
|
||||||
BaseScript.TriggerEvent("skinchanger:loadSkin", skins.first);
|
BaseScript.TriggerEvent("skinchanger:loadSkin", skins.first);
|
||||||
TaxiJob.InDuty = false;
|
TaxiJob.InDuty = false;
|
||||||
|
TaxiJob.SetServiceStatus(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.current.name == "work") {
|
if (data.current.name == "work") {
|
||||||
|
|||||||
@@ -1,38 +1,61 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using CitizenFX.Core;
|
using CitizenFX.Core;
|
||||||
using CitizenFX.Core.Native;
|
using CitizenFX.Core.Native;
|
||||||
using CitizenFX.Core.UI;
|
using CitizenFX.Core.UI;
|
||||||
using Nexd.ESX.Client;
|
using Nexd.ESX.Client;
|
||||||
using TaxiJob.Client.Extensions;
|
using TaxiJob.Client.Extensions;
|
||||||
|
using TaxiJob.Shared;
|
||||||
|
|
||||||
namespace TaxiJob.Client.Handler {
|
namespace TaxiJob.Client.Handler {
|
||||||
public static class JobHandler {
|
public static class JobHandler {
|
||||||
private static bool _vehicleSpawned;
|
private static bool _vehicleSpawned;
|
||||||
private static Vehicle _vehicle;
|
|
||||||
private static Blip _vehicleBlip;
|
private static Blip _vehicleBlip;
|
||||||
private static Blip _taskBlip;
|
private static Blip _taskBlip;
|
||||||
|
|
||||||
private static int _lastJob;
|
private static int _lastJob;
|
||||||
private static bool _inJob;
|
|
||||||
private static bool _isNpcJob;
|
|
||||||
private static bool _arrived;
|
private static bool _arrived;
|
||||||
private static bool _lookStarted;
|
private static bool _lookStarted;
|
||||||
private static Ped _npc;
|
private static Ped _npc;
|
||||||
private static int _nextSpeech;
|
private static int _nextSpeech;
|
||||||
|
|
||||||
|
private static int _lastUpdate = 0;
|
||||||
|
private static Vector3 _lastPos = Vector3.Zero;
|
||||||
|
private static int _requestTime = 0;
|
||||||
|
|
||||||
|
public static Vehicle Vehicle;
|
||||||
|
public static bool InJob;
|
||||||
|
public static bool PendingJob;
|
||||||
|
public static bool IsNpcJob;
|
||||||
|
public static Vector3 Destination;
|
||||||
|
public static string JobId;
|
||||||
|
|
||||||
|
public static void RequestJob(Vector3 destination, string jobId) {
|
||||||
|
_requestTime = Game.GameTime;
|
||||||
|
Destination = destination;
|
||||||
|
JobId = jobId;
|
||||||
|
PendingJob = true;
|
||||||
|
TaxiJob.SetServiceStatus(false);
|
||||||
|
}
|
||||||
|
|
||||||
public static void OnTick() {
|
public static void OnTick() {
|
||||||
HandleVehicleSpawner();
|
HandleVehicleSpawner();
|
||||||
HandleVehicleDeleter();
|
HandleVehicleDeleter();
|
||||||
HandleVehicleBlip();
|
HandleVehicleBlip();
|
||||||
HandleNpcJob();
|
HandleNpcJob();
|
||||||
HandleJob();
|
HandleJob();
|
||||||
|
HandleJobAcception();
|
||||||
|
|
||||||
if (!_inJob && _vehicleSpawned && _vehicleBlip == null && Game.GameTime - _lastJob >= TaxiJob.Config.TimeToNpcJob) {
|
if (!InJob && _vehicleSpawned && _vehicleBlip == null && Game.GameTime - _lastJob >= TaxiJob.Config.TimeToNpcJob && !PendingJob) {
|
||||||
StartNpcJob();
|
IsNpcJob = true;
|
||||||
|
_requestTime = Game.GameTime;
|
||||||
|
PendingJob = true;
|
||||||
|
TaxiJob.SetServiceStatus(false);
|
||||||
|
Game.PlaySound("SELECT", "HUD_FRONTEND_DEFAULT_SOUNDSET");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Game.PlayerPed.IsDead && _inJob) StopJob();
|
if (Game.PlayerPed.IsDead && InJob) StopJob();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async void HandleVehicleSpawner() {
|
private static async void HandleVehicleSpawner() {
|
||||||
@@ -45,34 +68,40 @@ namespace TaxiJob.Client.Handler {
|
|||||||
Screen.DisplayHelpTextThisFrame("Drücke ~INPUT_CONTEXT~ um das Taxi aus der Garage zu holen");
|
Screen.DisplayHelpTextThisFrame("Drücke ~INPUT_CONTEXT~ um das Taxi aus der Garage zu holen");
|
||||||
|
|
||||||
if (Game.IsControlJustReleased(0, Control.Context)) {
|
if (Game.IsControlJustReleased(0, Control.Context)) {
|
||||||
|
if (!await TaxiJob.ServerCallback<bool>("esx_license:hasLicense", "drive")) {
|
||||||
|
Notify.Error("Du hast keinen Führerschein!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!ESX.Game.IsSpawnPointClear(TaxiJob.Config.VehicleSpawnPoint.ToVector3(), 5.0)) {
|
if (!ESX.Game.IsSpawnPointClear(TaxiJob.Config.VehicleSpawnPoint.ToVector3(), 5.0)) {
|
||||||
Notify.Error("Ein Fahrzeug blockiert den Spawnpunkt!");
|
Notify.Error("Ein Fahrzeug blockiert den Spawnpunkt!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_vehicle = await TaxiJob.SpawnVehicle(API.GetHashKey(TaxiJob.Config.VehicleModel), TaxiJob.Config.VehicleSpawnPoint);
|
Vehicle = await TaxiJob.SpawnVehicle(API.GetHashKey(TaxiJob.Config.VehicleModel), TaxiJob.Config.VehicleSpawnPoint);
|
||||||
_vehicle.SetNumberPlateText(await TaxiJob.GeneratePlate());
|
Vehicle.Mods.LicensePlate = await TaxiJob.GeneratePlate();
|
||||||
BaseScript.TriggerEvent("craftix:refuelVehicle", _vehicle.Handle);
|
BaseScript.TriggerEvent("craftix:refuelVehicle", Vehicle.Handle);
|
||||||
Game.PlayerPed.SetIntoVehicle(_vehicle, VehicleSeat.Driver);
|
Game.PlayerPed.SetIntoVehicle(Vehicle, VehicleSeat.Driver);
|
||||||
_lastJob = Game.GameTime;
|
_lastJob = Game.GameTime;
|
||||||
_vehicleSpawned = true;
|
_vehicleSpawned = true;
|
||||||
|
TaxiJob.SetServiceStatus(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void HandleVehicleDeleter() {
|
private static void HandleVehicleDeleter() {
|
||||||
if (_vehicleSpawned) {
|
if (_vehicleSpawned) {
|
||||||
if (!_vehicle.Exists() || _vehicle.IsDead) {
|
if (!Vehicle.Exists() || Vehicle.IsDead) {
|
||||||
_vehicleBlip?.Delete();
|
_vehicleBlip?.Delete();
|
||||||
StopJob();
|
StopJob();
|
||||||
_vehicleSpawned = false;
|
_vehicleSpawned = false;
|
||||||
_vehicleBlip = null;
|
_vehicleBlip = null;
|
||||||
_vehicle = null;
|
Vehicle = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_vehicleSpawned || !Game.PlayerPed.IsInVehicle(_vehicle)) return;
|
if (!_vehicleSpawned || !Game.PlayerPed.IsInVehicle(Vehicle)) return;
|
||||||
World.DrawMarker(MarkerType.HorizontalCircleSkinny, TaxiJob.Config.VehicleDeleter, Vector3.Zero, Vector3.Zero, new Vector3(3.7f, 3.7f, 0.2f), TaxiJob.Config.VehicleSpawner.Color);
|
World.DrawMarker(MarkerType.HorizontalCircleSkinny, TaxiJob.Config.VehicleDeleter, Vector3.Zero, Vector3.Zero, new Vector3(3.7f, 3.7f, 0.2f), TaxiJob.Config.VehicleSpawner.Color);
|
||||||
|
|
||||||
var dist = World.GetDistance(Game.PlayerPed.Position, TaxiJob.Config.VehicleDeleter);
|
var dist = World.GetDistance(Game.PlayerPed.Position, TaxiJob.Config.VehicleDeleter);
|
||||||
@@ -80,19 +109,21 @@ namespace TaxiJob.Client.Handler {
|
|||||||
|
|
||||||
Screen.DisplayHelpTextThisFrame("Drücke ~INPUT_CONTEXT~ um das Auto in die Garage zu stellen");
|
Screen.DisplayHelpTextThisFrame("Drücke ~INPUT_CONTEXT~ um das Auto in die Garage zu stellen");
|
||||||
if (Game.IsControlJustReleased(0, Control.Context)) {
|
if (Game.IsControlJustReleased(0, Control.Context)) {
|
||||||
_vehicle?.Delete();
|
Vehicle?.Delete();
|
||||||
_vehicleBlip?.Delete();
|
_vehicleBlip?.Delete();
|
||||||
StopJob();
|
StopJob();
|
||||||
_vehicleSpawned = false;
|
_vehicleSpawned = false;
|
||||||
_vehicleBlip = null;
|
_vehicleBlip = null;
|
||||||
_vehicle = null;
|
Vehicle = null;
|
||||||
|
Taximeter.Reset();
|
||||||
|
TaxiJob.SetServiceStatus(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void HandleVehicleBlip() {
|
private static void HandleVehicleBlip() {
|
||||||
if (!_vehicleSpawned) return;
|
if (!_vehicleSpawned) return;
|
||||||
|
|
||||||
var inVehicle = Game.PlayerPed.IsInVehicle(_vehicle);
|
var inVehicle = Game.PlayerPed.IsInVehicle(Vehicle);
|
||||||
if (inVehicle && _vehicleBlip != null) {
|
if (inVehicle && _vehicleBlip != null) {
|
||||||
_lastJob = Game.GameTime;
|
_lastJob = Game.GameTime;
|
||||||
_vehicleBlip?.Delete();
|
_vehicleBlip?.Delete();
|
||||||
@@ -106,25 +137,50 @@ namespace TaxiJob.Client.Handler {
|
|||||||
_vehicleBlip.Name = "Dienstwagen";
|
_vehicleBlip.Name = "Dienstwagen";
|
||||||
API.SetBlipDisplay(_vehicleBlip.Handle, 4);
|
API.SetBlipDisplay(_vehicleBlip.Handle, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (inVehicle && Game.IsControlJustReleased(0, Control.SelectCharacterFranklin)) {
|
||||||
|
if (TaxiMenuHandler.MenuOpen) TaxiMenuHandler.CloseMenu();
|
||||||
|
else TaxiMenuHandler.OpenMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (inVehicle) HandleTaximeter();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void HandleJob() {
|
private static void HandleJob() {
|
||||||
if (!_inJob || _isNpcJob) return;
|
if (!InJob || IsNpcJob) return;
|
||||||
|
|
||||||
if (!_arrived) {
|
if (!_arrived && _taskBlip != null) {
|
||||||
if (!Game.PlayerPed.IsInVehicle()) return;
|
if (!Game.PlayerPed.IsInVehicle()) return;
|
||||||
var dist = World.GetDistance(Game.PlayerPed.Position, _taskBlip.Position);
|
var dist = World.GetDistance(Game.PlayerPed.CurrentVehicle.Position, _taskBlip.Position);
|
||||||
|
|
||||||
if (dist <= 30.0 && Game.PlayerPed.CurrentVehicle.Speed <= 1) {
|
if (dist <= 30.0 && Game.PlayerPed.CurrentVehicle.Speed <= 1) {
|
||||||
_taskBlip.Delete();
|
_taskBlip.Delete();
|
||||||
_taskBlip = null;
|
_taskBlip = null;
|
||||||
_arrived = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_arrived && Game.PlayerPed.CurrentVehicle?.PassengerCount != 0) {
|
||||||
|
_arrived = true;
|
||||||
|
Taximeter.ActivateForClient(true);
|
||||||
|
|
||||||
|
_taskBlip?.Delete();
|
||||||
|
_taskBlip = null;
|
||||||
|
|
||||||
|
Taximeter.Attributes.CurrentFare = "000.00";
|
||||||
|
Taximeter.Attributes.DistanceTraveled = 0;
|
||||||
|
Taximeter.Pause(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_arrived && Game.PlayerPed.CurrentVehicle?.PassengerCount == 0) {
|
||||||
|
var price = (int)Math.Round(Convert.ToSingle(Taximeter.Attributes.CurrentFare) + 0.5f);
|
||||||
|
BaseScript.TriggerServerEvent("taxijob:server:bill", price, Taximeter.CurrentClient);
|
||||||
|
BaseScript.TriggerServerEvent("taxijob:server:payout", (int)Math.Floor(price * 0.9f));
|
||||||
|
StopJob();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void HandleNpcJob() {
|
private static void HandleNpcJob() {
|
||||||
if (!_inJob || !_isNpcJob) return;
|
if (!InJob || !IsNpcJob) return;
|
||||||
|
|
||||||
|
|
||||||
if (!_arrived) {
|
if (!_arrived) {
|
||||||
@@ -172,20 +228,68 @@ namespace TaxiJob.Client.Handler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (dist <= 30.0 && Game.PlayerPed.CurrentVehicle.Speed <= 1) {
|
if (dist <= 30.0 && Game.PlayerPed.CurrentVehicle.Speed <= 1) {
|
||||||
_inJob = false;
|
InJob = false;
|
||||||
_npc.Task.LeaveVehicle(_npc.CurrentVehicle, true);
|
_npc.Task.LeaveVehicle(_npc.CurrentVehicle, true);
|
||||||
_npc.PlayAmbientSpeech("GENERIC_THANKS");
|
_npc.PlayAmbientSpeech("GENERIC_THANKS");
|
||||||
_npc.MarkAsNoLongerNeeded();
|
_npc.MarkAsNoLongerNeeded();
|
||||||
_npc = null;
|
_npc = null;
|
||||||
|
|
||||||
|
var price = (int)Math.Floor(Convert.ToSingle(Taximeter.Attributes.CurrentFare) * 0.9f);
|
||||||
StopJob();
|
StopJob();
|
||||||
Notify.Success("Auftrag beendet!");
|
BaseScript.TriggerServerEvent("taxijob:server:payout", price);
|
||||||
|
Notify.Success($"Auftrag beendet!\nDu hast ${price} bekommen.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void HandleTaximeter() {
|
||||||
|
if (!InJob || Taximeter.Attributes.MeterPause || Taximeter.Attributes.DistanceTraveled >= 15000) return;
|
||||||
|
var current = Game.GameTime;
|
||||||
|
if (current - _lastUpdate < 2000) return;
|
||||||
|
_lastUpdate = current;
|
||||||
|
var pos = Game.PlayerPed.CurrentVehicle.Position;
|
||||||
|
if (_lastPos == Vector3.Zero) _lastPos = pos;
|
||||||
|
Taximeter.CalculatePrice(_lastPos, pos);
|
||||||
|
_lastPos = pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void HandleJobAcception() {
|
||||||
|
if (!PendingJob) return;
|
||||||
|
Screen.DisplayHelpTextThisFrame("Neuer Auftrag!~n~~INPUT_SELECT_WEAPON_UNARMED~ Annehmen~n~~INPUT_SELECT_WEAPON_MELEE~ Ablehnen");
|
||||||
|
|
||||||
|
if (Game.IsControlJustReleased(0, Control.SelectWeaponUnarmed)) {
|
||||||
|
if (IsNpcJob) StartNpcJob();
|
||||||
|
else {
|
||||||
|
BaseScript.TriggerServerEvent("taxijob:server:accept", true, JobId);
|
||||||
|
StartJob();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Game.IsControlJustReleased(0, Control.SelectWeaponMelee) || Game.GameTime - _requestTime > 30000) {
|
||||||
|
BaseScript.TriggerServerEvent("taxijob:server:accept", false, JobId);
|
||||||
|
StopJob();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void StartJob() {
|
||||||
|
TaxiMenuHandler.CloseMenu();
|
||||||
|
Taximeter.Reset(Taximeter.Attributes.MeterVisible);
|
||||||
|
var dest = Destination;
|
||||||
|
StopJob(false);
|
||||||
|
TaxiJob.SetServiceStatus(false);
|
||||||
|
|
||||||
|
_taskBlip = new Blip(API.AddBlipForCoord(dest.X, dest.Y, dest.Z));
|
||||||
|
_taskBlip.Name = "Kunde";
|
||||||
|
_taskBlip.ShowRoute = true;
|
||||||
|
|
||||||
|
InJob = true;
|
||||||
|
}
|
||||||
|
|
||||||
private static async void StartNpcJob() {
|
private static async void StartNpcJob() {
|
||||||
Notify.Info("Neuer Auftrag!");
|
TaxiMenuHandler.CloseMenu();
|
||||||
StopJob();
|
Taximeter.Reset(Taximeter.Attributes.MeterVisible);
|
||||||
|
StopJob(false);
|
||||||
|
TaxiJob.SetServiceStatus(false);
|
||||||
|
|
||||||
var target = TaxiJob.Config.Positions.Random();
|
var target = TaxiJob.Config.Positions.Random();
|
||||||
_taskBlip = new Blip(API.AddBlipForCoord(target.X, target.Y, target.Z));
|
_taskBlip = new Blip(API.AddBlipForCoord(target.X, target.Y, target.Z));
|
||||||
@@ -201,11 +305,13 @@ namespace TaxiJob.Client.Handler {
|
|||||||
_npc.SetBlockingOfNonTemporaryEvents(true);
|
_npc.SetBlockingOfNonTemporaryEvents(true);
|
||||||
_npc.IsInvincible = true;
|
_npc.IsInvincible = true;
|
||||||
_npc.Task.StandStill(int.MaxValue);
|
_npc.Task.StandStill(int.MaxValue);
|
||||||
_isNpcJob = true;
|
IsNpcJob = true;
|
||||||
_inJob = true;
|
InJob = true;
|
||||||
|
|
||||||
|
Taximeter.Pause(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void StopJob() {
|
public static void StopJob(bool updateService = true) {
|
||||||
_taskBlip?.Delete();
|
_taskBlip?.Delete();
|
||||||
_taskBlip = null;
|
_taskBlip = null;
|
||||||
|
|
||||||
@@ -213,11 +319,18 @@ namespace TaxiJob.Client.Handler {
|
|||||||
_npc?.MarkAsNoLongerNeeded();
|
_npc?.MarkAsNoLongerNeeded();
|
||||||
_npc = null;
|
_npc = null;
|
||||||
|
|
||||||
_inJob = false;
|
InJob = false;
|
||||||
_isNpcJob = false;
|
IsNpcJob = false;
|
||||||
_arrived = false;
|
_arrived = false;
|
||||||
_lookStarted = false;
|
_lookStarted = false;
|
||||||
_lastJob = Game.GameTime;
|
_lastJob = Game.GameTime;
|
||||||
|
PendingJob = false;
|
||||||
|
Destination = Vector3.Zero;
|
||||||
|
JobId = null;
|
||||||
|
|
||||||
|
Taximeter.Pause(true);
|
||||||
|
if (updateService) TaxiJob.SetServiceStatus(true);
|
||||||
|
Taximeter.ActivateForClient(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
146
C#/FiveM/TaxiJob/TaxiJob.Client/Handler/NpcTaxiHandler.cs
Normal file
146
C#/FiveM/TaxiJob/TaxiJob.Client/Handler/NpcTaxiHandler.cs
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
using System;
|
||||||
|
using CitizenFX.Core;
|
||||||
|
using CitizenFX.Core.Native;
|
||||||
|
using CitizenFX.Core.UI;
|
||||||
|
using TaxiJob.Client.Extensions;
|
||||||
|
|
||||||
|
namespace TaxiJob.Client.Handler {
|
||||||
|
public static class NpcTaxiHandler {
|
||||||
|
public static bool IsCustomer;
|
||||||
|
private static Vehicle _taxi;
|
||||||
|
private static Blip _blip;
|
||||||
|
private static Ped _driver;
|
||||||
|
|
||||||
|
private static bool _arrived;
|
||||||
|
private static bool _hasDestination;
|
||||||
|
private static Vector3 _destination;
|
||||||
|
private static bool _atDestination;
|
||||||
|
private static int _lastUpdate;
|
||||||
|
private static Vector3 _lastPosition;
|
||||||
|
private static bool _pause;
|
||||||
|
|
||||||
|
public static async void StartNpcJob() {
|
||||||
|
if (IsCustomer) return;
|
||||||
|
await BaseScript.Delay(5000);
|
||||||
|
Notify.Info("Ein Taxi ist auf dem Weg zu ihnen!");
|
||||||
|
var spawn = GetDistantSpawn(700);
|
||||||
|
|
||||||
|
// Spawn Taxi
|
||||||
|
var model = (Model)VehicleHash.Taxi;
|
||||||
|
await model.Load();
|
||||||
|
_taxi = await World.CreateVehicle(model, spawn.ToVector3(), spawn.W);
|
||||||
|
_taxi.Mods.LicensePlate = await TaxiJob.GeneratePlate();
|
||||||
|
_taxi.AsMissionEntry();
|
||||||
|
TaxiJob.SetFuel(_taxi, 100.0f);
|
||||||
|
|
||||||
|
// Blip
|
||||||
|
_blip = new Blip(API.AddBlipForEntity(_taxi.Handle));
|
||||||
|
_blip.Sprite = (BlipSprite)198;
|
||||||
|
_blip.Color = BlipColor.Yellow;
|
||||||
|
_blip.Name = "Taxi";
|
||||||
|
|
||||||
|
// Driver
|
||||||
|
model = new Model(-573920724);
|
||||||
|
await model.Load();
|
||||||
|
_driver = await World.CreatePed(model, spawn.ToVector3());
|
||||||
|
_driver.SetIntoVehicle(_taxi, VehicleSeat.Driver);
|
||||||
|
_driver.CanBeTargetted = false;
|
||||||
|
_driver.AsMissionEntry();
|
||||||
|
|
||||||
|
// Drive to Player
|
||||||
|
_driver.Task.DriveTo(_taxi, World.GetNextPositionOnStreet(Game.PlayerPed.Position), 10f, 20f, 262975);
|
||||||
|
Taximeter.Reset();
|
||||||
|
_lastPosition = _taxi.Position;
|
||||||
|
Taximeter.Pause(false);
|
||||||
|
_arrived = false;
|
||||||
|
_pause = false;
|
||||||
|
IsCustomer = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void OnTick() {
|
||||||
|
if (!_driver.IsInVehicle(_taxi)) {
|
||||||
|
TaxiJob.SetFuel(_taxi, 0.0f);
|
||||||
|
IsCustomer = false;
|
||||||
|
_blip?.Delete();
|
||||||
|
_blip = null;
|
||||||
|
Taximeter.Reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_arrived && Game.PlayerPed.IsInVehicle(_taxi)) {
|
||||||
|
_arrived = true;
|
||||||
|
_atDestination = false;
|
||||||
|
_hasDestination = false;
|
||||||
|
_driver.PlayAmbientSpeech("GENERIC_HI");
|
||||||
|
_blip?.Delete();
|
||||||
|
_blip = null;
|
||||||
|
Taximeter.SetVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_arrived && !_hasDestination && World.WaypointPosition != Vector3.Zero) {
|
||||||
|
_hasDestination = true;
|
||||||
|
_destination = World.GetNextPositionOnStreet(World.WaypointPosition);
|
||||||
|
_driver.Task.DriveTo(_taxi, _destination, 10f, 20f, 262975);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_hasDestination && !_atDestination && World.GetDistance(_taxi.Position, _destination) <= 10.5f && !Game.PlayerPed.IsInVehicle(_taxi)) {
|
||||||
|
_atDestination = true;
|
||||||
|
|
||||||
|
var price = (int)Math.Round(Convert.ToSingle(Taximeter.Attributes.CurrentFare) + 0.5f);
|
||||||
|
BaseScript.TriggerServerEvent("taxijob:server:bill", price, Game.Player.ServerId);
|
||||||
|
|
||||||
|
Taximeter.Reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_atDestination && World.GetDistance(_taxi.Position, Game.PlayerPed.Position) >= 5) {
|
||||||
|
_taxi.MarkAsNoLongerNeeded();
|
||||||
|
_driver.MarkAsNoLongerNeeded();
|
||||||
|
|
||||||
|
_hasDestination = false;
|
||||||
|
_destination = Vector3.Zero;
|
||||||
|
_atDestination = false;
|
||||||
|
_taxi = null;
|
||||||
|
_driver = null;
|
||||||
|
IsCustomer = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var current = Game.GameTime;
|
||||||
|
if (current - _lastUpdate >= 2000) {
|
||||||
|
_lastUpdate = current;
|
||||||
|
Taximeter.CalculatePrice(_lastPosition, _taxi.Position);
|
||||||
|
_lastPosition = _taxi.Position;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(_hasDestination && !_atDestination)) return;
|
||||||
|
|
||||||
|
Screen.DisplayHelpTextThisFrame("Drücke ~INPUT_VEH_SHUFFLE~ um die Fahrt " + (_pause ? "fortzusetzen" : "zu pausieren"));
|
||||||
|
if (Game.IsControlJustReleased(0, Control.VehicleShuffle)) {
|
||||||
|
if (_pause) {
|
||||||
|
if (World.WaypointPosition != Vector3.Zero) _destination = World.GetNextPositionOnStreet(World.WaypointPosition);
|
||||||
|
_driver?.Task.DriveTo(_taxi, _destination, 10f, 20f, 262975);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_driver?.Task.DriveTo(_taxi, _taxi.Position + (_taxi.ForwardVector * 20f), 10f, 5f, 262975);
|
||||||
|
}
|
||||||
|
_pause = !_pause;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Game.PlayerPed.IsInVehicle(_taxi)) {
|
||||||
|
_atDestination = true;
|
||||||
|
|
||||||
|
var price = (int)Math.Round(Convert.ToSingle(Taximeter.Attributes.CurrentFare) + 0.5f);
|
||||||
|
BaseScript.TriggerServerEvent("taxijob:server:bill", price, Game.Player.ServerId);
|
||||||
|
|
||||||
|
Taximeter.Reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Vector4 GetDistantSpawn(int distance) {
|
||||||
|
Vector3 player = Game.PlayerPed.Position;
|
||||||
|
Vector3 location = Vector3.Zero;
|
||||||
|
float heading = 0f;
|
||||||
|
int unused = 0;
|
||||||
|
API.GetNthClosestVehicleNodeWithHeading(player.X, player.Y, player.Z, distance, ref location, ref heading, ref unused, 9, 3.0f, 2.5f);
|
||||||
|
return new Vector4(location, heading);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
129
C#/FiveM/TaxiJob/TaxiJob.Client/Handler/TaxiMenuHandler.cs
Normal file
129
C#/FiveM/TaxiJob/TaxiJob.Client/Handler/TaxiMenuHandler.cs
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using CitizenFX.Core;
|
||||||
|
using CitizenFX.Core.Native;
|
||||||
|
using Nexd.ESX.Client;
|
||||||
|
|
||||||
|
namespace TaxiJob.Client.Handler {
|
||||||
|
public class TaxiMenuHandler {
|
||||||
|
public static bool MenuOpen = false;
|
||||||
|
private static ESX.UI.Menu _currentMenu;
|
||||||
|
|
||||||
|
public static void OpenMenu() {
|
||||||
|
var elements = new List<ESX.UI.MenuElement>();
|
||||||
|
|
||||||
|
if (JobHandler.InJob) {
|
||||||
|
elements.Add(new ESX.UI.MenuElement {
|
||||||
|
label = "Auftrag beenden",
|
||||||
|
name = "cancel_job"
|
||||||
|
});
|
||||||
|
} else if (Game.PlayerPed.CurrentVehicle?.PassengerCount > 0) {
|
||||||
|
elements.Add(new ESX.UI.MenuElement {
|
||||||
|
label = "Auftrag starten",
|
||||||
|
name = "start_job"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
elements.Add(new ESX.UI.MenuElement {
|
||||||
|
label = Taximeter.Attributes.MeterVisible ? "Taximeter aus" : " Taximeter an",
|
||||||
|
name = "toggle_taximeter"
|
||||||
|
});
|
||||||
|
|
||||||
|
if (Taximeter.Attributes.MeterVisible) {
|
||||||
|
elements.AddRange(new [] {
|
||||||
|
new ESX.UI.MenuElement {
|
||||||
|
label = Taximeter.Attributes.MeterPause ? "Taximeter fortsetzen" : "Taximeter anhalten",
|
||||||
|
name = "pause_taximeter"
|
||||||
|
},
|
||||||
|
new ESX.UI.MenuElement {
|
||||||
|
label = "Taximeter zurücksetzen",
|
||||||
|
name = "reset_taximeter"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!JobHandler.IsNpcJob) {
|
||||||
|
elements.Add(new ESX.UI.MenuElement {
|
||||||
|
label = "Tarif ändern",
|
||||||
|
name = "change_rate"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var menuData = new ESX.UI.MenuData {
|
||||||
|
align = "top-left",
|
||||||
|
title = "Taxi",
|
||||||
|
elements = elements
|
||||||
|
};
|
||||||
|
|
||||||
|
ESX.UI.Menu.CloseAll();
|
||||||
|
_currentMenu = ESX.UI.Menu.Open("default", API.GetCurrentResourceName(), "taxi_menu", menuData, (dData, dMenu) => {
|
||||||
|
var data = new ESX.UI.MenuData(dData);
|
||||||
|
var menu = new ESX.UI.Menu(dMenu);
|
||||||
|
|
||||||
|
if (data.current.name == "cancel_job") {
|
||||||
|
JobHandler.StopJob();
|
||||||
|
menu.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.current.name == "start_job") {
|
||||||
|
if (!Game.PlayerPed.IsInVehicle(JobHandler.Vehicle)) return;
|
||||||
|
var passanger = JobHandler.Vehicle.Passengers.First(ped => ped?.Handle != 0);
|
||||||
|
Taximeter.CurrentClient = API.GetPlayerServerId(API.NetworkGetPlayerIndexFromPed(passanger.Handle));
|
||||||
|
JobHandler.StartJob();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.current.name == "toggle_taximeter") {
|
||||||
|
Taximeter.Toggle();
|
||||||
|
OpenMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.current.name == "pause_taximeter") {
|
||||||
|
Taximeter.Pause();
|
||||||
|
OpenMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.current.name == "reset_taximeter") {
|
||||||
|
Taximeter.Reset(Taximeter.Attributes.MeterVisible);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.current.name == "change_rate") {
|
||||||
|
OpenRateMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
}, (dData, dMenu) => {
|
||||||
|
new ESX.UI.Menu(dMenu).Close();
|
||||||
|
MenuOpen = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
MenuOpen = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void CloseMenu() {
|
||||||
|
if (!MenuOpen) return;
|
||||||
|
_currentMenu.Close();
|
||||||
|
MenuOpen = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void OpenRateMenu() {
|
||||||
|
var rates = new [] { 10, 15, 20 };
|
||||||
|
|
||||||
|
var menuData = new ESX.UI.MenuData {
|
||||||
|
align = "top-left",
|
||||||
|
title = "Taxi - Tarif",
|
||||||
|
elements = rates.Select(rate => new ESX.UI.MenuElement {
|
||||||
|
label = rate + "$",
|
||||||
|
name = rate
|
||||||
|
}).ToList()
|
||||||
|
};
|
||||||
|
|
||||||
|
ESX.UI.Menu.Open("default", API.GetCurrentResourceName(), "taxi_rate_menu", menuData, (dData, dMenu) => {
|
||||||
|
Taximeter.Attributes.RateAmount = (int)dData.current.name;
|
||||||
|
Taximeter.Update();
|
||||||
|
new ESX.UI.Menu(dMenu).Close();
|
||||||
|
}, (dData, dMenu) => {
|
||||||
|
new ESX.UI.Menu(dMenu).Close();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,44 +1,100 @@
|
|||||||
using CitizenFX.Core;
|
using System.Dynamic;
|
||||||
|
using CitizenFX.Core;
|
||||||
|
using CitizenFX.Core.Native;
|
||||||
|
|
||||||
namespace TaxiJob.Client.Handler {
|
namespace TaxiJob.Client.Handler {
|
||||||
public static class Taximeter {
|
public static class Taximeter {
|
||||||
public static TaximeeterAttributes Attributes { get; private set; } = new TaximeeterAttributes();
|
public static TaximeterAttributes Attributes { get; private set; } = new TaximeterAttributes();
|
||||||
|
public static int CurrentClient;
|
||||||
|
private static bool _forClient;
|
||||||
|
|
||||||
public static void Open() {
|
public static void Toggle() {
|
||||||
Attributes.MeterVisible = true;
|
Attributes.MeterVisible = !Attributes.MeterVisible;
|
||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Close() {
|
public static void SetVisible(bool visible) {
|
||||||
Attributes.MeterVisible = false;
|
Attributes.MeterVisible = visible;
|
||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void Pause(bool pause) {
|
||||||
|
Attributes.MeterPause = pause;
|
||||||
|
Update();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Pause() {
|
||||||
|
Pause(!Attributes.MeterPause);
|
||||||
|
}
|
||||||
|
|
||||||
public static void Update() {
|
public static void Update() {
|
||||||
BaseScript.TriggerEvent("taxijob:client:nuimessage", Attributes.ToString());
|
BaseScript.TriggerEvent("taxijob:client:nuimessage", Attributes.ToString());
|
||||||
|
|
||||||
|
if (CurrentClient != 0) BaseScript.TriggerServerEvent("taxijob:server:sync_meter", Attributes, CurrentClient, _forClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Reset() {
|
public static void Reset(bool visible = false) {
|
||||||
Attributes = new TaximeeterAttributes();
|
Attributes = new TaximeterAttributes();
|
||||||
|
Attributes.MeterVisible = visible;
|
||||||
|
Update();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ActivateForClient(bool activate) {
|
||||||
|
if (CurrentClient == 0) return;
|
||||||
|
|
||||||
|
_forClient = activate;
|
||||||
|
BaseScript.TriggerServerEvent("taxijob:server:sync_meter", Attributes, CurrentClient, _forClient);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Sync(ExpandoObject attributes, bool active) {
|
||||||
|
Attributes = new TaximeterAttributes(attributes);
|
||||||
|
Attributes.MeterVisible = active;
|
||||||
|
Update();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void CalculatePrice(Vector3 start, Vector3 end) {
|
||||||
|
if (Attributes.RateType != "distance" || Attributes.RateAmount == 0) return;
|
||||||
|
|
||||||
|
float dist = API.CalculateTravelDistanceBetweenPoints(start.X, start.Y, start.Z, end.X, end.Y, end.Z);
|
||||||
|
Attributes.DistanceTraveled += dist;
|
||||||
|
|
||||||
|
float fare = Attributes.FareOnStop + (Attributes.DistanceTraveled / 1609.34f) * Attributes.RateAmount;
|
||||||
|
Attributes.CurrentFare = (fare < 99.99f ? "0" : "") + (fare < 9.99f ? "0" : "") + fare.ToString("N2");
|
||||||
|
|
||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class TaximeeterAttributes {
|
public sealed class TaximeterAttributes {
|
||||||
public bool MeterVisible { get; set; } = false;
|
public bool MeterVisible { get; set; } = false;
|
||||||
public string RateType { get; set; } = "distance";
|
public string RateType { get; set; } = "distance";
|
||||||
public int RateAmount { get; set; } = 5;
|
public float RateAmount { get; set; } = 10;
|
||||||
public string CurrencyPrefix { get; set; } = "$";
|
public string CurrencyPrefix { get; set; } = "$";
|
||||||
public string RateSuffix { get; set; } = "/km";
|
public string RateSuffix { get; set; } = "/mi";
|
||||||
public float CurrentFare { get; set; } = 0.0f;
|
public string CurrentFare { get; set; } = "000.00";
|
||||||
public int DistanceTraveled { get; set; } = 0;
|
public float DistanceTraveled { get; set; } = 0;
|
||||||
public int FareOnStop { get; set; } = 0;
|
public float FareOnStop { get; set; } = 0;
|
||||||
public bool MeterPause { get; set; } = true;
|
public bool MeterPause { get; set; } = true;
|
||||||
public bool IsMoving { get; set; } = true;
|
public bool IsMoving { get; set; } = true;
|
||||||
|
|
||||||
public override string ToString() {
|
public override string ToString() {
|
||||||
return $"{{\"meterVisible\": {MeterVisible.ToString().ToLower()}, \"rateType\": \"{RateType}\", \"rateAmount\": {RateAmount}, \"currencyPrefix\": \"{CurrencyPrefix}\", \"rateSuffix\": \"{RateSuffix}\", \"currentFare\": \"{CurrentFare}\", \"distanceTraveled\": {DistanceTraveled}, \"fareOnStop\": {FareOnStop}, \"meterPause\": {MeterPause.ToString().ToLower()}, \"isMoving\": {IsMoving.ToString().ToLower()} }}";
|
return $"{{\"meterVisible\": {MeterVisible.ToString().ToLower()}, \"rateType\": \"{RateType}\", \"rateAmount\": {RateAmount}, \"currencyPrefix\": \"{CurrencyPrefix}\", \"rateSuffix\": \"{RateSuffix}\", \"currentFare\": \"{CurrentFare}\", \"distanceTraveled\": {DistanceTraveled}, \"fareOnStop\": {FareOnStop}, \"meterPause\": {MeterPause.ToString().ToLower()}, \"isMoving\": {IsMoving.ToString().ToLower()} }}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TaximeterAttributes() {}
|
||||||
|
|
||||||
|
public TaximeterAttributes(dynamic data) {
|
||||||
|
MeterVisible = data.MeterVisible;
|
||||||
|
RateType = data.RateType;
|
||||||
|
RateAmount = data.RateAmount;
|
||||||
|
CurrencyPrefix = data.CurrencyPrefix;
|
||||||
|
RateSuffix = data.RateSuffix;
|
||||||
|
CurrentFare = data.CurrentFare;
|
||||||
|
DistanceTraveled = data.DistanceTraveled;
|
||||||
|
FareOnStop = data.FareOnStop;
|
||||||
|
MeterPause = data.MeterPause;
|
||||||
|
IsMoving = data.IsMoving;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -50,12 +50,13 @@
|
|||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Extensions\ArrayExtensions.cs" />
|
|
||||||
<Compile Include="Extensions\TasksExtensions.cs" />
|
<Compile Include="Extensions\TasksExtensions.cs" />
|
||||||
<Compile Include="Extensions\VectorExtensions.cs" />
|
<Compile Include="Extensions\VectorExtensions.cs" />
|
||||||
<Compile Include="Extensions\EntityExtensions.cs" />
|
<Compile Include="Extensions\EntityExtensions.cs" />
|
||||||
<Compile Include="Handler\CloakroomHandler.cs" />
|
<Compile Include="Handler\CloakroomHandler.cs" />
|
||||||
<Compile Include="Handler\JobHandler.cs" />
|
<Compile Include="Handler\JobHandler.cs" />
|
||||||
|
<Compile Include="Handler\NpcTaxiHandler.cs" />
|
||||||
|
<Compile Include="Handler\TaxiMenuHandler.cs" />
|
||||||
<Compile Include="Handler\Taximeter.cs" />
|
<Compile Include="Handler\Taximeter.cs" />
|
||||||
<Compile Include="Notify.cs" />
|
<Compile Include="Notify.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
|||||||
@@ -20,7 +20,12 @@ namespace TaxiJob.Client {
|
|||||||
|
|
||||||
public TaxiJob() {
|
public TaxiJob() {
|
||||||
_instance = this;
|
_instance = this;
|
||||||
EventHandlers["onClientResourceStart"] += new Action<string>(OnStart); //esx:playerLoaded
|
EventHandlers["esx:playerLoaded"] += new Action(OnStart);
|
||||||
|
EventHandlers["onResourceStop"] += new Action<string>(OnStop);
|
||||||
|
EventHandlers["taxijob:client:job"] += new Action<Vector3, string>(JobHandler.RequestJob);
|
||||||
|
EventHandlers["taxijob:client:npc"] += new Action(NpcTaxiHandler.StartNpcJob);
|
||||||
|
EventHandlers["taxijob:client:sync_meter"] += new Action<ExpandoObject, bool>(Taximeter.Sync);
|
||||||
|
EventHandlers["taxijob:client:set_passanger"] += new Action<int>(client => Taximeter.CurrentClient = client);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Task<T> ServerCallback<T>(string name, [Optional] dynamic args) {
|
public static Task<T> ServerCallback<T>(string name, [Optional] dynamic args) {
|
||||||
@@ -57,10 +62,33 @@ namespace TaxiJob.Client {
|
|||||||
return source.Task;
|
return source.Task;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Task<string> DisplayTextDialog(string placeholder) {
|
||||||
|
var source = new TaskCompletionSource<string>();
|
||||||
|
|
||||||
|
ESX.UI.Menu.Open("dialog", API.GetCurrentResourceName(), "test_dialog", new ESX.UI.MenuData() {
|
||||||
|
title = placeholder,
|
||||||
|
type = "default",
|
||||||
|
align = "center"
|
||||||
|
}, (dData, dMenu) => {
|
||||||
|
source.TrySetResult(dData.value as string);
|
||||||
|
ESX.UI.Menu.Close(new ESX.UI.Menu(dMenu));
|
||||||
|
}, (dData, dMenu) => {
|
||||||
|
source.TrySetResult(null);
|
||||||
|
ESX.UI.Menu.Close(new ESX.UI.Menu(dMenu));
|
||||||
|
});
|
||||||
|
|
||||||
|
return source.Task;
|
||||||
|
}
|
||||||
|
|
||||||
public static async Task<string> GeneratePlate() {
|
public static async Task<string> GeneratePlate() {
|
||||||
var plate = await _instance.Exports["esx_vehicleshop"].GeneratePlate();
|
var plate = await _instance.Exports["esx_vehicleshop"].GeneratePlate();
|
||||||
return Convert.ToString(plate);
|
return Convert.ToString(plate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void SetFuel(Vehicle vehicle, float level) {
|
||||||
|
_instance.Exports["LegacyFuel"].SetFuel(vehicle.Handle, level);
|
||||||
|
}
|
||||||
|
|
||||||
public static void PrintDynamic(dynamic data, string prefix = "") {
|
public static void PrintDynamic(dynamic data, string prefix = "") {
|
||||||
foreach (var element in (data as IDictionary<string, object>)) {
|
foreach (var element in (data as IDictionary<string, object>)) {
|
||||||
Debug.WriteLine($"{prefix}{element.Key}: {element.Value}");
|
Debug.WriteLine($"{prefix}{element.Key}: {element.Value}");
|
||||||
@@ -75,21 +103,32 @@ namespace TaxiJob.Client {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Command("taximeter")]
|
public static void SetServiceStatus(bool onService) {
|
||||||
private void OnCommand() {
|
TriggerServerEvent("taxijob:server:service", onService);
|
||||||
Taximeter.Attributes.MeterVisible = !Taximeter.Attributes.MeterVisible;
|
|
||||||
Taximeter.Update();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnStart(string resourceName) {
|
private void OnStart() {
|
||||||
if (API.GetCurrentResourceName() != resourceName) return;
|
|
||||||
Tick += async () => {
|
Tick += async () => {
|
||||||
if (ESX.GetPlayerData().job.name != "taxi") return;
|
if (NpcTaxiHandler.IsCustomer) NpcTaxiHandler.OnTick();
|
||||||
|
if (Taximeter.Attributes.MeterVisible && !Game.PlayerPed.IsInVehicle()) Taximeter.Reset();
|
||||||
|
|
||||||
|
if (ESX.GetPlayerData().job.name != "taxi") {
|
||||||
|
CloakroomHandler.JobBlip?.Delete();
|
||||||
|
CloakroomHandler.JobBlip = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
CloakroomHandler.OnTick();
|
CloakroomHandler.OnTick();
|
||||||
|
|
||||||
if (!InDuty) return;
|
if (!InDuty) return;
|
||||||
JobHandler.OnTick();
|
JobHandler.OnTick();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnStop(string resourceName) {
|
||||||
|
if (API.GetCurrentResourceName() != resourceName) return;
|
||||||
|
TriggerServerEvent("taxijob:server:accept", false, JobHandler.JobId);
|
||||||
|
JobHandler.StopJob(false);
|
||||||
|
SetServiceStatus(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BIN
C#/FiveM/TaxiJob/TaxiJob.Client/bin/Debug/TaxiJob.Client.net.dll
Normal file
BIN
C#/FiveM/TaxiJob/TaxiJob.Client/bin/Debug/TaxiJob.Client.net.dll
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user