diff --git a/ClientSide/ClientSide/.idea/.idea.ClientSide/.idea/.gitignore b/ClientSide/ClientSide/.idea/.idea.ClientSide/.idea/.gitignore new file mode 100644 index 0000000..9891ca2 --- /dev/null +++ b/ClientSide/ClientSide/.idea/.idea.ClientSide/.idea/.gitignore @@ -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 diff --git a/ClientSide/ClientSide/.idea/.idea.ClientSide/.idea/discord.xml b/ClientSide/ClientSide/.idea/.idea.ClientSide/.idea/discord.xml new file mode 100644 index 0000000..d8e9561 --- /dev/null +++ b/ClientSide/ClientSide/.idea/.idea.ClientSide/.idea/discord.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/ClientSide/ClientSide/.idea/.idea.ClientSide/.idea/indexLayout.xml b/ClientSide/ClientSide/.idea/.idea.ClientSide/.idea/indexLayout.xml new file mode 100644 index 0000000..7b08163 --- /dev/null +++ b/ClientSide/ClientSide/.idea/.idea.ClientSide/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/ClientSide/ClientSide/ClientSide.sln b/ClientSide/ClientSide/ClientSide.sln new file mode 100644 index 0000000..f820a81 --- /dev/null +++ b/ClientSide/ClientSide/ClientSide.sln @@ -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 diff --git a/ClientSide/ClientSide/ClientSide/ClientSide.csproj b/ClientSide/ClientSide/ClientSide/ClientSide.csproj new file mode 100644 index 0000000..ef4f132 --- /dev/null +++ b/ClientSide/ClientSide/ClientSide/ClientSide.csproj @@ -0,0 +1,14 @@ + + + + Exe + net6.0 + enable + enable + + + + + + + diff --git a/ClientSide/ClientSide/ClientSide/Freeze.cs b/ClientSide/ClientSide/ClientSide/Freeze.cs new file mode 100644 index 0000000..d4718e8 --- /dev/null +++ b/ClientSide/ClientSide/ClientSide/Freeze.cs @@ -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]); + } + } +} \ No newline at end of file diff --git a/Rage.sln b/Rage.sln new file mode 100644 index 0000000..e3cb2bc --- /dev/null +++ b/Rage.sln @@ -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 diff --git a/Rage/.idea/.idea.Rage.dir/.idea/indexLayout.xml b/Rage/.idea/.idea.Rage.dir/.idea/indexLayout.xml new file mode 100644 index 0000000..7b08163 --- /dev/null +++ b/Rage/.idea/.idea.Rage.dir/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Rage/.idea/.idea.Rage.dir/.idea/projectSettingsUpdater.xml b/Rage/.idea/.idea.Rage.dir/.idea/projectSettingsUpdater.xml new file mode 100644 index 0000000..4bb9f4d --- /dev/null +++ b/Rage/.idea/.idea.Rage.dir/.idea/projectSettingsUpdater.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/Rage/.idea/.idea.Rage.dir/.idea/workspace.xml b/Rage/.idea/.idea.Rage.dir/.idea/workspace.xml new file mode 100644 index 0000000..5298432 --- /dev/null +++ b/Rage/.idea/.idea.Rage.dir/.idea/workspace.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + 1662897747145 + + + + + + + \ No newline at end of file diff --git a/Rage/Blips/MDBlip.cs b/Rage/Blips/MDBlip.cs new file mode 100644 index 0000000..b180cb5 --- /dev/null +++ b/Rage/Blips/MDBlip.cs @@ -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"); + } + } +} \ No newline at end of file diff --git a/Rage/Commands/Admin/Util/Freeze.cs b/Rage/Commands/Admin/Util/Freeze.cs new file mode 100644 index 0000000..48ab3c4 --- /dev/null +++ b/Rage/Commands/Admin/Util/Freeze.cs @@ -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"); + } + } +} \ No newline at end of file diff --git a/Rage/Commands/Spawner/VehicleSpawner.cs b/Rage/Commands/Spawner/VehicleSpawner.cs new file mode 100644 index 0000000..0d1af66 --- /dev/null +++ b/Rage/Commands/Spawner/VehicleSpawner.cs @@ -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); + } + } +} \ No newline at end of file diff --git a/Rage/Events/JoinEvent.cs b/Rage/Events/JoinEvent.cs new file mode 100644 index 0000000..0d8481e --- /dev/null +++ b/Rage/Events/JoinEvent.cs @@ -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"); + } + } +} \ No newline at end of file diff --git a/Rage/Events/Ready.cs b/Rage/Events/Ready.cs new file mode 100644 index 0000000..0014a52 --- /dev/null +++ b/Rage/Events/Ready.cs @@ -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"); + } + } +} \ No newline at end of file diff --git a/Rage/Program.cs b/Rage/Program.cs new file mode 100644 index 0000000..9b52524 --- /dev/null +++ b/Rage/Program.cs @@ -0,0 +1,12 @@ +using System; + +namespace Rage +{ + internal class Program + { + private static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + } + } +} \ No newline at end of file diff --git a/Rage/Properties/launchSettings.json b/Rage/Properties/launchSettings.json new file mode 100644 index 0000000..3623d96 --- /dev/null +++ b/Rage/Properties/launchSettings.json @@ -0,0 +1,9 @@ +{ + "profiles": { + "Rage": { + "commandName": "Executable", + "executablePath": "C:\\RAGEMP\\server-files\\ragemp-server.exe", + "workingDirectory": "C:\\RAGEMP\\server-files" + } + } +} \ No newline at end of file diff --git a/Rage/Rage.csproj b/Rage/Rage.csproj new file mode 100644 index 0000000..e6c87d1 --- /dev/null +++ b/Rage/Rage.csproj @@ -0,0 +1,20 @@ + + + + Exe + netcoreapp3.1 + true + false + + + + x64 + C:\RAGEMP\server-files\dotnet\resources\Rage\ + + + + + + + + diff --git a/Rage/Utils/Message.cs b/Rage/Utils/Message.cs new file mode 100644 index 0000000..b0d4399 --- /dev/null +++ b/Rage/Utils/Message.cs @@ -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}"); + } + } +} \ No newline at end of file diff --git a/Rage/Utils/PlayerUtil.cs b/Rage/Utils/PlayerUtil.cs new file mode 100644 index 0000000..db63a21 --- /dev/null +++ b/Rage/Utils/PlayerUtil.cs @@ -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); + } + } + } +} \ No newline at end of file diff --git a/Rage/Utils/VehicleUtil.cs b/Rage/Utils/VehicleUtil.cs new file mode 100644 index 0000000..c7cc530 --- /dev/null +++ b/Rage/Utils/VehicleUtil.cs @@ -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); + } + } +} \ No newline at end of file