From 1788bc8bf90873c58684c5db83557a940098f4f0 Mon Sep 17 00:00:00 2001 From: yasmasdas <114929405+yasmasdas@users.noreply.github.com> Date: Mon, 9 Jan 2023 18:20:51 +0100 Subject: [PATCH] Add anonymous bounty toggle (#823) Co-authored-by: tupoy-ya <72797377+tupoy-ya@users.noreply.github.com> --- src/backend/commands/player/troll/set_bounty.cpp | 6 ++++-- src/core/globals.hpp | 3 ++- src/util/troll.hpp | 6 +++--- src/views/players/player/player_troll.cpp | 8 +++++--- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/backend/commands/player/troll/set_bounty.cpp b/src/backend/commands/player/troll/set_bounty.cpp index cdf2db72..e0242215 100644 --- a/src/backend/commands/player/troll/set_bounty.cpp +++ b/src/backend/commands/player/troll/set_bounty.cpp @@ -1,4 +1,5 @@ #include "backend/player_command.hpp" +#include "backend/bool_command.hpp" #include "natives.hpp" #include "pointers.hpp" #include "util/troll.hpp" @@ -11,9 +12,10 @@ namespace big virtual void execute(player_ptr player, const std::vector& _args, const std::shared_ptr ctx) { - troll::set_bounty_on_player(player, 10000); + troll::set_bounty_on_player(player, 10000, g.session.anonymous_bounty); } }; set_bounty g_bounty("bounty", "Bounty", "Sets a 10k bounty on the player", 0); -} \ No newline at end of file + bool_command g_anonymous_bounty("anonbounty", "Anonymous Bounty", "Don't show your name when setting a bounty on someone", g.session.anonymous_bounty); +} diff --git a/src/core/globals.hpp b/src/core/globals.hpp index 8e226710..521a1991 100644 --- a/src/core/globals.hpp +++ b/src/core/globals.hpp @@ -332,6 +332,7 @@ namespace big bool wanted_level_all = false; bool show_cheating_message = false; + bool anonymous_bounty = true; NLOHMANN_DEFINE_TYPE_INTRUSIVE(session, local_weather, override_time, override_weather, custom_time, disable_chat_filter, log_chat_messages, @@ -339,7 +340,7 @@ namespace big player_magnet_count, is_team, name_spoof_enabled, advertise_menu, spoofed_name, join_in_sctv_slots, kick_chat_spammers, kick_host_when_forcing_host, explosion_karma, damage_karma, disable_traffic, disable_peds, force_thunder, block_ceo_money, randomize_ceo_colors, send_to_apartment_idx, send_to_warehouse_idx, - chat_commands, chat_command_default_access_level, show_cheating_message) + chat_commands, chat_command_default_access_level, show_cheating_message, anonymous_bounty) } session{}; struct settings diff --git a/src/util/troll.hpp b/src/util/troll.hpp index b7cd5ce7..b02ed234 100644 --- a/src/util/troll.hpp +++ b/src/util/troll.hpp @@ -6,7 +6,7 @@ namespace big::troll { - inline void set_bounty_on_player(player_ptr target, int value) + inline void set_bounty_on_player(player_ptr target, int value, bool anonymous) { const size_t arg_count = 22; int64_t args[arg_count] = @@ -17,7 +17,7 @@ namespace big::troll 1, value, 0, - 1, + anonymous ? 1 : 0, 0, 0, 0, @@ -38,4 +38,4 @@ namespace big::troll g_pointers->m_trigger_script_event(1, args, arg_count, 1 << target->id()); } -} \ No newline at end of file +} diff --git a/src/views/players/player/player_troll.cpp b/src/views/players/player/player_troll.cpp index e23da373..5dba01da 100644 --- a/src/views/players/player/player_troll.cpp +++ b/src/views/players/player/player_troll.cpp @@ -17,12 +17,14 @@ namespace big components::player_command_button<"rcplayer">(g_player_service->get_selected()); static int bounty_value = 0; - + ImGui::SliderInt("Bounty", &bounty_value, 0, 10000); ImGui::SameLine(); - components::button("Set", [] { troll::set_bounty_on_player(g_player_service->get_selected(), bounty_value);}); + components::command_checkbox<"anonbounty">(); + ImGui::SameLine(); + components::button("Set", [] { troll::set_bounty_on_player(g_player_service->get_selected(), bounty_value, g.session.anonymous_bounty);}); ImGui::TreePop(); } } -} \ No newline at end of file +}