Jump to content

Search the Community

Showing results for tags 'event'.

  • 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 8 results

  1. Version 1.0.0


    Hello, this is the winter event script I was planning to release this winter. As it currently stands i'll be a bit bussy this winter, won't have time for free open source projects like this one. I've wanted to create a more complex one, with lots of micro-events inside but time won't allow it so this is useable, you just need to get 10 coordinates of your choice for this fully work for your server. GET A DEVELOPER ! This script is !NOT! plug-and-play since it requires AT LEAST adding 7 more coordinates. I promise next winter for a better event, but for now, i'm struggling with my GF birthday also LOL 🥰🤪 Get in contact with me: Discord: kraneq I'll respond to question
  2. 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 ^^
  3. CXXY

    remote event error

    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)
  4. Hey Guys, hope you can help me with my problem. i want to end a function in a Event, if the player disconnects or leave the Server. But i only get crashes. Here my Code: function playerQuit(player) { console.log(`${player.name} has quit.`); } mp.events.add("playerQuit", playerQuit); // After player die mp.events.add("playerDeath", (player, reason, killer) => { //Set values hospital -> player dead/alive //hospitaltime -> time that he have to be in hospital player.hospital = 1; player.hospitaltime = 12; //update values in database gm.mysql.handle.query('UPDATE `accounts` SET hospital = ?, hospitaltime = ? WHERE username = ?', [player.hospital, player.hospitaltime, player.name], function(err, res, row){ if(err) console.log(err); }); if(player){ gm.mysql.handle.query('SELECT hospital, hospitaltime FROM `accounts` WHERE username = ?', [player.name], function(err, res){ if(err) console.log(err); //Read Values from Database player.hospital = parseInt(res[0]["hospital"]); player.hospitaltime = parseInt(res[0]["hospitaltime"]); }); //if player is dead do -> if(player.hospital == 1){ var timeLeft = parseInt(player.hospitaltime); var timerID = setInterval(countdown, 5000); //Countdown for hospitaltime function countdown(){ //if time over player have to be spawned and timeout have to be cleared if(timeLeft == 1){ clearTimeout(timerID); player.hospitaltime = 0; player.hospital = 0; gm.mysql.handle.query('UPDATE `accounts` SET hospital = ?, hospitaltime = ? WHERE username = ?', [player.hospital , player.hospitaltime, player.name], function(err, res, row){ if(err) console.log(err); }); player.spawn(new mp.Vector3(-799.5113525390625, -99.25785827636719, 37.604530334472656)); return; } else { // if player leave put values in database if(playerQuit.player.name == player.name){ clearTimeout(timerID); player.hospital = 1; player.hospitaltime = timeLeft; gm.mysql.handle.query('UPDATE `accounts` SET hospital = ?, hospitaltime = ? WHERE username = ?', [player.hospital , player.hospitaltime, player.name], function(err, res, row){ if(err) console.log(err); }); return; } //write new values timeLeft--; gm.mysql.handle.query('UPDATE `accounts` SET hospitaltime = ? WHERE username = ?', [timeLeft, player.name], function(err, res, row){ if(err) console.log(err); }); } } } } }); to test this code i have in my cmd.js this: mp.events.addCommand('kick', (player, target) => { let newTarget = mp.players.at(target); if(!target || isNaN(target)) return player.outputChatBox("Syntax: /kick [playerID]"); if(newTarget === null) return player.outputChatBox("There is no player online with the ID given.") newTarget.outputChatBox("You have been kicked from the server."); newTarget.kick('Kicked.'); }); My server crashes everytime when i kick me, when im in the hospital. it also crashes without this Code section: // if player leave put values in database if(playerQuit.player.name == player.name){ clearTimeout(timerID); player.hospital = 1; player.hospitaltime = timeLeft; gm.mysql.handle.query('UPDATE `accounts` SET hospital = ?, hospitaltime = ? WHERE username = ?', [player.hospital , player.hospitaltime, player.name], function(err, res, row){ if(err) console.log(err); }); return; } i get following logs in my console: Error: asyc stack has become corrutep (actual: 29, expected: 30) 1: 00007FF824079805 2: 00007FF824059B82 3: 00007FF824069CB3 4: 00007FF82409ABD0 5: 00007FF82415BCDE 6: 00007FF8241F810D 7: 00007FF8241F5066 [...]***more of them*** Edit: The problem was, that i had 2 events with the same name. now it does not crash anymore
  5. ok simple, what am i doing wrong? Yes I am new to JS: Serverside: mp.events.add('testEvent',(para1,para2,para3) => { console.log('para1:'+para1); console.log('para2:'+para2); console.log('para3:'+para3); }); Clientside: mp.events.callRemote('testEvent',1,2,3); Console: para1:[object Object] para2:1 para3:2 thanks for help! Hank edit: discovered https://wiki.rage.mp/index.php?title=Getting_Started_with_Events
  6. Hey! I just want to know, how can i cancel the chat message sending (event), because my code isn't working. Here is my code: mp.events.add("playerChat", (player, text) => { return true; });
  7. 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 } }
  8. Всем привет. Зашел я значить на вики, да бы посмотреть что и как, какой функционал допилили, описание немного почитать. Наткнулся на серверною и клиентскою часть ивентов и охренел. Хочу спросить у вас дорогие форумчане - почему так мало ивентов, будут ли допиливать новые, что слышали по этому поводу?. С описанием функций и примерами тоже проблемы, но это вопрос времени. И помимо этого хочу задать такой вопрос. (возможно он не много глупый) Я так понимаю что серверною часть можно писать на разных языках. И если это так то поправочка к первому вопросу, меня интересуют ивенты на nodejs.
  • Create New...