master
mrtuxa 2022-11-24 01:31:43 +01:00
parent 8d2c56f6a9
commit 1e4efec5b4
21 changed files with 401 additions and 0 deletions

View File

@ -0,0 +1,13 @@
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/.idea.ClientSide.iml
/modules.xml
/projectSettingsUpdater.xml
/contentModel.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View 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>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>

View File

@ -0,0 +1,16 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClientSide", "ClientSide\ClientSide.csproj", "{2FCB8748-C33E-45A5-BF4D-C9A08FBC12D9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2FCB8748-C33E-45A5-BF4D-C9A08FBC12D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2FCB8748-C33E-45A5-BF4D-C9A08FBC12D9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2FCB8748-C33E-45A5-BF4D-C9A08FBC12D9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2FCB8748-C33E-45A5-BF4D-C9A08FBC12D9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="RAGEMP-ragesharp" Version="1.1.3" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,17 @@
using RAGE;
namespace Freeze
{
public class Freeze : Events.Script
{
public Freeze()
{
Events.Add("PlayerFreeze", PlayerFreeze);
}
private void PlayerFreeze(object[] args)
{
RAGE.Elements.Player.LocalPlayer.FreezePosition((bool)args[0]);
}
}
}

25
Rage.sln Normal file
View File

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.32802.440
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rage", "Rage\Rage.csproj", "{AA3206D7-A818-4445-8C32-0960CEF8506B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AA3206D7-A818-4445-8C32-0960CEF8506B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AA3206D7-A818-4445-8C32-0960CEF8506B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AA3206D7-A818-4445-8C32-0960CEF8506B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AA3206D7-A818-4445-8C32-0960CEF8506B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {595AEA1F-DED5-406E-B4F8-6E8E55296C1F}
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RiderProjectSettingsUpdater">
<option name="vcsConfiguration" value="2" />
</component>
</project>

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="17292f91-bcc7-4140-a56a-cd381895bd47" name="Changes" comment="" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="ProjectId" id="2EcbHyxbPiKOnU4J773KkIRGQp9" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"RunOnceActivity.OpenProjectViewOnStart": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
"WebServerToolWindowFactoryState": "false"
}
}]]></component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<created>1662897747145</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1662897747145</updated>
<workItem from="1662897747148" duration="24000" />
</task>
<servers />
</component>
<component name="UnityUnitTestConfiguration" currentTestLauncher="NUnit" />
<component name="VcsManagerConfiguration">
<option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="true" />
</component>
</project>

21
Rage/Blips/MDBlip.cs Normal file
View File

@ -0,0 +1,21 @@
using GTANetworkAPI;
namespace Rage.Blips
{
public class MdBlip : Script
{
public Blip CreateMarker(uint sprite, Vector3 position, float scale, byte color, string name = "",
byte alpha = 255, float drawDistance = 0, bool shortRange = true, short rotation = 0,
uint dimension = uint.MaxValue)
{
var blip = NAPI.Blip.CreateBlip(sprite, position, scale, color, name, alpha, drawDistance, shortRange,
rotation, dimension);
return blip;
}
public MdBlip()
{
CreateMarker(61, new Vector3(1152.221, -1527.989, 34.8434), 0.8f, 1, "Los Santos Medical Department");
}
}
}

View File

@ -0,0 +1,22 @@
using GTANetworkAPI;
using Rage.Utils;
namespace Rage.Commands.Admin.Util
{
public class Freeze : Script
{
[Command("freeze")]
public void OnFreeze(Player target)
{
PlayerUtil.AdminUtil.Freeze(target);
Message.Notification(target, "An admin has frozen you");
}
[Command("unfreeze")]
public void OnUnFreeze(Player target)
{
PlayerUtil.AdminUtil.UnFreeze(target);
Message.Notification(target, "An admin unfroze you");
}
}
}

View File

