Search the Community
Showing results for tags 'cs'.
-
Good day, I recently tried to make Blackout on my server, but for some reason it doesn’t work, or rather you can see some changes, but the light itself does not turn off, I thought that maybe I had modifications, but when I went offline I checked, it’s there it works, I use the method RAGE.Game.Graphics.SetBlackout(bool); , below are screenshots from offline and rage In Singleplayer: https://cdn.discordapp.com/attachments/752609061240963202/1293248052739702876/image.png?ex=6707575b&is=670605db&hm=d43ad647f3cdb37c7e4b0063ccbc25ad4ba6ddd30c65a7cf5880fc8df7f44d27& In RageMP: https://imgur.com/a/nR2sP3V
-
So, i was on my way to create a simple practice Script. Everything fine so far, my ClientSide Menu opens etc. The button activation gets fired and is from the correct element. The the Remote Event should trigger which does not seem to happen. Any Thoughts where i messed up? So far i received no Error what so ever. Server Side Main.cs (Snippet) [RemoteEvent("VehicleSpawn")] public void VehicleSpawn(Player player, bool locked, bool engine, string vehName) { player.SendChatMessage("Got called"); uint vHash = NAPI.Util.GetHashKey(vehName); player.SendChatMessage(vHash.ToString()); NAPI.Vehicle.CreateVehicle(vHash, player.Position.Around(5), 0.0f, 0, 0, locked: locked, engine: engine); } Client Side Main Class public class Main : Events.Script { public Main() { Events.Add("playRP.CMD.vehicle", VehicleNative); } public void VehicleNative(object[] args) { Chat.Show(false); RAGE.Ui.Cursor.Visible = true; MenuPool mPool = new MenuPool(); UIMenu VehicleMenu = new UIMenu("Spawner","Spawn your desired Vehicle"); mPool.Add(VehicleMenu); bool Locked = false; bool Engine = true; UIMenuCheckboxItem locked = new UIMenuCheckboxItem("Locked?", false); UIMenuCheckboxItem engine = new UIMenuCheckboxItem("Engine On?", true); VehicleMenu.AddItem(locked); VehicleMenu.AddItem(engine); var vehNames = new List<dynamic> { "Infernus", "Cheetah", "Dominator" }; string selectedVeh = vehNames[0]; UIMenuListItem VehicleName = new UIMenuListItem("Vehicle", vehNames, 0); VehicleMenu.AddItem(VehicleName); UIMenuItem CreateButon = new UIMenuItem("Create Vehicle!"); VehicleMenu.AddItem(CreateButon); VehicleMenu.OnCheckboxChange += (sender, item, flag) => { if(sender == VehicleMenu) { if (item == locked) Locked = flag; else if (item == engine) Engine = flag; } }; VehicleMenu.OnListChange += (sender, item, index) => { if(sender == VehicleMenu) { if(item == VehicleName) { selectedVeh = item.IndexToItem(index).ToString(); } } }; CreateButon.Activated += (sender, item) => { if(sender == VehicleMenu) { if(item == CreateButon) { Chat.Output("CALLED ACTIVATED"); Events.CallRemote("VehicleSpawn", locked, engine, selectedVeh); Chat.Show(true); VehicleMenu.Visible = false; VehicleMenu.FreezeAllInput = false; RAGE.Ui.Cursor.Visible = false; } } }; VehicleMenu.OnMenuClose += (sender) => { if(sender == VehicleMenu) { Chat.Show(true); VehicleMenu.Visible = false; VehicleMenu.FreezeAllInput = false; RAGE.Ui.Cursor.Visible = false; } }; VehicleMenu.Visible = true; VehicleMenu.FreezeAllInput = true; VehicleMenu.RefreshIndex(); Events.Tick += (name) => { mPool.ProcessMenus(); }; } } Thanks in Advance for helping and hopefully pointing out the Obvious ^^
-
Backend Developer in .CS we are a large English voice and text based server looking to bring on another backend developer that has had experience on Rage Multiplayer our server is almost ready to be released. We are looking for a backend developer that understand .Cs and also has knowledge of .Js and Database understanding we are a team of developers that have front end designers/developers and a back end dev already but another backend dev for the project would be great our community is almost 1,000 people and growing. requirements for this position - English speaking (or well spoken) - Understand how Rage MP works - Great .Cs background "if you are interested in this position feel free to contact me direct or leave me a comment here and ill reach out to you "
-
Introduction. I recently decided to start writing my own server for RAGE: MP. Have experience developing servers for SA:MP, I study several programming languages. I decided to write the server in C#, because I know Java relatively well and I had a little experience writing scripts in C# for the game Space Engineers. Description of my problem Actually, the problem arose when I tried to write a simple client-side script. When I connect to my server, I get this error: C#: Server packages could not be compiled successfully! Check clientside_cs.txt for C# logs. File "enable-clientside-cs.txt" in the root directory of RAGE:MP I have. Here is the information from the file "clientside_cs.txt": I'm a newbie, so I might have some stupid mistakes. Here is a screenshot of the project itself. Please help me.
-
Client side: class KeyManager { constructor() { mp.keys.bind(0x11, true, function() { if(mp.players.local.vehicle && mp.players.local.vehicle.getPedInSeat(-1) === mp.players.local.handle) { mp.events.callRemote('BANG_onVehicleShotPrimary', mp.players.local.vehicle.getForwardVector()); } }); } } export default new KeyManager(); Server side: [RemoteEvent ("BANG_onVehicleShotPrimary")] public void BANG_onVehicleShotPrimary (Client player, object[] arguments) { player.SendChatMessage("HALLILUAH"); } Console: at object RuntimeMethodHandle.InvokeMethod(object target, object[] arguments, Signature sig, bool constructor) at object System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(object obj, object[] parameters, object[] arguments) at void GTANetworkInternals.RemoteEventParser.Parse(Client sender, ulong eventNameHash, object[] args) in C:\Users\Adam\Documents\Git\comp-layer2\BootstrapperNC\Handlers\ResourceInfo.cs:line 62 at void GTANetworkInternals.RemoteEventHandler.Parse(Client sender, ulong eventNameHash, object[] arguments) in C:\Users\Adam\Documents\Git\comp-layer2\BootstrapperNC\Handlers\ResourceInfo.cs:line 67 System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —-> System.NullReferenceException: Object reference not set to an instance of an object. at void GC_FunGame.Main.BANG_onVehicleShotPrimary(Client player, object[] arguments)
-
Hey all, I need some help to find out how to workaround or fix my code, since there are compilation errors ("Missing assembly x"). - The error output is down below. Here is my code: public static void AddClothsToMenu(UIMenu menu, JArray array, int componentID, JArray ownedClothes) { foreach (JObject element in array) { int drawable = int.Parse(element["drawable"].ToString()); int texture = int.Parse(element["texture"].ToString()); int price = int.Parse(element["price"].ToString()); string itemName = element["name"].ToString(); string RLText = ""; UIMenuItem item = new UIMenuItem(itemName); JObject currentObject = new JObject() { new JProperty("texture", texture), new JProperty("drawable", drawable) }; if (componentID == -1) currentObject.Add(new JProperty("componentId", element["cid"])); if (ownedClothes.Contains(currentObject)) { //item.SetRightBadge(UIMenuItem.BadgeStyle.Clothes); RLText = "Gekauft"; } else { RLText = $"{price},00$"; } item.SetRightLabel(RLText); item.Activated += (UIMenu sender, UIMenuItem senderItem) => { RAGE.Elements.Player p = RAGE.Elements.Player.LocalPlayer; bool canDress = true; // If Cloth is not bought yet, charge the player the price of the cloth if (!(/*senderItem.RightLabel*/RLText == "Gekauft")) // Wenn nicht gekauft { canDress = false; if (p.GetSharedData("Cash") != null) { if (int.Parse(p.GetSharedData("Cash").ToString()) > price) { canDress = true; } } } if (canDress & p.GetSharedData("OwnedClothes") != null) { Events.CallRemote("cash_reduce", (float) price); JObject obj = new JObject(); if (componentID >= 0) { obj.Add(new JProperty("componentId", componentID)); } else if (componentID == -1) { obj.Add(new JProperty("componentId", element["cid"])); } obj.Add(new JProperty("drawable", element["drawable"])); obj.Add(new JProperty("texture", element["texture"])); obj.Add(new JProperty("save", true)); obj.Add(new JProperty("sync", true)); Events.CallRemote("set_synced_outfit", obj.ToString()); // Updating OwnedClothes database row (Updating owned clothes list) JObject AllClothData = JObject.Parse(p.GetSharedData("OwnedClothes").ToString()); JArray currentComponentArray = (JArray) AllClothData[componentID.ToString()]; JObject newItem = new JObject(); newItem.Add(new JProperty("drawable", element["drawable"])); newItem.Add(new JProperty("texture", element["texture"])); if (componentID == -1) newItem.Add(new JProperty("componentId", element["cid"])); currentComponentArray.Add(newItem); AllClothData[componentID.ToString()] = currentComponentArray; Events.CallRemote("UPDATE_OwnedClothes", AllClothData); // Updating Clothes database row (Updating currently wearing clothes to be loaded on new logon) if (componentID >= 0) { JObject currentClothes = JObject.Parse(p.GetSharedData("Clothes").ToString()); /* COMMENTED OUT DUE TO HARD TO READ */ //currentClothes[componentID] = new JObject() { new JProperty("drawable",element["drawable"]), new JProperty("texture", element["texture"]) }; // Our current Component, that is gonna be changed JObject currentComponent = (JObject)currentClothes[componentID]; currentComponent["drawable"] = element["drawable"]; currentComponent["texture"] = element["texture"]; currentClothes[componentID] = currentComponent; Events.CallRemote("UPDATE_Clothes", currentClothes); } else { JObject currentClothes = JObject.Parse(p.GetSharedData("Clothes").ToString()); /* COMMENTED OUT DUE TO HARD TO READ */ //currentClothes[componentID] = new JObject() { new JProperty("drawable",element["drawable"]), new JProperty("texture", element["texture"]) }; // Our current Component, that is gonna be changed JObject currentComponent = (JObject)currentClothes[element["cid"]]; currentComponent["drawable"] = element["drawable"]; currentComponent["texture"] = element["texture"]; currentClothes[element["cid"]] = currentComponent; Events.CallRemote("UPDATE_Clothes", currentClothes); } } else { string message = "~r~Du hast nicht genug Geld dabei!"; if (p.GetSharedData("Cash") != null) { int cash = int.Parse(p.GetSharedData("Cash").ToString()); message += $"\nDir fehlen ~y~{(price - cash)},00$"; } SendNotification(message); } }; menu.AddItem(item); } } The errors started to occur when the Activated event got complicated. The compilation errors: C#: compiling scripts.. CS0012: Der Typ "ITypedList" ist in einer nicht referenzierten Assembly definiert. Fügen Sie einen Verweis auf die Assembly "System.ComponentModel.TypeConverter, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" hinzu. -> D:\Programme\RageMP\client_resources\185.239.238.137_22005\cs_packages\Helper.cs:29 CS0012: Der Typ "IBindingList" ist in einer nicht referenzierten Assembly definiert. Fügen Sie einen Verweis auf die Assembly "System.ComponentModel.TypeConverter, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" hinzu. -> D:\Programme\RageMP\client_resources\185.239.238.137_22005\cs_packages\Helper.cs:29 CS0012: Der Typ "INotifyCollectionChanged" ist in einer nicht referenzierten Assembly definiert. Fügen Sie einen Verweis auf die Assembly "System.ObjectModel, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" hinzu. -> D:\Programme\RageMP\client_resources\185.239.238.137_22005\cs_packages\Helper.cs:29 CS0012: Der Typ "INotifyPropertyChanged" ist in einer nicht referenzierten Assembly definiert. Fügen Sie einen Verweis auf die Assembly "System.ObjectModel, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" hinzu. -> D:\Programme\RageMP\client_resources\185.239.238.137_22005\cs_packages\Helper.cs:29 CS0012: Der Typ "ICustomTypeDescriptor" ist in einer nicht referenzierten Assembly definiert. Fügen Sie einen Verweis auf die Assembly "System.ComponentModel.TypeConverter, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" hinzu. -> D:\Programme\RageMP\client_resources\185.239.238.137_22005\cs_packages\Helper.cs:29 CS0012: Der Typ "INotifyPropertyChanging" ist in einer nicht referenzierten Assembly definiert. Fügen Sie einen Verweis auf die Assembly "System.ObjectModel, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" hinzu. -> D:\Programme\RageMP\client_resources\185.239.238.137_22005\cs_packages\Helper.cs:29 TIP: Line 29 is the declaration - UIMenuItem item = new UIMenuItem(itemName); Please help me as I can't continue to develop on this system for now, I tried a lot. Thanks in advance!
-
Hey everyone, I encountered a problem which I was not able to find a solution to solve my issue. I want to use a JObject parsed from a .json file. I used FileStreams and StreamReaders for that and got the error "C# filestreams could not be used" on login on the client side. My code is: public static JObject GetClothData(Sex sex) { string plainText = string.Empty; using (FileStream fs = File.OpenRead($"Clothes{(sex == Sex.Male ? "M" : "F")}.json")) { using (StreamReader sw = new StreamReader(fs)) { plainText = sw.ReadToEnd(); sw.Close(); } fs.Close(); } return JObject.Parse(plainText); } Is there anything to do in advance to allow filestreams or are there any workarounds? (e.g. in JS I can require a json file) Thanks in advance! Tim.
- 1 reply
-
- Cs
- Clientside
-
(and 4 more)
Tagged with:
-
Kurze Frage bezüglich Client Side programmierung
fabiopimo posted a topic in Client- und Serverhilfe
Hey, ich wollte mit dem programmieren für RageMP anfangen, aber da stelle ich mir eine Frage. Man kann ja clientseitig mit C# und JS programmieren, kann man mit beidem alles machen oder ist eins der zwei Sprachen im nachteil oder deutlich schwerer? Auf eine Antwort würde ich mich freuen. Mit freundlichen Grüßen FabioPimo -
Version 2.1
706 downloads
With this script you can easily create custom timer. The file is fully commented and should be easy to understand. The file in Shared is required - and then use either the file in Server or in Client depending on where you are using it. You have to use the constructor 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 // new Timer(() => testTimerFunc(player, "hi"), 1000, 1); // Normal without parameters // new Timer(testTimerFunc, 1000, 1); // Without existing method // var timer = new Timer(() => { NAPI.Chat.SendChatMessageToPlayer(player, "[TIMER3] Bonus is da best"); }, 1000, 0); // Kill the timer // timer.Kill(); } -
Version 1.0.0
145 downloads
Just an example/wrapper on how to properly use "GetClosestObjectOfType" and fetch data from an object. I've been using this in my server for a while now to make it easier to get XYZ and rotation of objects in bulk, instead of having to go through them in codewalker which can be a pain. Installation Move client_packages to your client_packages folder Move Serverside C#/GetWorldObjects.cs to your gamemode or script. Move objectLocations.json to your server root directory. Usage The JSON file included in the zip contains the pacific bank vault door as an example object. Use the /getworldobjects or /gwo command to run through all the items in the JSON file and fetch the X, Y, Z and XYZ Rotation of the object. As of right now it'll simply log the object to your server console and continue to the next object in the list, you can extend this functionality by editing the "REMOTE_EVENT_OnWorldObjectFetched" method in GetWorldObjects.cs server-side script. JSON file object info public class ObjectLocation { // The model name to look for, you can fetch this from CodeWalker or RAGEMP objectdb for example. public string Model { get; set; } // The model that should replace the model at this location, optional. I personally used this to store in the database and then on server start it'd delete the world object and replace it with the object model specified here. public string ReplacementModel { get; set; } = ""; // A position within X distance of the object you want to get the data of, distance can be specified by the Radius. public Vector3 Position { get; set; } // An optional type you can pass to the method so you can use it later on for data storage purposes(eg keep objects of certain types separated by an ID) public int Type { get; set; } = 0; // The radius to find the object, doesn't have to be too precise altho I generally recommend putting the player's teleport coordinates as close to the object as possible and decreasing range to 5 or 10. public int Radius { get; set; } } [ { "Model": "v_ilev_bk_vaultdoor", "ReplacementModel": "v_ilev_bk_vaultdoor", "Type": 0, "Radius": 25, "Position": { "X": 254.2859, "Y": 225.3845, "Z": 101.8757 } }, { "Model": "another_object_model_name", "ReplacementModel": "another_object_model_name_to_replace", "Type": 0, "Radius": 10, "Position": { "X": 1234.567, "Y": 123.456, "Z": 12.345 } }, ... ] All you have to do is add more items to the JSON file and it'll run thru all of them.-
- CS
- GetClosestObjectOfType
-
(and 1 more)
Tagged with:
-
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Data.Common, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Не удается найти указанный файл. at new ServerSide.mysqli(string host, string user, string password, string db) at new ServerSide.Manager() in D:\rumod\ragemp\server-files\ragemp_csharp_scripts\ragemp_uncomiled_scripts_csharp\ServerSide\Manager.cs:line 9 --- End of inner exception stack trace --- at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at GTANetworkInternals.GameServer.<InstantiateScripts>d__61.MoveNext() at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext() at System.Collections.Generic.List`1.AddEnumerable(IEnumerable`1 enumerable) at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection) at GTANetworkInternals.GameServer.StartResource(String resourceName, String parent) Я подключил модуль MySql, написал реализации класса, но появляются такие ошибки. Сразу скажу, что он не может найти библиотеку я понимаю, дело в том, что она присутствует. I connected the MySql module, wrote class implementations, but such errors appear. I must say right away that he cannot find the library, I understand, the fact is that it is present.
-
Our dev team is looking for a nice and friendly developer for our new project. If somebody has time and desire then join the discord and contact the head of devemopment. We have a big community with 700 persons. Actually we have 3 devs we speak German and English. If you are interested dm the head of development. And if you want we will pay you when you help us. Discord: https://discord.gg/9yMke4f
-
- Developer
- development
-
(and 3 more)
Tagged with:
-
Ищем разработчиков для скриптинга GTA RAGE платим отлично Так же принимаем любого человека который готов приносить пользу развивающемуся проекту, получать опыт и в будущем стать частью его. Уже написаны сервера по Counter-Strike, пишутся сервера по RUST и MINECRAFT VK: https://vk.com/themalasti MAIL: [email protected]
-
Доброго времени суток всем. Столкнулся с проблемой установки скриптов на C# под bridge. Никакие готовые скрипты не хотят ставиться, только некоторые. Выдают куча ошибок, и только 20% запускаются. Качал bridge с офф сайта или типа того, со всеми (Которые там присутствовали) библиотеками. Если я заменю файл "bootstrapper.dll " в папке /runtime на старую версию, то некоторые из скриптов, которые ранее не запускались, начинают нормально загружаться, и то, не все. И перестают работать те, которые до этого работали. Логи: Скачать! (Ссылкой, потому что лог очень большой.) Я догадываюсь судя по логам, это ошибка импорта GtaNetwork событий или что то типа того.