Search the Community

Showing results for tags 'debugging'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • 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

Categories

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

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


About Me


Facebook


Youtube


Skype


Web


VK

Found 2 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. Kasimir

    Console

    Version 0.3.0

    842 downloads

    To access the console press F11 ingame. Motivation RAGE console is designed to be a simple and universal logging library with support for client-side, including CEF and server-side. The server-side currently logs all the logs into separate daily files. Installation Installation is extremely simple Copy "packages" folder inside your server "packages" folder, except config.json if you have edited it Copy "client_packages" folder inside your "client_packages" folder Edit your "client_packages" -> index.js to include the rage-console with: require('_rage-console'); (remember to paste this on line 1) Config The config exists inside your 'packages/_rage-console/config.json'. You can freely edit these, if no data is provided it will default to default settings. These options are accepted by the config: zippedArchive: A boolean to define whether or not to gzip archived log files. (default 'false') name: Filename to be used to log to. This filename can include the date placeholder which will include the formatted. (default: 'YYYY-MM-DD') maxSize: Maximum size of the file after which it will rotate. This can be a number of bytes, or units of kb, mb, and gb. If using the units, add 'k', 'm', or 'g' as the suffix. The units need to directly follow the number. (default: '30m') maxFiles: Maximum number of logs to keep. If not set, no logs will be removed. This can be a number of files or number of days. If using days, add 'd' as the suffix. (default: '30d') { "logs": { "name": "YYYY-MM-DD", "maxSize": '30m', "maxFiles": '30d', "zippedArchive": false } } Upgrading Upgrading is extremely simple Copy "packages" folder inside your server "packages" folder Copy "client_packages" folder inside your "client_packages" folder Usage Can be used on server-side or client-side. You do not need to require the file as these are available globally. Writes an info log to the console. console.log('Hey! Log something?'); Writes an info log to the console. console.info('Hey! Log something?'); Writes an warning log to the console. console.warn('Hey! Log something?'); Writes an error log to the console. console.error('Hey! Log something?'); Usage with CEF (Browser) To use with CEF you need to add the following line to your HTML <head> element, put this to the top of all your script files. <script src="package://_rage-console/CEF/debugger.js" crossorigin="anonymous"></script> Build in commands help — provides all the commands available clear — clears all the logs API Enable or disable access to console [client-side] terminal.active = true/false; Add command handler [client-side] terminal.commands.add('pos', { description: 'Gets the position of the player' }, function(...arguments) { return ` X: ${user.position.x.toFixed(2)}, Y: ${user.position.y.toFixed(2)}, Z: ${user.position.z.toFixed(2)} - R: ${user.getHeading(true).toFixed(2)}`; }); Todo Add options to disable and enable server-side log files Add options to custom style the console, mainly due to accessibility Run proper tests and clean the logic Add ability to see which file the log is coming from Add ability to be used with C bridge Bugs/Feedback Bugs should be reported currently in RAGE Discord channel to the username @Porn on private message, I appreciate any bugs being reported. If you have a feature request please do the same as mentioned above. This is currently in BETA and some stuff is still unpolished.