Search the Community

Showing results for tags 'CSharp'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • RAGE Multiplayer
    • Announcements
    • Discussion
    • Suggestions
  • 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


Facebook


Youtube


Skype


Web


VK

Found 31 results

  1. Hello Someone asks me, how to create a car at right side next to player. So i just wrote this little tutorial about. I hope you enjoy this little thing, which was did in two hours, and explained with a horrible english ;D Spend time: 2 hours testing the spawn of vehicles and coding + doc 3 hours making this tutorial with translation 0.5 hours thinking about, why i am doing this ... (i didn't found an answer -.-) First we have to know some things: How is the World working How is the Position working How is the Rotation working How can i spawn a car (Code snippet) How is the World working? => It is a north axis oriented map. If you open the full map ingame, top is north, bottom is south. It is every time a constant and will not change How is the Position working? => It is a Vector based information. It has three types. X => left - | + right Y => top - | + bottom Z => down - | + up The "+" and "-" are the operators here in our coordination system, which we have to use later. How is the Rotation working? => It is a Vector based information. Same here we have three types, but the number is always positive. So we can just use the Z variable. X => back | front (Not tested) Y => left | right (Not tested) Z => ground Then we will get four options: N => 0° E => 270° S => 180° W => 90° We have to use the radius to know how the player is rotated away from north. Just think about your shool days. back then you had geometry and raius was a topic of it. Ok, we got our information. Let us code that stuff Small version Doc version
  2. Hey, I'm trying to play around a bit with the C# development of RageMP to get to know it, however I got stuck in something I think it's either me doing something wrong, or possibly bug. I suppose the first, as no one else seems to cover this problem I've. I've this very simple script so far, running on NetCore 2.0, RageMP at latest stable version, but yet my server crash each time I leave a vehicle, even though I don't have any events hooked into that. However what I found very peculiar is that if I remove/comment out the OnPlayerEnterVehicle function, the crashes are gone! I've tried to debug this in VS2017 but it says this runtime error comes from external source, so it can't point at anything specific in my script. Any suggestions of what this could be? Suggestions on how to debug it further is also appreciated The runtime error The project using System; using GTANetworkAPI; namespace MyCustomResource { public class Main : Script { [ServerEvent(Event.ResourceStart)] //This type of event is mainly used for handling stuff after this resource has been initiated. public void ResourceStart() { Console.WriteLine("\n--------------------------------------"); Console.WriteLine("Blank Script by your name here v2"); Console.WriteLine("--------------------------------------\n"); } [Command("hi", Alias = "hello, hey, howdy")] public void SayHi(Client player) { NAPI.Chat.SendChatMessageToPlayer(player, "Hello!"); } [Command("car")] public void CmdCreateCar(Client client) { NAPI.Vehicle.CreateVehicle(VehicleHash.Adder, client.Position.Around(5), 0f, 0, 0, "Test"); //Spawned vehicle is visible in all Dimensions } [ServerEvent(Event.PlayerEnterVehicle)] public void OnPlayerEnterVehicle(Client player, Vehicle vehicle, sbyte seatID) { Console.WriteLine("TEst"); } } }
  3. [BCRP]Jeff

    Datenbank

    Hey, ich bin ziemlich neu im C# Programmieren, belege derzeitig noch einen Video Kurs auf udemy.com und programmiere nebenbei kleinweise eine RP Resource. Ich stehe nun kurz davor das ganze mit einer Datenbank zu verbinden. Nun wollte ich fragen, ob es egal ist das ganze einfach nur via Mysql mit der Datenbank zu verbinden oder gibt es noch bessere Wege. Nebenbei wollte ich fragen, ob eine Verbindung mit der Datenbank alleine via C# möglich wäre und ob's empfehlenswert ist. Liebe Grüße, Jeff
  4. Xabi

    WiredPlayers-RP

    Version 1.1.0

    2004 downloads

    Hello everybody. Some weeks ago i made a post on this forum's spanish section releasing my old gamemode, which I have been porting to RAGE:MP right after the bridge was released for the first time. In the beginning it was only in spanish, so I didn't thought it was a good idea to release to the whole community, as not so many people here speak spanish (I guess) but, after seeing that more people than I had expected downloaded it and also taking the suggestion George made me, I decided to start translating it and also, allowing to be multilanguage in a future. That above is the main reason I'm writing this post, I want to release here my gamemode (even if the link is already in this forum) so all the people using this excelent mod can just start their development with a base gamemode, instead of making it from the scratch. I have to say that it's not 100% ported and translated but I will be working on it in my spare time, meaning this won't be an abandoned project, it will have continuous support and development. Any suggestion for the gamemode, any question or any issue, you can contact me on the forum, sending a PM or posting here. One last thing I have to point out is that I know the gamemode is not documented but please, understand that I can't explain how all the systems inside work, as it's quite big. Anyway in a near future I will be adding some wiki or documentacion explaining briefly its contents and a guide to know the structure maybe.
  5. horseyhorsey

    RageMp Resources C#

    Guten tag I was going to build a server but soon learned it was not going to be quick. Kind of gone off the idea now, but I have still been enjoying messing around. I've made a repo in the case I do go completely go off the idea which should help the next person with a bit more to look at. Read the inital readme to update the submodules before building. If you want built resources I can provide. https://github.com/horseyhorsey/RageMpResources Credit to anyone that helped in discord, xabi (atms) (project to look through), Guad, george, extra thank to rootcause because providing great snippets & data and Sake4Mod
  6. CMHDev

    [C#] Keys Bind for C#

    Version 1.0.0

    162 downloads

    This function helps you to add keys binding if you use C # client side ... Example of use : Tick Event KeyManager.KeyBind(0xA2, () => { Chat.Output("Key Bind Work"); }); KeyManager.KeyBind(KeyManager.KeyMouse, () => { Cursor.Visible = !Cursor.Visible; });
  7. DjEnzo

    Server crash on CreateVehicle

    Hi guys! It's me again. We have our server setup on Ubuntu 16.04 64bit. Actually almost everything works perfect. Except "NAPI.Vehicle.CreateVehicle()". After using this line our server crashes just with info: Aborted (core dumped). Do you have any ideas why? What could we do? Thanks for your help
  8. Hello everyone! Many of you have decided to use Entity Framework instead of raw SQL but failed somehow in the process (myself included)! This is why I am creating this quick guide with some examples on how to use Entity Framework Core with MySQL database in RAGEMP C# gamemode. It's not perfect, but it will work just fine. If you find a mistake or have a better way of doing something, please let me know! Let's start! Requirements: - Visual Studio 17 - Net Core 2.2 - Latest RageMP and C# Bridge files - MySQL database (I use XAMPP) 1. First, you will need some dependencies. Open up the nuget package manager and add these dependencies to your project: Microsoft.EntityFrameworkCore Microsoft.EntityFrameworkCore.Tools Pomelo.EntityFrameworkCore.MySql Pomelo.EntityFrameworkCore.MySql.Design Microsoft.Extensions.Configuration Microsoft.Extensions.Configuration.Json Pomelo.EntityFrameworkCore.MySql is a MySQL provider. There are many more providers, but Pomelo's is just fine. Microsoft.Extensions.Configuration.Json is used for appsettings.json. How it looks when everything's added: 2. Now we are ready to create a DbContext class. I will just copy and paste and explain needed with comments! using System; using System.Collections.Generic; using System.Reflection; using System.Text; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Design; namespace EFCoreTutorial { public class DefaultDbContext : DbContext { // Base constructor public DefaultDbContext(DbContextOptions options) : base(options) { } // Account model class created somewhere else public DbSet<Account> Accounts { get; set; } } public class ContextFactory : IDesignTimeDbContextFactory<DefaultDbContext> { private static DefaultDbContext _instance; private static string _connectionString; public DefaultDbContext CreateDbContext(string[] args) { var builder = new DbContextOptionsBuilder<DefaultDbContext>(); // Load the connection string for the first time if (string.IsNullOrEmpty(_connectionString)) { LoadConnectionString(); } // Use it to init the connection builder.UseMySql(_connectionString, optionsBuilder => optionsBuilder.MigrationsAssembly(typeof(DefaultDbContext).GetTypeInfo().Assembly.GetName().Name)); return new DefaultDbContext(builder.Options); } public static DefaultDbContext Instance { get { if (_instance != null) return _instance; return _instance = new ContextFactory().CreateDbContext(new string[] { }); } private set { } } private static void LoadConnectionString() { var builder = new ConfigurationBuilder(); builder.AddJsonFile("appsettings.json", optional: false); var configuration = builder.Build(); // Get the connection string located inside the appsettings.json file under the name "DefaultConnection" _connectionString = configuration.GetConnectionString("DefaultConnection"); } } } 2a. And now the appsettings.json file which is used for the connection string. You actually don't have to do it this way, but it's considered better practice and it will help you in the long run. You can place the file everywhere you want. For the simplicity I created it inside the project root. Write this short code inside: { "ConnectionStrings": { "DefaultConnection": "Server=localhost;Database=efcoretutorial;Uid=root;Pwd=" } } Server = the address of the server, in this case localhost Database = name of the database Uid = user accessing the database Pwd = database password, leave empty if none Important! When you have created the file, right click on it and select properties. Change "Copy To Output Directory" to "Copy always". 3. Create a model class, in this case it's called Account using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Text; namespace EFCoreTutorial { public class Account { [Key] public int Id { get; set; } public string Username { get; set; } public string Password { get; set; } } } 4. Let's make a simple registration command. using System; using System.Collections.Generic; using System.Linq; using System.Text; using GTANetworkAPI; namespace EFCoreTutorial { public class Commands : Script { [Command("register")] public void AccountCmdRegister(Client player, string username, string password) { RegisterAccount(player, username, password); NAPI.Chat.SendChatMessageToPlayer(player, "~g~Registration successful!"); } public static void RegisterAccount(Client client, string username, string password) { // create a new Account object var account = new Account { Username = username, Password = password }; // Add this account data to the current context ContextFactory.Instance.Accounts.Add(account); // And finally insert the data into the database ContextFactory.Instance.SaveChanges(); } } } 4a. To check if you are properly connected to the database without going into the game, make a query when a resource starts, for example: using System; using System.Collections.Generic; using System.Linq; using System.Text; using GTANetworkAPI; namespace EFCoreTutorial { public class Main : Script { [ServerEvent(Event.ResourceStart)] public void OnResourceStart() { var playerCount = ContextFactory.Instance.Accounts.Count(); NAPI.Util.ConsoleOutput("Total players in the database: " + playerCount); } } } 5. Before we can test the command or the above example, we need to make a migration. Manual migrations are the only way as of EF Core. To use them in our gamemodes which are most often only libraries (.dlls), we need to "trick the system" into thinking our gamemode is executable. The easiest way is to "create" a console application. First, open your project properties, ALT + F7. Change output type to "Console Application" Save with CTRL + S! Create a new class called Program.cs with the code below: using System; using System.Collections.Generic; using System.Text; namespace EFCoreTutorial { public class Program { public static void Main(string[] args) { } } } Yes, that's right. You only need the Main method. It's because the console app approach looks for "Main" as a starting point. Save and build the project! Now let's make the first migration. Open up the Package Manager Console and type "add-migration FirstMigration" (FirstMigration is only the name). After the migration class has been created, type once again into the console "update-database". The very first migration is now added and inside your database you will find Accounts table: Note: If there are any errors by this stage, then you are most likely not connected to your Database. This guide will not cover that! 6. We are almost done. For server to properly work, it will need runtime dlls. When you first start RAGEMP client, you will download some runtime files. Those are not enough and you have to take some extra steps. Go to the "RAGEMP" root folder, then "dotnet" folder and copy everything. Paste it inside the "runtime" folder (RAGEMP\server-files\bridge\runtime). When you build your project, it will also give you runtime files. Copy everything from bin/debug/netcoreapp2.2 (default build path) except Bootstrapper.dll , Newtonsoft.Json.dll and everything that starts with YourProjectName (EFCoreTutorial in my case). Paste it once again inside the "runtime" folder (RAGEMP\server-files\bridge\runtime). Finally, open YourProjectName.csproj with notepad and add this line <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> like so: Save and close. 7. You are all set up! From now on you don't have to worry about missing runtimes, errors and whatnot. This is everything Entity Framework Core requires to work properly in RAGEMP. Changelog: - Added appsettings.json, a better way of handling connection strings. Thanks @horseyhorsey! - Some clarification This was my first tutorial/guide. Leave feedback and opinions. Thank you for reading! xForcer
  9. DjEnzo

    Catching shutdown event

    Hi guys! It's me again. Is it possible to catch server shutdown event with c#? I tried this: Events() { AppDomain.CurrentDomain.ProcessExit += new EventHandler(OnServerShutdown); } static void OnServerShutdown(object sender, EventArgs e) { NAPI.Util.ConsoleOutput("Server shutdown"); NAPI.Pools.GetAllPlayers().ForEach(player => Core.SavePlayer(player)); } but it doesn't work. (No exceptions too). any ideas?
  10. Hi guys, after some hours of programming, I've got an error. This is my exception-log: ==================[28.12.2018 04:10:52]================== System.NullReferenceException: Object reference not set to an instance of an object. at void GTV.Systems.Cargo.Core.AttachCargosToLoadings() in C:\Users\Kacper\Documents\GT-V\GTV\GTV\Systems\Cargo\core.cs:line 118 ========================================================= ==================[28.12.2018 04:10:52]================== System.Reflection.TargetParameterCountException: Parameter count mismatch. at object[] System.Reflection.RuntimeMethodInfo.InvokeArgumentsCheck(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture) ========================================================= Here's my console: Step 1 Step 2 Step 3 Step 4, r: 1, c: 0, llc: 3 Step 5 [Cargo] Cargo destination has been set to 3 Step 6, 0 GTV.Systems.Cargo.Cargo And here are the functions doing this staff: ... public void AttachCargosToLoadings() { try { if (cargos_list.Count <= 0) throw new Exception("Brak towarów"); if (loadings_list.Count <= 1) throw new Exception("Brak załadunków"); int currentLoadingID = 0; NAPI.Util.ConsoleOutput("Step 1"); foreach (Loading load in loadings_list) { NAPI.Util.ConsoleOutput("Step 2"); for (var i=0;i<5;i++) { NAPI.Util.ConsoleOutput("Step 3"); int randomIndex = random.Next(cargos_list.Count - 1); AttachDestinationToCargo(cargos_list[randomIndex],currentLoadingID); NAPI.Util.ConsoleOutput("Step 6, "+randomIndex); NAPI.Util.ConsoleOutput(cargos_list[randomIndex].ToString()); NAPI.Util.ConsoleOutput(cargos_list[randomIndex].GetType().ToString()); load.cargos.Add(cargos_list[randomIndex]); NAPI.Util.ConsoleOutput("Step 7"); NAPI.Util.ConsoleOutput("[Cargo] Inserted Cargo ("+cargos_list[randomIndex].name+") to Loading ("+load.id+")", ConsoleColor.DarkGreen); NAPI.Util.ConsoleOutput("Step 8"); } currentLoadingID++; } } catch (Exception e) { NAPI.Util.ConsoleOutput("[Cargo] " + e.Message + " (Init Attach)", ConsoleColor.Red); } } public void AttachDestinationToCargo(Cargo cargo, int currentLoadingID) { int randomIndex = random.Next(loadings_list.Count - 1); while(randomIndex==currentLoadingID) { randomIndex = random.Next(loadings_list.Count - 1); } NAPI.Util.ConsoleOutput("Step 4, r: "+randomIndex+", c: "+currentLoadingID+", llc: "+loadings_list.Count); cargo.destination = loadings_list[randomIndex]; NAPI.Util.ConsoleOutput("Step 5"); NAPI.Util.ConsoleOutput("[Cargo] Cargo destination has been set to "+loadings_list[randomIndex].id, ConsoleColor.DarkCyan); } ... Cargo class: public int id { get; set; } public string name { get; set; } public bool legal { get; set; } public string color = "#ffffff"; public double money_multipler { get; set; } public double exp_multipler { get; set; } public int event_id = 0; public int courses = 0; public Loading destination { get; set; } Loading class: public int id { get; set; } public Vector3 pos { get; set; } // Init cargos public List<Cargo> cargos { get; set; } //After InGame Create public Marker marker { get; set; } public ColShape colshape { get; set; } public Blip blip { get; set; } public TextLabel text { get; set; } bool error = false; What Am I doing wrong? I really appreciate your help
  11. DjEnzo

    How to use MySQL

    Hi guys! Am about to start programming my new server, but I cannot use MySQL. I started with this tutorial -> https://rage.mp/forums/topic/1807-c-getting-started-debugging/ This is how my code looks like: using System; using System.Data; using GTANetworkAPI; using MySql.Data.MySqlClient; namespace GTV { class MySQL { private string connectionString = "SERVER=localhost;" + "DATABASE=gtv;" + "UID=root;" + "PASSWORD=;" + "SslMode=none"; public bool FirstConnect() { MySqlConnection db = new MySqlConnection(connectionString); db.Open(); string state = db.State.ToString(); NAPI.Util.ConsoleOutput(state); if (db.State == ConnectionState.Open) return true; else return false; } } } And here my pretty long exception: What did I do wrong? Thank you for your help.
  12. CMHDev

    [C#] Send Mail from server.

    Version 1.0.0

    35 downloads

    Send mails from the server simple and easy. Ex: To work, you need to enable IMAP Access *This code was only tested on the GMAIL service
  13. This occurs due to player stamina hitting zero, resulting in hp being lost. Below is the workaround for this in both C# and JavaScript. C# //Subscribe the Tick event Events.Tick += Tick; public void Tick(List<Events.TickNametagData> nametags) { RAGE.Game.Player.RestorePlayerStamina(1.0F); } JavaScript mp.events.add('render', () => { mp.game.player.restoreStamina(100); });
  14. Pintex

    Events dosn't trigger.

    using System; using GTANetworkAPI; namespace roleplay { public class Main : Script { public Main() { } [ServerEvent(Event.PlayerSpawn)] public void OnPlayerConnected(Client player) { NAPI.Util.ConsoleOutput("Roleplay wurde sasd!"); } [ServerEvent(Event.ResourceStart)] public void OnResourceStart() { NAPI.Util.ConsoleOutput("Roleplay wurde gestartet!"); } } } This is my code and the onPlayerConnected Event make nothing. I don't know why. I hope you can help me! Thank you.
  15. Stefan Todorovski

    [C#] Positioning the player problem

    Hello, scripters! 😀 I'm new to the RAGE scene and recently started scripting my own gamemode. I'm using WiredPlayers gamemode as an example, but i have some strange issues. So far i succeeded creating VS solution, connecting it with MySQL database and player authentication system. But i have one problem with recreating the lobby system: I can't set the player position when they are logging in, but strangely enough i can change other player-related properties like skin. Here is my code: [ServerEvent(Event.PlayerConnected)] public void OnPlayerConnected(Client player) { NAPI.Player.SetPlayerSkin(player, PedHash.Stripper01SFY); // WORKS PERFECTLY player.Transparency = 255; InitializePlayerData(player); // CALLING THE INITIALIZEPLAYERDATA FUNCTION //Other stuff for logging the user } private void InitializePlayerData(Client player) { player.Position = new Vector3(152.26, -1004.47, -99.00); //DOESN'T TELEPORT THE PLAYER AT THIS POSITION player.Dimension = Convert.ToUInt32(player.Value); player.Health = 100; } But when i finish logging in and i use the command /goto, it teleports me to that destination. [Command("goto", "~y~USAGE: ~w~/goto")] public void CMD_Goto(Client player) { player.Position = new Vector3(152.26, -1004.47, -98.00); } Is there something i'm missing in order for this to work ??
  16. Guten Morgen Community, wir sind gerade an der Konzeption eines Projektes und wegen zur Zeit ab in welcher Sprache wir es entwickeln sollen. C# oder NodeJS? Würde mich über eure Antworten freuen und Gründe warum Ihr die gewählte Sprache nehmen würdet oder warum man sie nehmen sollte. Vielen Dank!
  17. Tach Ladys 😉 Grundidee: Ein Auto auf ein Flatbed kleben und das soll da auch bleiben bis zum Absockeln. Unter NodeJS funktioniert das AttachTo einwandfrei nun möchte ich das auch unter C#. Da die Funktion "not implemented yet" ist versuchte ich Workarounds wie AddRope, Freeze und Timerbased Positioning. Nun hoffe ich das andere Entwickler bessere Ideen haben als meine? 😉 Clientside fällt weg da es nicht gesynct ist... falls man das syncen kann für alle nur raus damit wie^^ Grüße White 😉
  18. Stuyk

    C# Rage.MP Tutorial Series

    RAGE.MP C# Scripting Video Guides Playlist: (Automatically Updates on Video Releases) Channel: https://www.youtube.com/stuyk Whale Shares: Whale Shares is where I'll be posting my text based guides for the Rage.MP C# Tutorials. You can check that out here: https://whaleshares.io/@stuyk
  19. DOMINO Remember when there were administrators out there printing money and inflating roleplay server economies? I sure do. fucking ngg. Domino is a solution to economics for any server that plans on using money. If they want a realistic blockchain based economy. THIS IS IT. This is the one stop solution to tell other people who have access to your database to go away. Because each and every transaction is backed by the previous transaction and it's completely untouchable. Once one transaction is off by a single letter, number, amount, etc. The entire economy breaks. This relieves the potential issue of a security breach on the server by allowing users to easily implement and run an economy that doesn't need admin access. What does this do? Economics: What is Blockchain? The short answer is Bitcoin. The long answer is a a video. Where can I obtain this / watch progress? If you plan on implementing this into your server. You may want to speak to me on Discord about the potential issues in the future before committing to it. I do not recommend using this plugin until the .DLL version is released with all potential bugs ironed out. Use this if you just want to test it out and see how it works. But seriously contact me on Discord if you want to use this for real. How Do I Use this for References? Download the source. Compile it / Build it. You should have a .dll file. Create a new project and initialize it. In your meta add: <script src="assembly/DominoBlockchain.dll" /> <assembly ref="assembly/DominoBlockchain.dll" /> <assembly ref="assembly/LiteDB.dll" /> <assembly ref="assembly/EasyEncryption.dll" /> Right-click your Project in visual studio and add DominoBlockchain as a reference. You'll be able to use the references from that point forward. DominoBlockchain.XXXXX I haven't used this for references yet. Let me know how it goes. I'll work on cleaning up the rest. What are the benefits? Immutable Money Hard Cap Player Money Separate from Traditional Database Shared by Admins Flatfile for Localized Database Offline Transactions Inflation is entirely Player Controlled not Admin Controlled What are the cons? Immutable Transactions may take up to a minute if the transaction is difficult to mine. Flatfile Size will be HUGE when you reach over 500,000 transactions. Currently do not know the limitations on how big the database can be. Could be close to 2TB when full. Transaction Limit: 2,147,483,647 What needs to be done: Multiple Blockchain Database Files Verification of Last 1,000 Transactions vs ALL Transactions. Full Verification Check on Startup Only Change Player Names to Lowercase to prevent typecase mixups. Allow Players to use a PinCode system for Any Amount of Bank Accounts Auto Prune Old Account Transactions Back into Server Funds Settings File to Adjust Tax / Hard Cap / etc. .DLL Calls / Exports / Etc. - Someone PM me on how to do this pls.
  20. Stuyk

    LiteDB Wrapper

    What? This is a way to manage all of your files and create basic database instances for your players / accounts / vehicles / etc. The structure of it is really easy to work with. All you need to do is create a class make it public and supply and integer id. Then you can add the rest. Ie. Account.cs public class Account { public int ID { get; set; } public string Name { get; set; } public string Password { get; set; } } Then you can take your class instance and import it into the Database and create collections of the class type. Adding a new 'Account' class to the Database: Account account = new Account { Name = "Stuyk", Password = "Test" }; // Example Insert / Upsert into database based on the 'Account' class. Database.Upsert(account); Pulling Data from the Database: Account stuykAccountData = Database.Get<Account>("Name", "Stuyk"); That's pretty much it. Really easy to work with Database for flat-file users. No bullshit SQL lines you have to write. Github: https://github.com/Stuyk/LiteDB-Wrapper-For-RAGE-MP/tree/master YOU MUST COMPILE YOUR RESOURCES IF YOU USE THIS. INSTALLATION INSTRUCTIONS ON GITHUB.
  21. What? It's a pen and paper style skill check handler for your server. Think D&D. Why? If you're looking to try a different flavor for the server you're developing this may interest you. This will allow you to run skill checks for four attributes across players on your server. The attributes are Endurance, Strength, Intelligence, and Charisma. What these attributes allow you to do is deeply dependent on your server. Where would I use this in my Scripts? A good example I've found is lock picking. Let's start with saying that the number we need to beat is 15. Generally speaking people who lock pick might have some Intelligence. Essentially if you have a low talent score on your intelligence such as '5' you will only be getting '+1' to your Intelligence check roll with a '5' divisibility setting for this plugin. Which means we take our talent score and divide it by our divisibility and add a d20 or 20 sided dice roll to our talent score. That generally looks like: d20 + (talent score int / divisibility) = final score. If our final score is greater than the check required to pick the lock it will succeed. Skillcheck.CheckIntelligence(Client client, int scoreToBeat); or Skillcheck.CheckIntelligence(client, 15); What about saving the sheets? The script mostly handles it for you with LiteDB. There's even a settings.json that sets itself up. You can use the following to create / load your sheets. // This will setup a new sheet. CharacterGen.SetupNewSheet(Client client, int strength, int intelligence, int endurance, int charisma, bool randomize, bool save); // This will return a integer modifier for a talent score. CharacterGen.GenerateModifier(); // This will load a talent sheet based on the client connected. CharacterGen.LoadTalentSheet(Client client); How can I play with this? I've included a few commands with the plugin that can be disabled or should be disabled on actual usage. /checksheet, /loadsheet, /savesheet, /newsheet Where to grab it? https://github.com/Stuyk/Talent/releases/ How do I install it? Create a folder in 'bridge/resources' and call it 'talent'. Add 'talent' to your settings.xml in the bridge folder. <resource src="talent" /> Create a meta.xml file inside of 'bridges/resources/talent'. Include the following text: <meta> <info name="talent" type="script" /> <script src=".\Talent.dll" /> </meta> If any of your scripts use Talent add the following to their meta.xml <include resource="talent" />
  22. Доброго времени суток, подскажите, как изменить стандартный спавн игрока при подключении к серверу и после смерти? На [DisableDefaultOnDeathRespawn] Visual Studio ругается "Не удаётся найти тип или имя пространства имён, GTANetworkAPI подключён.
  23. CasualGermans

    Server crashes on CreateOwnedExplosion

    Hey there, I am fairly new to rage.mp but neverless a fairly experienced C# developer. Well I am using the PlaceMine example from gtanetwork. Already rewrote the page to fit NAPI instead of API. Still my server.exe crashes once the mine is supposed to explode. No error logs It just stops running, any ideas ? using System; using GTANetworkAPI; namespace minesTest { public class minesTest:Script { public minesTest() { } [ServerEvent(Event.ResourceStart)] public void myResourceStart() { NAPI.Util.ConsoleOutput("TestScript started!"); } [Command("mine")] public void PlaceMine(Client sender) { var pos = NAPI.Entity.GetEntityPosition(sender); var playerDimension = NAPI.Entity.GetEntityDimension(sender); var prop = NAPI.Object.CreateObject(NAPI.Util.GetHashKey("prop_bomb_01"), pos - new Vector3(0, 0, 1f), new Vector3(), 255, playerDimension); var shape = NAPI.ColShape.CreateSphereColShape(pos, 10); shape.Dimension = playerDimension; bool mineArmed = false; shape.OnEntityEnterColShape += (s, ent) => { if (!mineArmed) return; NAPI.Explosion.CreateOwnedExplosion(sender, ExplosionType.ProxMine, pos, 1f, playerDimension); NAPI.Entity.DeleteEntity(prop); NAPI.ColShape.DeleteColShape(shape); }; shape.OnEntityExitColShape += (s, ent) => { if(ent == sender.Handle && !mineArmed) { mineArmed = true; NAPI.Notification.SendNotificationToPlayer(sender, "Mine has been ~r~armed~w~!", true); } }; } } }
  24. Hello everyone! I've got some errors with the linux bridge package. Some assemblies are not found by the server (and yes, they're in the runtime directory because they come with the bridge package). -> Starting admin resource.. admin: loading scripts.. found 1 script(s) admin: reading referenced assemblies.. found 1 reference(s) admin: warning, netstandard.dll is not found! admin: compiling scripts.. admin: instantiating Main.AdminScript.. admin: loading server events.. found 2 server event(s) admin: loaded 2 server events(s) admin: loading commands.. found 9 command(s) admin: loaded 9 commands(s) -> Resource admin started! Complete version: In this case, the resource doesn't need methods from the assembly (so, it doesn't really matter...) and it won't prevent the compilation. Steps to reproduce: Prepare a fresh install of linux server (with the bridge!). Go through bridge resources directory and open meta.xml in "admin/" (for example). Paste this new content: <meta> <info name="Administration Utilities" author="Guadmaz" type="script" /> <assembly ref="netstandard.dll"/> <script src="admin.cs"/> </meta> Start the server. This will not work with all of the assemblies. For example, System.Linq.dll will be detected and System.Linq.Queryable.dll will not. All of my tests have been done on Debian 9 and Ubuntu 16.04 (with all required deps). I don't know what to do to solve the problem... maybe an assembly version problem? Thanks!
  25. Здравствуйте, только сегодня узнал о данном мультиплеере. Начал разработку сервера, но так как я C# знаю на довольно высоком уровне, естественно мне захотелось писать на нём. С запуском скриптов на JS всё хорошо, а вот с шарпом проблемы. Может кто знает как решить проблему на скрине и где взять файл coreclr.dll? Делал всё по данному уроку: https://github.com/SkyLaGer/RageMP-CSharp-Wiki/wiki/Новый-проект-в-Visual-Studio-2017