From 366b87752dd95b85dca0b1d3653d3afe23fa61b9 Mon Sep 17 00:00:00 2001 From: LeonMrBonnie Date: Wed, 8 Sep 2021 19:42:30 +0200 Subject: [PATCH 1/6] Fix possible crash in emitClient with player array Former-commit-id: a85dd473b772e1757de7a265bbf77786544c0cac --- src/bindings/Main.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/bindings/Main.cpp b/src/bindings/Main.cpp index e929c183..380e8495 100644 --- a/src/bindings/Main.cpp +++ b/src/bindings/Main.cpp @@ -94,7 +94,9 @@ static void EmitClient(const v8::FunctionCallbackInfo& info) for (int i = 0; i < arr->Length(); ++i) { Ref player; - V8Entity* v8Player = V8Entity::Get(arr->Get(ctx, i).ToLocalChecked()); + v8::Local ply; + V8_CHECK(arr->Get(ctx, i).ToLocal(&ply), "Invalid player in emitClient players array"); + V8Entity* v8Player = V8Entity::Get(ply); V8_CHECK(v8Player && v8Player->GetHandle()->GetType() == alt::IBaseObject::Type::PLAYER, "player inside array expected"); targets.Push(v8Player->GetHandle().As()); From c7e1620c464b857937439718eeda61ec4d953ecb Mon Sep 17 00:00:00 2001 From: LeonMrBonnie Date: Wed, 8 Sep 2021 19:42:37 +0200 Subject: [PATCH 2/6] Update helpers Former-commit-id: d3c0c2b5f24f122a52ef11bebc3b7fbf19fb7922 --- src/helpers | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/helpers b/src/helpers index 799d93ba..9d347a66 160000 --- a/src/helpers +++ b/src/helpers @@ -1 +1 @@ -Subproject commit 799d93baf9622aa116c11254128d1b77dac94fb3 +Subproject commit 9d347a6646f126146f923cdad7c33c781c4b24d1 From ccb8a27e9977cb4d3e644e59190e052c71bba981 Mon Sep 17 00:00:00 2001 From: LeonMrBonnie Date: Fri, 10 Sep 2021 00:25:45 +0200 Subject: [PATCH 3/6] Update helpers Former-commit-id: e71bec997921ac9021cda1b7510e973bae39bcfb --- src/helpers | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/helpers b/src/helpers index 9d347a66..6867952e 160000 --- a/src/helpers +++ b/src/helpers @@ -1 +1 @@ -Subproject commit 9d347a6646f126146f923cdad7c33c781c4b24d1 +Subproject commit 6867952edcaf5935796003c1c6ba1b80b98ec1d0 From f4027ddfe2278526165ed6d4c2850d3270c74cd8 Mon Sep 17 00:00:00 2001 From: LeonMrBonnie Date: Fri, 10 Sep 2021 15:04:39 +0200 Subject: [PATCH 4/6] Update helpers Former-commit-id: 912be6ba98d63d10d94b18e70b6d3a93a0c79b1d --- src/helpers | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/helpers b/src/helpers index 6867952e..3e240b0a 160000 --- a/src/helpers +++ b/src/helpers @@ -1 +1 @@ -Subproject commit 6867952edcaf5935796003c1c6ba1b80b98ec1d0 +Subproject commit 3e240b0af49f2bd9d09a5c09197ce503d4a289ed From c0747400718b25d15e45228c00ebe2c8296c41a5 Mon Sep 17 00:00:00 2001 From: LeonMrBonnie Date: Fri, 10 Sep 2021 19:24:14 +0200 Subject: [PATCH 5/6] Add player.setIntoVehicle Former-commit-id: 733d9ef990fb52fab73cf7aa4cc781d42bda3a2c --- src/bindings/Player.cpp | 14 ++++++++++++++ src/cpp-sdk | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/bindings/Player.cpp b/src/bindings/Player.cpp index 27f01895..1a074214 100644 --- a/src/bindings/Player.cpp +++ b/src/bindings/Player.cpp @@ -369,6 +369,18 @@ static void IsEntityInStreamRange(const v8::FunctionCallbackInfo& inf V8_RETURN_BOOLEAN(player->IsEntityInStreamingRange(entity)); } +static void SetIntoVehicle(const v8::FunctionCallbackInfo& info) +{ + V8_GET_ISOLATE_CONTEXT(); + V8_CHECK_ARGS_LEN(2); + V8_GET_THIS_BASE_OBJECT(player, IPlayer); + + V8_ARG_TO_BASE_OBJECT(1, vehicle, alt::IVehicle, "Vehicle"); + V8_ARG_TO_UINT32(2, seat); + + player->SetIntoVehicle(vehicle, seat); +} + static void AllGetter(v8::Local name, const v8::PropertyCallbackInfo& info) { v8::Isolate* isolate = info.GetIsolate(); @@ -470,4 +482,6 @@ extern V8Class v8Player("Player", v8Entity, nullptr, [](v8::Local Date: Sat, 11 Sep 2021 17:48:43 +0200 Subject: [PATCH 6/6] Update helpers Former-commit-id: d0e26928dcc423c96ac538c4478fd734072ea67c --- src/helpers | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/helpers b/src/helpers index 3e240b0a..36706536 160000 --- a/src/helpers +++ b/src/helpers @@ -1 +1 @@ -Subproject commit 3e240b0af49f2bd9d09a5c09197ce503d4a289ed +Subproject commit 3670653662f3ac42d87e93cd40fd260e487c693d