Skip to content

Events #14

Answered by Halen84
Roms1383 asked this question in Q&A
Jan 29, 2024 · 2 comments · 10 replies
Discussion options

You must be logged in to vote

Yes, events can be listened to, but it's very annoying. Each event has it's own unique struct, which means you'll need to know the size and members of each struct. Here's an example with EVENT_HITCH_ANIMAL in C++

// Event Struct
struct sHitchAnimalEventData
{
	alignas(8) Ped Human;
	alignas(8) Ped Animal;
};

// Main Game Loop (called every frame)
int numberOfEvents = SCRIPTS::GET_NUMBER_OF_EVENTS(0);
for (int i = 0; i < numberOfEvents; i++)
{
	if (SCRIPTS::GET_EVENT_AT_INDEX(0, i) == MISC::GET_HASH_KEY("EVENT_HITCH_ANIMAL"))
	{
		sHitchAnimalEventData data;
		if (SCRIPTS::GET_EVENT_DATA(0, i, (Any*)&data, 4))
		{
			PED::SET_PED_TO_RAGDOLL(data.Human, 5000, 5000, 0, false, false, "");
		…

Replies: 2 comments 10 replies

Comment options

You must be logged in to vote
8 replies
@Halen84
Comment options

@Roms1383
Comment options

@Roms1383
Comment options

@Halen84
Comment options

@Roms1383
Comment options

Answer selected by Roms1383
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants