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


About Me


Facebook


Youtube


Skype


Web


VK

Found 42 results

  1. 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
  2. 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
  3. 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.
  4. Version 1.0.0

    76 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
  5. 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.
  6. Djoe_

    RAGEMP Merger

    Version 1.0.0

    6 downloads

    What is it? This tool allows you to gather your files in your solution in one file ".cs" while keeping the necessary assembly, namespace, class ... Usage: Just drag your solution on the program or launch from a cmd console "RAGEMP_Merger.exe YourSolutionPath NameFile.cs".
  7. 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 ??
  8. 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!
  9. 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 😉
  10. Доброго времени суток, подскажите, как изменить стандартный спавн игрока при подключении к серверу и после смерти? На [DisableDefaultOnDeathRespawn] Visual Studio ругается "Не удаётся найти тип или имя пространства имён, GTANetworkAPI подключён.
  11. 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!
  12. Здравствуйте, только сегодня узнал о данном мультиплеере. Начал разработку сервера, но так как я C# знаю на довольно высоком уровне, естественно мне захотелось писать на нём. С запуском скриптов на JS всё хорошо, а вот с шарпом проблемы. Может кто знает как решить проблему на скрине и где взять файл coreclr.dll? Делал всё по данному уроку: https://github.com/SkyLaGer/RageMP-CSharp-Wiki/wiki/Новый-проект-в-Visual-Studio-2017
  13. Shourya90

    help please

    https://pastebin.com/aMH8pi3U
  14. 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
  15. Hello, i have a ask for about scripting, which language is better Nodejs or CSharp for perormence (Server site)
  16. 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 } }
  17. Appi

    3 question

    Question #1 (FIXED just compiled resource) Code: https://pastebin.com/dkqQkrA2 Question #2 (FIXED) Code: https://pastebin.com/bwkspwen Fix: Use it: https://msdn.microsoft.com/ru-ru/library/system.threading.timer(v=vs.110).aspx Question #3 (FIXED just compiled resource) Code: https://pastebin.com/LC2LNkf2 Reference