Jump to content
RAGE Multiplayer Community

Search the Community

Showing results for tags 'C-Sharp'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • RAGE Multiplayer
    • Announcements
    • Discussion
    • Suggestions
    • RDR2 Multiplayer
  • Scripting
    • Scripting
    • Resources
  • Community
    • Support
    • Servers
    • Media Gallery
  • Non-English
    • Русский - Russian
    • Français - French
    • Deutsch - German
    • Espanol - Spanish
    • Română - Romanian
    • Portuguesa - Portuguese
    • Polski - Polish


  • Scripts
  • Gamemodes
  • Libraries
  • Plugins
  • Maps
  • Tools

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



About Me






Found 11 results

  1. I wanted to make a tutorial that is a little different from what is currently offered on the wiki (https://wiki.gtanet.work/index.php?title=Setting_Up_a_Development_Environment_using_Visual_Studio) This tutorial gets you through setting up a project outside the RAGE MP folder, that automatically builds into a resource folder, and allows debugging by simply pressing "Run" or F5 in Visual Studio 2017 There's a download of a project set up this way in the bottom of the post, if you just want to get started as fast as possible. You'll need to change all the paths in the configured project obviously, but there you go. Prerequisites Visual Studio 2017 (At the time of writing, using version 15.7.1) RAGE MP installed and server set up. Common sense Setup Ensure the .NET Core cross-platform development package/product is installed. Open Visual Studio Installer from the start menu Click on modify under Visual Studio {Version} 2017 Find .NET Core cross-platform development and make sure it's checked If it wasn't installed previously, after checking the box on this item, click modify in the bottom right, and install the package. Creating the project Open Visual Studio, and click File -> New -> Project. In the tree on the left, go to Installed -> Visual C# -> .NET Core. Then select Class Library (.NET Core) in the list on the right. Give your project a name in the bottom, choose a location to store it (can be anywhere on your PC), and hit OK This should create a project that compiles as .NET Core 2.0, which is the version used for resources at the time of writing. It may change to 2.1 in version 0.4 of RAGE MP. To ensure the project compiles to Core 2.0, right click on your new project in the Solution Explorer, and select Properties. Under Target framework, ensure it says .NET Core 2.0 While we're here, we can configure debugging. On the left, select the Debug tab, change the Launch dropdown to Executable. A new item appears: Executable with a Browse... button. Click browse, and select your RAGE MP server.exe The second input below that is for Working directory, set that to the folder that contains server.exe Save this window and close it. Build configuration Now we need to change how the project is built. If you want use external NuGet packages, you'll want Visual Studio to copy their DLLs to the build directory. Right click on your project in the Solution Explorer, and click Edit {project name}.csproj Under <TargetFramework>netcoreapp2.0</TargetFramework> Add the following: <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> Save and close the file. Now we set up the Meta.xml file. Right click on your project, and select Add -> New Item... In the pop-up dialog, click on Installed -> Visual C# Items in the tree on the left, then scroll down and select Xml File in the list on the right, and name it meta.xml Replace the file contents with the following, replacing ExampleResource with the name of your project: <meta> <info name="ExampleResource" type="script" /> <script src="ExampleResource.dll" /> </meta> Save and close the file. Right click on the file in Solution Explorer and click Properties Set Build Action to Content and Copy to Output Directory to Copy always Now let's configure it to copy the built project to the resources directory. Go back to the project properties (Solution Explorer, right click on the project, Properties). Open the Build Events tab, and put the following code in the text box under Post-build event command line: del "D:\Games\RAGEMP\server-files\bridge\resources\ExampleResource\*.*" /Q xcopy "$(OutDir)*" "D:\Games\RAGEMP\server-files\bridge\resources\ExampleResource" /Y Make sure to replace the path to \bridge\resources and ExampleResource with the correct path to the resources, and your project name. Also make sure the folder exists, obviously. Save and close the properties window. Try going to Build -> Rebuild Solution in the top of Visual Studio. This should complete successfully, and several DLLs should now appear in the resource folder in your server installation. Add the resource to the server settings.xml Open the settings.xml file in the RAGE MP server directory under the bridge folder Add the following, replacing ExampleResource with the name of your resource <resource src="ExampleResource" /> Save and close the file. Creating the resource Alright, that should be the basic project and debugging configured. Now let's add the GTA Network package so we can create a resource. In the Solution Explorer, right click on your project and select Manage NuGet packages... Click on Browse in the top left, search for gtanetwork.api, and install the gtanetwork.api package. By default, there should be a Class1.cs with a class in it called Class1. I like to rename this to Main.cs with a class Main, I suggest you do the same as I'll be referring to it in the rest of the tutorial. Replace the content of the file with the following. I will not be explaining basic C#, but it'll demonstrate the project working, and give you an entry point for the code: using System; using GTANetworkAPI; namespace ExampleResource { public class Main : Script { [ServerEvent(Event.ResourceStart)] public void OnResourceStart() { NAPI.Util.ConsoleOutput("Example resource loaded!"); } } } Save the file, and HIT THAT MF DEBUG BUTTON in the top of Visual Studio The server should now start up and show our console output: Breakpoints Breakpoints should also work immediately, try placing one on the console output, and hit debug: If something still doesn't work, you can download an example project here, which was set up using the steps above. Obviously you'll need to change the paths configured in it to match your system, but it may help you debug any issues.
  2. I'm looking at GTANetworkAPI.NAPI.Player methods ans see only FreezePlayerTime, but cant understand what that thing do... at least it is not freezing player position. Any ideas how to freeze player??? I'm using RAGEMP-Bootstrapper 1.1.3 P.S. Freeze player client side is bad idea.
  3. i see there is functions like : setHeadOverlay(); setHeadOverlayColor(); and maybe more... but i see only getHeadOverlay() to get overlay index; is there way to get overlay color, opacity and such ??
  4. i have code: GTANetworkAPI.NAPI.Util.ConsoleOutput("Position ->> " + wPlayer.Position.ToString()); GTANetworkAPI.NAPI.Entity.SetEntityPosition(wPlayer.Handle, new GTANetworkAPI.Vector3(402.8664, -996.4108, -99.00027)); GTANetworkAPI.NAPI.Util.ConsoleOutput("Position ->> " + wPlayer.Position.ToString()); and i'm getting Position ->> 0 0 0 Position ->> 402,8664 -996,4108 -99,00027 But player in game not moving Any ideas why ???
  5. Version 1.0.0


    Source code : https://github.com/J4YT/RAGE-Multiplayer-Attachment-Sync C# Attachment sync for RAGE Multiplayer Server and Client. Equivalent for the Efficient Attachment System made by ragempdev and rootcause https://rage.mp/files/file/144-efficient-attachment-sync Credits to DasNiels for the server-side Efficient Attachment Sync C# https://github.com/DasNiels/EfficientAttachmentSyncCSharp It has only been tested on RAGE Multiplayer 1.1
  6. I have seen the example posted by rootcause with a rescue command as it is on samp for java script and i said to do one for C #. You must use the System.IO library using System.IO; And this is the proper command.. [Command("save","Use /save [Position Name]", GreedyArg = true)] public void CMD_SavePosition(Client player, string PosName = "No Set") { var pos = (player.IsInVehicle) ? player.Vehicle.Position : player.Position; var rot = (player.IsInVehicle) ? player.Vehicle.Rotation : player.Rotation; using (var stream = File.AppendText("SavePos.txt")) { if (player.IsInVehicle) { NAPI.Notification.SendNotificationToPlayer(player, "~g~In car ~w~postion saved with name ~r~" + PosName, true); stream.WriteLine("IN VEH || " + PosName + ":" + pos.X + ", " + pos.Y + ", " + pos.Z + " Rot: " + rot.Z); stream.Close(); } else { NAPI.Notification.SendNotificationToPlayer(player, "~g~On foot ~w~position saved with name ~r~" + PosName, true); stream.WriteLine("ON FOOT|| " + PosName + ":" + pos.X + ", " + pos.Y + ", " + pos.Z + " Rot: " + rot.Z); stream.Close(); } } } The positions you find saved in the SavePos.txt file in the server folder That's how they look ON FOOT|| No Set: -439.8961, 6023.063, 31.49012 Rot: 2.175138 ON FOOT|| Police: -440.5302, 6034.081, 31.34053 Rot: 2.944162 IN VEH || Spawn Adder: -440.6177, 6035.974, 30.93323 Rot: 2.784058
  7. Version 1.0.0


    Source code : https://github.com/J4YT/RAGE-Multiplayer-Vending-Machine-Script Only works in combination with the Attachment Sync resource. (see below) Requires Rage 1.1 to work.
  8. Well, I've been stuck with a little problem for a while, I can get C# Server Side scripting working fully and have tested it but when it comes to client side I have a bit of a problem. I've created the "cs_packages" folder in the 'client_resources' folder. When it comes to actually loading the script which is in its own folder inside cs_packages and yes it is not compiled into a .dll file. The problem is when I connect to my local server it grabs all the dll packages inside the cs_packages folder but doesn't start my "Main.cs" script which has a little output with "Loading Clientside". I've looked at YouTube videos like "Stuyk" and it worked for him, for me no. Any help would be appreciated, I'll leave the code in the Main.cs in a picture below.
  9. Language: C# Clientside Hey there! I discovered the RAGE.NUI.PauseMenu namespace on clientside and i tried to use some things like TabView and other stuff, but nothing shows up. How do I use them? ~ T0xicPo1nter
  10. I already converted the begining, but I dont know how to convert "sender.name" NAPI.Chat.SendChatMessageToPlayer(sender, string.Format("~r~" + sender.name + " ~g~ist bereits Admin Rang {0}!", rank)); //Edit: Never mind, I just had to write the first letter of "name" big
  11. Здравствуйте, только сегодня узнал о данном мультиплеере. Начал разработку сервера, но так как я C# знаю на довольно высоком уровне, естественно мне захотелось писать на нём. С запуском скриптов на JS всё хорошо, а вот с шарпом проблемы. Может кто знает как решить проблему на скрине и где взять файл coreclr.dll? Делал всё по данному уроку: https://github.com/SkyLaGer/RageMP-CSharp-Wiki/wiki/Новый-проект-в-Visual-Studio-2017
  • Create New...