feat(ReceivedEvent): Added CKickVotesEvent (#363)
This commit is contained in:
parent
e16eb956bf
commit
1615dbc5cc
@ -31,6 +31,7 @@ namespace big
|
||||
struct
|
||||
{
|
||||
pair clear_ped_task{};
|
||||
pair kick_vote{};
|
||||
pair report_cash_spawn{};
|
||||
pair modder_detect{};
|
||||
pair request_control_event{};
|
||||
@ -399,6 +400,8 @@ namespace big
|
||||
|
||||
g->notifications.received_event.clear_ped_task.log = j["notifications"]["received_event"]["clear_ped_task"]["log"];
|
||||
g->notifications.received_event.clear_ped_task.notify = j["notifications"]["received_event"]["clear_ped_task"]["notify"];
|
||||
g->notifications.received_event.kick_vote.log = j["notifications"]["received_event"]["kick_vote"]["log"];
|
||||
g->notifications.received_event.kick_vote.notify = j["notifications"]["received_event"]["kick_vote"]["notify"];
|
||||
g->notifications.received_event.modder_detect.log = j["notifications"]["received_event"]["modder_detect"]["log"];
|
||||
g->notifications.received_event.modder_detect.notify = j["notifications"]["received_event"]["modder_detect"]["notify"];
|
||||
g->notifications.received_event.request_control_event.log = j["notifications"]["received_event"]["request_control_event"]["log"];
|
||||
@ -677,6 +680,7 @@ namespace big
|
||||
{
|
||||
"received_event", {
|
||||
{ "clear_ped_task", return_notify_pair(g->notifications.received_event.clear_ped_task) },
|
||||
{ "kick_vote", return_notify_pair(g->notifications.received_event.kick_vote) },
|
||||
{ "modder_detect", return_notify_pair(g->notifications.received_event.modder_detect) },
|
||||
{ "report_cash_spawn", return_notify_pair(g->notifications.received_event.report_cash_spawn) },
|
||||
{ "request_control_event", return_notify_pair(g->notifications.received_event.request_control_event) },
|
||||
|
@ -31,6 +31,21 @@ namespace big
|
||||
|
||||
switch (static_cast<eNetworkEvents>(event_id))
|
||||
{
|
||||
case eNetworkEvents::CKickVotesEvent:
|
||||
{
|
||||
std::uint32_t player_bitfield;
|
||||
buffer->ReadDword(&player_bitfield, 32);
|
||||
if (player_bitfield & 1 << target_player->m_player_id)
|
||||
{
|
||||
if (g->notifications.received_event.kick_vote.log)
|
||||
LOG(INFO) << "RECEIVED_EVENT_HANDLER : " << source_player->get_name() << " is voting to kick us.";
|
||||
if (g->notifications.received_event.kick_vote.notify)
|
||||
g_notification_service->push_warning("Kick Vote",
|
||||
fmt::format("{} is voting to kick us.", source_player->get_name()));
|
||||
}
|
||||
buffer->Seek(0);
|
||||
break;
|
||||
}
|
||||
case eNetworkEvents::CNetworkIncrementStatEvent:
|
||||
{
|
||||
const auto increment_stat_event = std::make_unique<CNetworkIncrementStatEvent>();
|
||||
@ -61,7 +76,7 @@ namespace big
|
||||
if (action >= 15 && action <= 18) {
|
||||
g_pointers->m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
|
||||
if (g->notifications.received_event.vehicle_temp_action.log)
|
||||
LOG(INFO) << "RECEIVED_EVENT_HANDLER : " << source_player->get_name() << "sent TASK_VEHICLE_TEMP_ACTION crash.";
|
||||
LOG(INFO) << "RECEIVED_EVENT_HANDLER : " << source_player->get_name() << " sent TASK_VEHICLE_TEMP_ACTION crash.";
|
||||
if (g->notifications.received_event.vehicle_temp_action.notify)
|
||||
g_notification_service->push_warning("Protection",
|
||||
fmt::format("{} sent TASK_VEHICLE_TEMP_ACTION crash.", source_player->get_name()));
|
||||
|
@ -41,18 +41,18 @@ namespace big
|
||||
|
||||
ImGui::BeginGroup();
|
||||
draw_pair_option("Clear Ped Tasks", received_event.clear_ped_task);
|
||||
draw_pair_option("Kick Votes Notification", received_event.kick_vote);
|
||||
draw_pair_option("Detect Modder Events", received_event.modder_detect);
|
||||
draw_pair_option("Report Cash Spawn", received_event.report_cash_spawn);
|
||||
ImGui::EndGroup();
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
ImGui::BeginGroup();
|
||||
draw_pair_option("Report Cash Spawn", received_event.report_cash_spawn);
|
||||
draw_pair_option("Request Control Event", received_event.request_control_event);
|
||||
draw_pair_option("Vehicle Temp Action", received_event.vehicle_temp_action);
|
||||
ImGui::EndGroup();
|
||||
|
||||
|
||||
components::small_text("Script Event Handler");
|
||||
|
||||
auto& script_event_handler = g->notifications.script_event_handler;
|
||||
@ -98,7 +98,6 @@ namespace big
|
||||
draw_pair_option("Reports", g->notifications.reports);
|
||||
draw_pair_option("Transaction Error / Rate Limit", g->notifications.transaction_rate_limit);
|
||||
draw_pair_option("Invalid sync", g->notifications.invalid_sync);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user