@ -0,0 +1,61 @@
using System;
using System.Text;
using GTANetworkAPI;
using PasswordGenerator;
using Rage.Utils;
namespace Rage.Commands.Spawner
{
internal class VehicleSpawner : Script
{
[Command("car")]
public void OnCommand(Player player, string name, int color1, int color2)
{
var hash = NAPI.Util.GetHashKey(name);
if (hash <= 0)
{
player.SendNotification("~r~Invalid spawn Name");
return;
}
if (player.IsInVehicle)
{
NAPI.Player.GetPlayerVehicle(player).Delete();
var vehicle = NAPI.Vehicle.CreateVehicle(hash, player.Position, player.Heading, color1, color2);
// vehicle.NumberPlate = "OVN";
vehicle.NumberPlate = "OVN";
vehicle.Locked = false;
vehicle.EngineStatus = true;
player.SetIntoVehicle(vehicle, (int)VehicleSeat.Driver);
}
else
{
var vehicle = NAPI.Vehicle.CreateVehicle(hash, player.Position, player.Heading, color1, color2);
vehicle.NumberPlate = "OVN";
vehicle.Locked = false;
vehicle.EngineStatus = true;
player.SetIntoVehicle(vehicle, (int)VehicleSeat.Driver);
}
}
[Command("deletecar")]
public void OnCommand(Player player)
{
if (player.IsInVehicle)
{
Message.Notification(player, "Vehicle will be deleted");
NAPI.Player.GetPlayerVehicle(player).Delete();
}
else
{
Message.Notification(player, "You are not in an vehicle");
}
}
[Command("repair")]
public void OnRepair(Player player)
{
PlayerUtil.Vehicle.Repair(player);
}
}
}

14
Rage/Events/JoinEvent.cs Normal file
View File

@ -0,0 +1,14 @@
using GTANetworkAPI;
using Rage.Utils;
namespace Rage.Events
{
public class JoinEvent : Script
{
[ServerEvent(Event.PlayerConnected)]
public void OnJoinEvent(Player player)
{
Message.Notification(player, "~g~Welcome on my Dev Space");
}
}
}

14
Rage/Events/Ready.cs Normal file
View File

@ -0,0 +1,14 @@
using GTANetworkAPI;
using Rage.Utils;
namespace Rage.Events
{
public class Ready : Script
{
[ServerEvent(Event.ResourceStart)]
public void OnReady()
{
Message.Console("Started without Errors");
}
}
}

12
Rage/Program.cs Normal file
View File

@ -0,0 +1,12 @@
using System;
namespace Rage
{
internal class Program
{
private static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}

View File

@ -0,0 +1,9 @@
{
"profiles": {
"Rage": {
"commandName": "Executable",
"executablePath": "C:\\RAGEMP\\server-files\\ragemp-server.exe",
"workingDirectory": "C:\\RAGEMP\\server-files"
}
}
}

20
Rage/Rage.csproj Normal file
View File

@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<PlatformTarget>x64</PlatformTarget>
<OutputPath>C:\RAGEMP\server-files\dotnet\resources\Rage\</OutputPath>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="PasswordGenerator" Version="2.1.0"/>
<PackageReference Include="RAGEMP-Bootstrapper" Version="1.1.3"/>
</ItemGroup>
</Project>

22
Rage/Utils/Message.cs Normal file
View File

@ -0,0 +1,22 @@
using GTANetworkAPI;
namespace Rage.Utils
{
public static class Message
{
public static void Notification(Player player, string message)
{
player.SendNotification(message);
}
public static void Default(Player player, string message)
{
player.SendChatMessage(message);
}
public static void Console(string message)
{
NAPI.Util.ConsoleOutput($"[OVN] {message}");
}
}
}

38
Rage/Utils/PlayerUtil.cs Normal file
View File

@ -0,0 +1,38 @@
using GTANetworkAPI;
namespace Rage.Utils
{
public class PlayerUtil
{
public class Vehicle
{
public static void Delete(Player player)
{
player.Vehicle.Delete();
}
public static void Driver(Player player, NetHandle vehicle)
{
player.SetIntoVehicle(vehicle, (int)VehicleSeat.Driver);
}
public static void Repair(Player player)
{
player.Vehicle.Repair();
}
}
public class AdminUtil
{
public static void Freeze(Player target)
{
NAPI.ClientEvent.TriggerClientEvent(target, "PlayerFreeze", true);
}
public static void UnFreeze(Player target)
{
NAPI.ClientEvent.TriggerClientEvent(target, "PlayerFreeze", false);
}
}
}
}

17
Rage/Utils/VehicleUtil.cs Normal file
View File

@ -0,0 +1,17 @@
using GTANetworkAPI;
namespace Rage.Utils
{
public class VehicleUtil
{
public static uint GetHashKey(string vehicle)
{
return NAPI.Util.GetHashKey(vehicle);
}
public static Vehicle Spawn(uint hash, Player player, int primary, int secondary)
{
return NAPI.Vehicle.CreateVehicle(hash, player.Position, player.Heading, primary, secondary);
}
}
}