From 307235d767a25902d5d6d976af34921cc946c912 Mon Sep 17 00:00:00 2001 From: doxoh Date: Sun, 9 Jul 2023 20:10:20 +0200 Subject: [PATCH] fix OnRmlEventDelegate --- client/src/runtime/CSharpResourceImpl.cpp | 6 ++---- client/src/runtime/eventDelegates.h | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/client/src/runtime/CSharpResourceImpl.cpp b/client/src/runtime/CSharpResourceImpl.cpp index ff755ba..f1a8e90 100644 --- a/client/src/runtime/CSharpResourceImpl.cpp +++ b/client/src/runtime/CSharpResourceImpl.cpp @@ -11,6 +11,7 @@ #include "natives.h" #include "exceptions/LoadException.h" #include "../../c-api/utils/entity.h" +#include "../../c-api/mvalue.h" using namespace std; @@ -125,14 +126,11 @@ void CSharpResourceImpl::OnEvent(const alt::CEvent* ev) case alt::CEvent::Type::RMLUI_EVENT: { auto rmlUiEvent = dynamic_cast(ev); - auto args = rmlUiEvent->GetArgs(); auto name = rmlUiEvent->GetName(); - auto size = args->GetSize(); OnRmlEventDelegate(rmlUiEvent->GetElement(), name.c_str(), - rmlUiEvent->GetArgs().get(), - size); + AllocMValue(std::move(rmlUiEvent->GetArgs()))); break; } case alt::CEvent::Type::WEB_SOCKET_CLIENT_EVENT: diff --git a/client/src/runtime/eventDelegates.h b/client/src/runtime/eventDelegates.h index e6dbce0..f8314fc 100644 --- a/client/src/runtime/eventDelegates.h +++ b/client/src/runtime/eventDelegates.h @@ -8,7 +8,7 @@ typedef void (* ServerEventDelegate_t)(const char* name, alt::MValueConst** args typedef void (* WebViewEventDelegate_t)(alt::IWebView*, const char* name, alt::MValueConst** args, uint64_t size); typedef void (* ConsoleCommandDelegate_t)(const char* name, const char* args[], uint64_t size); typedef void (* WebSocketEventDelegate_t)(alt::IWebSocketClient*, const char* name, alt::MValueConst** args, uint64_t size); -typedef void (* RmlEventDelegate_t)(alt::IRmlElement*, const char* name, alt::IMValueDict* args, uint64_t size); +typedef void (* RmlEventDelegate_t)(alt::IRmlElement*, const char* name, alt::MValueConst* args); typedef void (* PlayerSpawnDelegate_t)(); typedef void (* PlayerDisconnectDelegate_t)();