Jump to content

Recommended Posts

Posted

Hey folks!

I am currently trying to get the original events as I need a specific event that is not provided by Rage.

I have tried using javascript to read the events using the three natives:
- GET_NUMBER_OF_EVENTS
- GET_EVENT_AT_INDEX
- GET_EVENT_DATA

Reading the events and outputting the eventId works fine, but I can't read the eventdata.

I thought maybe it was just JavaScript and wrote a script in C# for it.
Unfortunately I have the same problem there: GET_EVENT_DATA always returns FALSE and the passed variable 'eventData' does not change.

The Script:

using System;
using System.Collections.Generic;
using RAGE;

namespace ClientEvents
{
    public class Main : RAGE.Events.Script
    {
        public Main()
        {
            RAGE.Events.Tick += this.OnTick;
        }

        public void OnTick(List<Events.TickNametagData> nametags)
        {
            int eventGroup = 0;
            for (int eventIndex = 0; eventIndex < RAGE.Game.Invoker.Invoke<int>(RAGE.Game.Natives.GetNumberOfEvents, eventGroup); eventIndex++)
            {
                int eventId = RAGE.Game.Invoker.Invoke<int>(RAGE.Game.Natives.GetEventAtIndex, eventGroup, eventIndex);

                int[] eventData = new int[32];

                Chat.Output($"Event {eventId} was fired.");

                if (!RAGE.Game.Invoker.Invoke<bool>(RAGE.Game.Natives.GetEventData, eventGroup, eventIndex, eventData, 32))
                {
                    Chat.Output("Failed to retrieve EventData");
                }
            }
        }
    }
}

 

Posted

I found my problem:
It is very important to pass the correct size in RAGE.Game.Natives.GetEventData.
You can find the sizes in decompiled scripts: https://github.com/Sainan/GTA-V-Decompiled-Scripts
I have already gone through the decompiled scripts and made the following list:
 

Spoiler
Eventgroup, Event, DataSize (0 means no data will be retrieved), notes
0,16,2
0,141,1, damage data is always the entity that got the damage
0,142,1, 
0,145,1
0,147,1, achievment/stats
0,149,2
1,151,0
1,152,56
1,153,56
1,154,56
1,155,21
1,156,0
1,157,1
1,160,0
1,161,0
1,162,1
1,164,0
1,165,6
1,166,8
1,170,22
1,171,22, transistion?
1,172,0
1,173,2
1,174,25, Size changes very often. Highest Size found: 25 Seems to be a "main" event for all scripts
1,176,7
1,177,2
1,178,0
1,181,0
1,183,2
1,184,1
1,185,13, damage
1,186,0
1,187,2
1,188,0
1,189,0
1,190,0
1,191,20
1,192,0
1,193,0
1,194,21
1,195,15
1,196,21
1,197,29
1,199,3
1,200,36
1,201,2
1,203,0
1,205,15
1,206,0
1,207,15
1,208,30
1,209,30
1,210,35
1,211,2
1,212,22
1,213,44
1,214,39
1,217,34
1,218,11
1,219,3
1,220,19
1,221,0
1,222,13
1,223,14
1,224,13
1,225,19
1,226,7
1,227,2
1,228,1
1,230,2
1,231,1
1,232,0
1,233,25
1,234,2
1,235,1
1,236,0
1,237,2
1,238,3
1,243,4

 

 

  • araynimax changed the title to [SOLVED] Retrieve game events using Natives

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...