Search the Community

Showing results for tags 'CSharp'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • 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


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

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start








Found 21 results

  1. 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.
  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. Xabi


    Version 1.1.0


    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.
  4. 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 ??
  5. 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!
  6. 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 😉
  7. Stuyk

    C# Rage.MP Tutorial Series

    RAGE.MP C# Scripting Video Guides Playlist: (Automatically Updates on Video Releases) Channel: 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:
  8. 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
  9. 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.
  10. 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: YOU MUST COMPILE YOUR RESOURCES IF YOU USE THIS. INSTALLATION INSTRUCTIONS ON GITHUB.
  11. 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? 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" />
  12. Доброго времени суток, подскажите, как изменить стандартный спавн игрока при подключении к серверу и после смерти? На [DisableDefaultOnDeathRespawn] Visual Studio ругается "Не удаётся найти тип или имя пространства имён, GTANetworkAPI подключён.
  13. CasualGermans

    Server crashes on CreateOwnedExplosion

    Hey there, I am fairly new to 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); } }; } } }
  14. 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!
  15. Здравствуйте, только сегодня узнал о данном мультиплеере. Начал разработку сервера, но так как я C# знаю на довольно высоком уровне, естественно мне захотелось писать на нём. С запуском скриптов на JS всё хорошо, а вот с шарпом проблемы. Может кто знает как решить проблему на скрине и где взять файл coreclr.dll? Делал всё по данному уроку:Новый-проект-в-Visual-Studio-2017
  16. Shourya90

    help please
  17. Hello, I have one suggestion for team RageMP, please create extension for Microsoft Visual Studio Code. When I write scripts, I have to look at api constantly. Please, consider my suggestion
  18. Hello, i have a ask for about scripting, which language is better Nodejs or CSharp for perormence (Server site)
  19. Version 1.1


    With this script you can easily create custom timer. The file is fully commented and should be easy to understand. You have to use Timer.SetTimer to create the timer. Examples: Examples: // Yes, the method can be private // private void testTimerFunc(Client player, string text) { NAPI.Chat.SendChatMessageToPlayer(player, "[TIMER] " + text); } void testTimerFunc() { NAPI.Chat.SendChatMessageToAll("[TIMER2] Hello"); } [Command("ttimer")] public void timerTesting(Client player) { // Lamda for parameter // Timer.SetTimer(() => testTimerFunc(player, "hi"), 1000, 1); // Normal without parameters // Timer.SetTimer(testTimerFunc, 1000, 1); // Without existing method // Timer.SetTimer(() => { NAPI.Chat.SendChatMessageToPlayer(player, "[TIMER3] Bonus is da best"); }, 1000, 0); }
  20. A similar but official and better system has been integrated into RageMP. To initialize at startup Call this anywhere public MainClass() : Script { //call before any events public MainClass() { RageEventHelper helper = new RageEventHelper(); } } Usage 1. Copy and paste the spoiler code in a new .cs file (Make sure to use needed libraries like LINQ) 2. See example below Notes 1. You are responsible for properly delegating every event at startup. Look in the example below. Only do this once in the main script file and you are set. 2. Events must be public static void methods Example (How to delegate the events properly at startup) public class MainClass : Script { public MainClass() { RageEventHelper helper = new RageEventHelper(); Event.OnPlayerEnterVehicleAttempt += OnPlayerEnterVehicleAttempt; Event.OnUpdate += OnUpdate; } public void OnPlayerEnterVehicleAttempt(Client player, Vehicle veh, sbyte seat) { RageEventExtender.InvokeAllMethods<OnPlayerEnterVehicleAttemptEvent>(RageEventExtender.OnPlayerEnterVehicleAttemptEvents, player, veh, seat); } public void OnUpdate() { RageEventExtender.InvokeAllMethods<OnUpdateEvent>(RageEventExtender.OnUpdateEvents, null); } } In another file (How to use the events) public class AnotherClass { [OnPlayerEnterVehicleAttempt] public static void OnEnterAttempt(Client player, Vehicle veh, sbyte seat) { //enter } [OnUpdate] public static void OnUpdateThing() { //update } }
  21. Appi

    3 question

    Question #1 (FIXED just compiled resource) Code: Question #2 (FIXED) Code: Fix: Use it: Question #3 (FIXED just compiled resource) Code: Reference